Vous êtes sur la page 1sur 18

1. Which of the following language is predecessor to C Programming Language?

A B BCPL C++

2. C programming language was developed by Dennis Ritchie Ken Thompson Bill Gates Peter Norton

3. C was developed in the year ___ 1970 1972 1976 1980

4. C is a ___ language High Level Low Level Middle Level Machine Level

5. C language is available for which of the following Operating Systems? DOS Windows Unix All of these

6. Which of the following symbol is used to denote a pre-processor statement? ! # ~ ;

7. Which of the following is a Scalar Data type Float Union Array Pointer

8. Which of the following are tokens in C? Keywords Variables Constants All of the above

9. What is the valid range of numbers for int type of data? 0 to 256 -32768 to +32767 -65536 to +65536 No specific range

10. Which symbol is used as a statement terminator in C? ! # ~ ;

11. Which escape character can be used to begin a new line in C? \a \b \m \n

12. Which escape character can be used to beep from speaker in C? \a \b \m \n

13. Character constants should be enclosed between ___ Single quotes Double quotes Both a and b None of these

14. String constants should be enclosed between ___ Single quotes Double quotes Both a and b None of these

15. Which of the following is invalid? a abc

16. The maximum length of a variable in C is ___ 8 16 32 64

17. What will be the maximum size of a float variable? 1 byte 2 bytes 4 bytes 8 bytes

18. What will be the maximum size of a double variable? 1 byte 4 bytes 8 bytes 16 bytes

19. A declaration float a,b; occupies ___ of memory 1 byte 4 bytes 8 bytes 16 bytes

20. The size of a String variable is 1 byte 8 bytes 16 bytes None of these

1. Which of the following is an example of compounded assignment statement? a=5 a += 5 a=b=c a=b

2. The operator && is an example for ___ operator. Assignment Increment Logical Rational

3. The operator & is used for Bitwise AND Bitwise OR Logical AND Logical OR

4. The operator / can be applied to integer values float values double values All of these

5. The equality operator is represented by := .EQ. = ==

6. Operators have hierarchy. It is used to know which operator is most important is used first is faster operates on large numbers

7. The bitwise AND operator is used for Masking Comparison Division Shifting bits

8. The bitwise OR operator is used to set the desired bits to 1 set the desired bits to 0 divide numbers multiply numbers

9. Which of the following operator has the highest precedence? * == => +

10. The associativity of ! operator is Right to Left Left to Right (a) for Arithmetic and (b) for Relational (a) for Relational and (b) for Arithmetic

11. Which operator has the lowest priority? ++ % + ||

12. Which operator has the highest priority?

++

||

13. Operators have precedence. A Precedence determines which operator is faster takes less memory evaluated first takes no arguments

14. Integer Division results in Rounding the fractional part truncating the fractional part Floating value An Error is generated

15. Which of the following is a ternary operator? ? * sizeof ^

16. What will be the output of the expression 11 ^ 5? 5 6 11 None of these

17. The type cast operator is (type) cast() // ""

18. Explicit type conversion is known as Casting Conversion Disjunction Separation

19. The operator + in a+=4 means a=a+4 a+4=a a=4 a=4+4

20. p++ executes faster than p+1 because p uses registers p++ is a single instruction ++ is faster than + None of these

1. Which of the following statements is true? C Library functions provide I/O facilities C inherent I/O facilities C doesnt have I/O facilities Both (a) and (c)

2. Header files in C contain Compiler commands Library functions Header information of C programs Operators for files

3. Which pair of functions below are used for single character I/O. Getchar() and putchar() Scanf() and printf() Input() and output() None of these

4. The printf() function retunes which value when an error occurs? Positive value Zero Negative value None of these

5. Identify the wrong statement putchar(65) putchar('x') putchar("x") putchar('\n')

6. Which of the following is charecter oriented console I/O function? getchar() and putchar() gets() and puts() scanf() and printf() fgets() and fputs()

7. The output of printf("%u", -1) is -1 minimum int value maxium int value Error message

8. An Ampersand before the name of a variable denotes Actual Value Variable Name Address Data Type

9. Symbolic constants can be defined using # define const symbols None of these

10. Null character is represented by \n \0 \o \e

11. Which header file is essential for using strcmp() function? string.h strings.h text.h strcmp.h

12. malloc() function used in dynamic allocation is available in which header file? stdio.h stdlib.h conio.h mem.h

13. File manipulation functions in C are available in which header file? streams.h stdio.h stdlib.h files.h

