C_apptitude For Beginners

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View C_apptitude For Beginners as PDF for free.

More details

  • Words: 464
  • Pages: 6
2.1 The following code is not displaying the correct output, which is 1500. Identify the error.

#include<stdio.h> #include main() { // this program calculates the simple interest int p,t, si; float r; p = 5000; t = 4; r = 7.5; si = p*t*r/100; clrscr(); printf("%f", si); getch(); }

2.2 The following code is not displaying the output on the screen. Identify the error.

#include<stdio.h> #include main () { /*this program allows you to enter a number and display that number on the screen*/ int number; printf("Enter a number "); scanf("%d", &number); printf("you have entered the number", number);

}

2.3 Identify the error in the following code

#include<stdio.h> #include main() {//this program calculate the area of the circle float area; int radius=4; area = 3.14*radius**2; printf("%f", area); }

2.4 Identify the error in the following code

#include<stdio.h> #include main() { // this program display hello on the 'screen'

char name; name = 'hello'; printf("%c", name); } 2.5 Identify the error in the following code #include<stdio.h> #include typedef int no of students;

typedef int maximum marks; main() { no of students num; maximum marks max; printf("enter the number of students"); scanf("%d",&num); printf("Enter the maximum marks"); scanf("%d",&max); printf("%d %d", naum, max); getch();

}

2.6 Identify the error in the following code #include<stdio.h> #include main() { const char x = 'Z'; int a = 4; clrscr(); a = 5;

}

2.7 Identify the errors in the following code

#include<stdio.h>

#include main() { int a = 5, c = 2, d = 4, n = 6; float ans; ans = 10.2/a + (2*a+(3c +4)/a*d/(12/n)); clrscr(); printf("%f", ans); getch(); }

2.8 Identify the error in the following program.

#include<stdio.h> #include main() { char x, y; int z; x = a; y = b; z = x + y; printf("%d", z); getch();

}

2.9 Identify the error in the following code

#include<stdio.h> #include

main() { enum fruits { apple, oranges, mango}; enum color {orange, red , pink}; enum fruits f; enum color c; f = apple; c = pink; clrscr(); printf("The value of the apple is %d\n", f); printf("The value of the pink is %d\n",c); getch();

}

2.10 The following is not displaying thr correct output. Identify the errors.

#include<stdio.h> #include main() { int num; clrscr(); printf("Enter a number "); scanf("%d", &num);(num = 1?printf("The number entered id 1" ); getch();

}

2.11 What is the difference between the following two statements? char *str = " Computer";

char arr[] = "Computer";

2.12 What is the output of the following program?

enum p {a = 1, b, c , d, f = 60, y}; printf("%d", y);

2.13 What is the output of the following program?

#include<stdio.h> void main() { int i = 2, j = 3, k = 0; int p; p = (i , k, j ); printf("%d\n", p );

}

Related Documents

Beginners
November 2019 43
Pali For Beginners
June 2020 13