Sie sind auf Seite 1von 2

SHRINATH JI INSTITUTE FOR TECHNICAL EDUCATION NAME:.. B .

TECH Ist YR (GROUP A&B) COMPUTER CONCEPTS & PROGRAMMING IN C QUIZ PAPER 2011-12 TIME:15 Min Maximum Marks:10 ROLLNo:-..........................

1. What will be output if you will compile and execute the following c code? void main(){ int a=5; float b; printf("%d",sizeof(++a+b)); printf(" %d",a); } (a)2 6 (b) 4 6 (c)2 5 (d)4 5 (e)Compiler error

2. What will be output if you will compile and execute the following c code? void main(){ char *str; scanf("%[^\n]",str); printf("%s",str); } (a)It will accept a word as a string from user. (b)It will accept a sentence as a string from user. (c)It will accept a paragraph as a string from user. (d)Compiler error (e)None of above 3. What will be output if you will compile and execute the following c code? void main(){ int array[3]={5}; int i; for(i=0;i<=2;i++) printf("%d ",array[i]); } (a)5 garbage garbage (b)5 0 0 (c)5 null null (d)Compiler error (e)None of above

4. What will be output if you will compile and execute the following c code? void main(){ int array[2][2][3]={0,1,2,3,4,5,6,7,8,9,10,11}; printf("%d",array[1][0][2]); } (a)4 (b)5 (c)6 (d)7 (e)8 5. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array? (a)The element will be set to 0. (b) The compiler would report an error. (c)The program may crash if some important data gets overwritten. (d)The array size would appropriately grow. 6. If the two strings are identical, then strcmp() function returns (a) -1 (b) 1 (c) 0 7. How will you print \n on the screen? (b) (a) printf("\n"); (b) echo \\n; (c) printf('\n');

(d) YES

(d) printf("\\n");

8. The keyword used to transfer control from a function back to the calling function is . 9. Write any three unary operators in C.. , , . . 10. How will you free the allocated memory ?Write the syntax..

Das könnte Ihnen auch gefallen