14. C supports how many basic looping constructs 2 3 4 6

15. A statement differs from expression by terminating with a ; : NULL .

16. What should be the expression return value for a do-while to terminate 1 0 -1 NULL

17. Which among the following is a unconditional control structure do-while 18. continue statement is used to go to the next iteration in a loop come out of a loop exit and return restarts to the main iterations from function beginning of loop if-else goto for

19. Which operator in C is called a ternary operator if..then ++ ? ()

20. Which of the following header file is required for strcpy() function? string.h strings.h files.h strcpy()

1. The meaning of conversion character for data input is

Data item is an Data item is a Data item is a unsigned decimal long integer short integer integer

None of the above

2. The conversion characters for data input means that the data item is An unsigned decimal integer A short integer A hexadecimal integer A string followed by white space

3. An expression contains relational, assign. ment and arithmetic operators. If Parenthesis are not present, the order will be Relational, Assignment, arithmetic, arithmetic, relational assignment Assignment, relational, arithmetic Arithmetic, relational, assignment

4. Which of the following is a key word is used for a storage class printf external auto scanf

5. In the C language 'a represents a digit an integer a character a word

6. The number of the relational operators in the C language is Four Six Three One

7. A compound statement is a group of statements included between a pair of double quote 8. A Link is a compiler an active debugger a C interpreter a analyzing tool in C curly braces parenthesis a pair of /s

9. The continue command cannot be used with for 10. In C, a Union is memory location memory store memory screen None of these switch do while

11. When the main function is called, it is called with the arguments argc argv None of these both a & b

12. A multidimensional array can be expressed in terms of array of pointers array without the rather than as pointers group of contiguous to a group of array contiguous array

data type arrays

None of these

13. C allows arrays of greater than two dimensions, who will determined this programmer compiler parameter None of these

14. A pointer to a pointer in a form of multiple indirection a chain of pointers both a and b None of these

15. Pointers are of integer data type type character data unsigned integer data types None of these

16. Maximum number of elements in the array declaration int a[5][8] is 28 32 35 40

17. If the size of the array is less than the number of initializers then, Extra values are Generates an being ignored error message 18. Array subscripts in C always start at -1 19. A Structure can be read as a cannot be read as can be displayed single entity a single entity as a single entity 20. Identify the invalid pointer arithmetic Comparision of Assigning the Subtracting an pointers that do not value 0 to a pointer point to the element integer from a pointer variable of the same array Q1. What will be the output of the following arithmetic expression ? 5+3*2%10-8*6 a) -37 b) -42 c) -32 d) -28 Q2. What will be the output of the following statement ? int a=10; printf("%d &i",a,10); a) error b) 10 c) 10 10 d) none of these Q3. What will be the output of the following statement ? printf("%X%x%ci%x",11,10,'s',12); a) error b) basc c) Bas94c d) none of these Q4. What will be the output of the following statements ? Addition of float value to a pointer int a = 4, b = 7,c; c = a = = b; printf("%i",c); a) 0 b) error c) 1 d) garbage value Q 5. What will be the output of the following statements? int a = 5, b = 2, c = 10, i = a>b has member variables that cannot be read individually 1 0 Value provided by user Size of Array is increased Size is neglected when values are given

void main() { printf("hello"); main(); } a) 1 b) 2 c) infinite number of times d) none of these Q7. What will be the output of the following statements? int x[4] = {1,2,3}; printf("%d %d %D",x[3],x[2],x[1]); a) 03%D b) 000 c) 032 d) 321 Q8. What will be the output of the following statement? printf( 3 + "goodbye"); a) goodbye b) odbye c) bye d) dbye

Q9. What will be the output of the following statements? long int a = scanf("%ld%ld",&a,&a); printf("%ld",a); a) error b) garbage value c) 0 d) 2 Q10. What will be the output of the following program ? #include void main() { int a = 2; switch(a) { case 1: printf("goodbye"); break; case 2: continue; case 3: printf("bye"); } } a) error b) goodbye c) bye d) byegoodbye Q11. What will be the output of the following statements ? int i = 1,j; j=i--- -2; printf("%d",j); a) error b) 2 c) 3 d) -3 Q12. What will be the output of following program ? #include main() { int x,y = 10; x = y * NULL; printf("%d",x); } a) error b) 0 c) 10 d) garbage value Q13. What will be the output of following statements ? char x[ ] = "hello hi"; printf("%d%d",sizeof(*x),sizeof(x)); a) 88 b) 18 c) 29 d) 19 Q14. What will be the output of the following statements? int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8)); printf("%d",d); a) 1 b) 2 c) 6 d) 8 Q15. What will be the output of the following statements ? int i = 3; printf("%d%d",i,i++); a) 34 b) 43 c) 44 d) 33 Q16. What will be the output of the following program ? #include

