Sie sind auf Seite 1von 2

Test: C Basic (Sample Paper) C Basic (Sample Paper) Date : Duration: Name: __________________

Ps Number: _____________

1. How many parameters does the function, "malloc", take a) One b) Two c) Three d) Four 2. Members of a structure cannot be pointers unless the structure itself is a pointer a). True b) False 3. strcpy(name, "Anand"); a) The minimum size "name" could be is 5 b) The minimum size "name" could be is 6 c) "name" could be any size as it is resized after a copy d) The parameters to strcpy are in the wrong order 4. What happens if the "break" statement is omitted in a switch statement a) The program will not compile b) A run-time error will occur c) It will go on to the next Case statement d) Nothing 5. if (first == second) a) If "first" and "second" were character arrays, the condition would be true is they were equal b) If "first" and "second" were character arrays, the condition would be true is they were not equal c) If "first" and "second" were character arrays, the condition could never be true d) If "first" and "second" were character arrays, the condition would be a syntax error 6. Which of the following declarations declares an array with 7 elements a) int num(6); b) int num(7); c) int num[6]; d) int num[7]; 7. printf("%%d prints Integers"); a) Prints "%d prints Integers" b) Prints "%%d prints Integers" c) Prints "0 prints Integers" d) Poduces a syntax error 8. if (x = 12) a) Is true if x is 12 b) Is never true c) Is always true 9. int square(int x); a) Is a function prototype b) Is the main function body

SET Batch

L & T Infotech

Page 1 of 2

Test: C Basic (Sample Paper)

10. x = ++y; a) If y = 10, x will be assigned 10 and y will become 11 b) If y = 10, x will be assigned 9 and y will become 9 c) If y = 10, x will be assigned 11 and y will become 11 d) If y = 10, x will be assigned 11 and y will remain at 10 11. "My salary was increased by 15%!" Select the statement which will EXACTLY reproduce the line of text above. a) printf("\"My salary was increased by 15/%\!\"\n"); b) printf("My salary was increased by 15'%'!\n"); c) printf("\"My salary was increased by 15%%!\"\n"); d) printf("\"My salary was increased by 15'%'!\"\n"); e) printf("My salary was increased by 15%%!\n"); 12. double x, y; x = 1.0; y = 2.0; printf("%.2f\n", (double) ((int)x / (int)y) + (x/y) ); What number will be printed when the sample code above is executed? a) -0.00 b) 0.00 c) 0.25 d) 0.50 e) 1.00 13. Which of the following is evaluated first: a) && b) || c) ! 14. In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h 15. What are pointers, when declared, intialized to? a) NULL b) Newly allocated memory c) Nothing. Its random

SET Batch

L & T Infotech

Page 2 of 2

Das könnte Ihnen auch gefallen