void main() { int a = 36, b = 9; printf("%d",a>>a/b-2); } a) 9 b) 7 c) 5 d) none of these Q17) int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; What value does testarray[2][1][0] in the sample code above contain? a) 11b) 7c) 5d) 9 Q18) void main() { int a=10,b=20; char x=1,y=0; if(a,b,x,y) { printf("EXAM"); } } What is the output? 1) XAM is printed 2) exam is printed 3) Compiler Error 4) Nothing is printed Q19) What is the output of the following code? #include void main() { int s=0; while(s++<10)> # define a 10 main() { printf("%d..",a); foo(); printf("%d",a); } void foo() { #undef a #define a 50 }

1) 10..10 2) 10..50 3) Error 4) 0 Q21) main() { struct { int i; }xyz; (*xyz)->i=10; printf("%d",xyz.i); } What is the output of this program? 1) program will not compile 2) 10 3) god only knows 4) address of I Q22) What would be the output of the following program? #include main() { char str[]="S\065AB"; printf("\n%d", sizeof(str)); }

1) 7 2) 6 3) 5 4) error Q23) What will be the value of `a` after the following code is executed #define square(x) x*x a = square(2+3) 1) 25 2) 13 3) 11 4) 10 Q24) #include void func() { int x = 0; static int y = 0; x++; y++; printf( "%d -- %d\n", x, y ); }

int main() { func(); func(); return 0; } What will the code above print when it is executed? 1) 1 -- 1 1 -- 1 2) 1 -- 1 2 -- 1 3) 1 -- 1 2 -- 2 4) 1 -- 1 1 -- 2

Q25) long factorial (long x) { ???? return x * factorial(x - 1); } With what do you replace the ???? to make the function shown above return the correct answer? 1) if (x == 0) return 0; 2) return 1; 3) if (x >= 2) return 2; 4) if (x <= 1) return 1;

Q 26) int y[4] = {6, 7, 8, 9}; int *ptr = y + 2; printf("%d\n", ptr[ 1 ] ); What is printed when the sample code above is executed? 1) 6 2) 7 3) 8 4) 9 . Q27)

int i = 4; switch (i) { default: ; case 3: i += 5; if ( i == 8) { i++; if (i == 9) break; i *= 2; } i -= 4; break; case 8: i += 5; break; } printf("i = %d\n", i); What will the output of the sample code above be? 1) i = 5 2) i = 8 3) i = 9 4) i = 10

1 What is the output of:


main( ) { float a = 5, b = 2 ; int c ; c = a % b ; printf ( "%d", c ) ; } A. 1

B. 0 C. 2 D. Compile Time Error 2 Find the output of the following program?


#include<stdio.h> void main( ) { printf ( "nn \n\n nn\n" ) ; printf ( "nn /n/n nn/n" ) ; }

A. nn
nn nn /n/n nn/n

B. nn
nn nn /n nn/n nn nn nn /n nn Error "/n" not recognized

C.

D.

3 What is the output of the following programs:


Program 1: #include<stdio.h> void main() { printf("%d %d %d %d ",65,065,0x65,0X65); } Program 2: #include<stdio.h> void main() { printf("%d %o %x",65,65,65); }

A. 65 65 65 65 and 65 53 101 B. Compiler Error, Compiler Error C. 65 53 101 101 and 65 101 41 D. None of the Above 1 Identify which are declarations? (select 2) A. double pow(double,double); B. float squar(float a){} C. float b; D. extern int a; 2 One c program is written in 2 files
/*Program1.c*/ int x=10 /*Program2.c*/ #include "Program1.c" int main() { extern int x; printf("x : %d",x); } In Program2.c statement extern int x; is not needed.

A. True

B. False 3 A function can have several declaration, but only one definition? A. True B. False 4 Which of the following is the correct output of the program?
#include<stdio.h> int main() { int a[5]={9,10}; printf("%d,%d",a[1],a[2]); return 0; }

A. 9, 10 B. 10, 0 C. 0, 0 D. 0, 9 5 What is the output of following program?


#include<stdio.h> int main() { void *ptr1, *ptr2, x; int y; x = 100; y = 200; ptr1 = &x; ptr2 = &y; printf("%d", *ptr1); pritnf("%d", *ptr2); return 0; }

A. error: variable or field x declared void B. 100,200 C. garbage value , 200 D. None of above 6 Guess the Output.
#include<stdio.h> int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d\n", stud1, stud2, stud3); return 0; }

A. 0, 1, 2 B. 1, 2, 3 C. 0, 2, 1 D. 1, 3, 2 7 Which of the following declarations are correct? A. short i=10; B. static i=10; C. unsigned i=10; D. const i=10;

1 What is the output of the following program?


#include<stdio.h> void main() { int a=8,b=4; int c,d; c= a>6; d= a>2 && b==3; printf("c = %d, d= %d",c,d); }

A. c= 1, d= 0 B. c= 0, d= 0 C. c= 0, d= 1 D. Compilation Error 2 What is the output of the following program?


#include<stdio.h> void main() { int i=10; switch(i) { case 1: printf(" i=1"); break; case 10: printf(" i=10"); case 11: printf(" i=11"); break; case 12: printf(" i=12"); } } A. i=10 i=11 i=12

B. i=1 i=10 i=11 i=12 C. i=10 i=11 D. None of the Above 3 What is the output of the following program?

#include<stdio.h> void main() { char c = 'c'; switch(c) { case 'a' : printf("inside case a,"); break; case 'b' : printf("inside case b,"); break; case 'c' : printf("inside case c,"); case 'd' : printf("inside case d,"); continue; default: printf("inside default case"); break; } }

A. inside case c, inside case d B. inside case c C. inside case c, inside case d, inside default case D. Compilation Error 4 What is the output of the following program?
#include<stdio.h> void main() { char c= 'a'; switch(c) { case 65 : printf("inside case A,"); break; case 97 : printf("inside case a,"); break; default: printf("inside default case"); break; } }

A. inside default case B. inside case a, C. Compilation Error D. inside case A, 5 What is the output of the following program?
#include<stdio.h> void main() { int a=8,b=4; int c; c=(a<6) || (b=10); printf("\nc= %d, a=%d, b=%d",c,a,b); }

A. c= 1, b= 4 B. c= 1, b= 10

C. c= 0, b= 4 D. Compilation Error 6 What is the output of the following program?


#include<stdio.h> void main() { int a=8,b=4,c; c= ((a<6) && (b=10)) printf("\nc= %d, b=%d",c,b); } A. c=1 b=10

B. c=1 b=4 C. c=0 b=4 D. c=0 b=10 7 What is the output of the following program?
#include<stdio.h> void main() { int x=10,y=5,z=0; if (!x >=50) y=15; printf("x=%d, y=%d , !x=%d, !z=%d", x,y,!x,!z); } A. =10, y=15, !x=10, !z=1

B. x=10, y=5, !x=1, !z=0 C. x=10, y=5, !x=0, !z=1 D. Compilation Error 8 What is the output of the following program?
#include<stdio.h> void main() { int a=1,b=20; if (a && b>5 > 25) printf("Yo!"); else printf("Baby!"); } A. Yo!

B. Baby! C. Compilation Error D. Run Time Error 9 What is the output of the following program?
#include<stdio.h> void main() { int i=1,j=1; while (++i < 10) printf("%d ",i);

printf("\n"); while (j++ < 10) printf("%d ",j); }

A. 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10 B. 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10 C. 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 10 D. 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10 What is the output of the following program? #include<stdio.h> void main(){ int i=1; switch(i<<2+i){ default:printf("Default Case"); case 4: printf(" Case 4"); case 8: printf(" Case 8"); case 5: printf(" Case 5"); } } A. Default Case Case 4 Case 8 Case 5

10

B. Case 8
Case 5

C. Case 8 D. Compile Time Error: Invalid Switch Expression 11 What is the output of the following program?
#include<stdio.h> void main() { int i=10; if(i ==10) printf("I is 10"); else if ( i <= 10) printf(",I is less than or equal to 10"); else { break; } } A. I is 10

B. I is 10 ,I is less than or equal to 10 C. Compile Time Error D. None of the Above 12 What is the output of the following program?

#include<stdio.h> void main() { int x=1; switch(x) { case case case case } }

x: 2: 3: 4:

printf("case printf("case printf("case printf("case

1"); 2"); 3"); 4");

break; break; break; break;

A. case 1 B. case 1
case 2 case 3 case 4 Compile Time Error

C.

D. None of the Above

Vous aimerez peut-être aussi