1. What is (void*)0? A. Representation of NULL pointer B. Representation of void pointer C. Error D.None of above Answer: Option A 2.

What will be the output of the program ? #include<stdio.h> int main() { int i=3, *j, k; j = &i; printf("%d\n", i**j*i+*j); return 0; } A.30 B. 27 C. 9 D. 3

Answer: Option A 3. What will be the output of the program If the integer is 4bytes long? #include<stdio.h> int main() { int ***r, **q, *p, i=8; p = &i; q = &p; r = &q; printf("%d, %d, %d\n", *p, **q, ***r); return 0; } A. 8, 8, 8 C. 4000, 4004, 4008 Answer: Option A 4. What will be the output of the program ?

B. 4000, 4002, 4004 D.4000, 4008, 4016

return 0. s++ +3). *(int*)vp). vp=&j. *(char*)vp). JAK Answer: Option D 5. What will be the output of the program ? #include<stdio. printf("%c". p="hello".h> int main() { void *vp. return 0. int j=65. vp=&ch. } A. printf("%c". eace D. Ace Answer: Option D 6. return 0. *&*&p). printf("%s\n". char ch=74. char *s = str. J65K D. JCK C.h> int main() { char str[] = "peace".JACK B.h> int main() { char *p. printf("%s". printf("%s\n".#include<stdio. (char*)vp+2).ce . vp=cp. What will be the output of the program ? #include<stdio. } B. Peace C. *cp="JACK". } A.

} A. Ello Answer: Option B B. *x=100.None of above Answer: Option C 8.A. How many bytes will be allocated for the following code? #include<stdio. return 0.memalloc(variable_name. Assume integer is 2 bytes wide. return 0. 24 bytes D. } A. hello D. What function should be used to free the memory allocated by calloc() ? A. dealloc().h> int main() { int *x. 0) . malloc(variable_name.12 bytes Answer: Option C B. free(). Answer: Option C 9. 0) D. p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p)).h 7. Point out the compile time error in the program given below. Llo C. 128 bytes C. 56 bytes B. Error: suspicious pointer conversion C. C.h> #include<stdlib. #include<stdio. Error: invalid assignment for x B. No error D.h> #define MAXROW 3 #define MAXCOL 4 int main() { int (*p)[MAXCOL].

go back Answer: Option D 14. 20. j. 15 Answer: Option C 13. 20 . return 0. if you pass an array as an argument to a function. 5 D. 2. Value of elements in array B. 25}. What does the following declaration mean? int (*ptr)[10].2. ptr is a pointer to an array of 10 integers C. i. 1. printf("%d. 3. 1.return B. Switch C. m). In C. } A. j. %d". What will be the output of the program ? #include<stdio. goto D.ptr is an pointer to array Answer: Option B 11. A. 15.h> int main() { int a[5] = {5. %d.10. int i. what actually gets passed? A. i = ++a[1]. 2. j = a[1]++. 1. m = a[i++]. The keyword used to transfer control from a function back to the calling function is A. 15 C. m. First element of the array C. ptr is array of pointers to 10 integers B. 2. Point out the error in the program B. ptr is an array of 10 integers D. Base address of the array D. 3.Address of the last element of array Answer: Option C 12.

How will you print \n on the screen? A. printf('\n'). then strcmp() function returns A. printf("\n"). echo "\\n". Answer: Option D 17. printf(). -1 C. Which of the following function is more appropriate for reading in a multi-word string? A. D. int b) { int a.Yes B. } A.None of above Answer: Option C 15. B. 0 Answer: Option C 16. int b) C. C. return a. 1 D.puts(). The function should be defined as int f(int a. Missing parenthesis in return statement B. scanf(). C. Good D. What will be the output of the program ? #include<stdio.Morning . } A.f(int a. return 0. Good Morning C.h> int main() { printf(5+"Good Morning\n"). a = 20. D.printf("\\n"). gets(). Redeclaration of a D. If the two strings are identical. M B. Answer: Option C 18. B.

Siva. "Sona". if(printf("%s".0 . int i. return 0. The string is empty C. Ritu. Suresh. Sona. "Ritu"}. i++) printf("%s. Suresh. names[4] = t. else printf("The string is not empty\n"). Sona. names[3] = names[4]. Siva. Sona. Suresh.Answer: Option D 19. What will be the output of the program ? #include<stdio. Ritu B. The string is not empty D. names[i]). char *t. t = names[3]. } A. What will be the output of the program ? #include<stdio. Baiju Answer: Option B 20.". Ritu D. a)) printf("The string is empty\n"). } A. "Siva". char a[] = "\0". i<=4. Siva. for(i=0.Suresh. return 0. Baiju.h> int main() { int i. "Baiju". Ritu. Baiju C. Siva. No output Answer: Option B B. Sona. Baiju.h> int main() { char *names[] = { "Suresh".

Float C. ! 2. 2. How would you round off a value from 1. 1. Which of the following are unary operators in C? 1. roundup(1. Relational 2. 2.+ = .roundto(1. long double Answer: Option B B. 4321 Answer: Option A 24.66) C.3214 B. ~ 4.0? A. 2 C.+ = Answer: Option A 22. 4 Answer: Option D 23.66) D. * / % + .far double B. Assignment A. By default a real number is treated as a A. 3 D.66) Answer: Option A 25. 3 B. floor(1. = * / % + D.* % / . double D. 2134 C. && A.66 to 2. 1234 D. Logical 4. Arithmetic 3. ceil(1. In which order do the following gets evaluated 1.= C. sizeof 3.21.1. / * % .66) B. 1. Which of the following is the correct order of evaluation for the below expression? z=x+y*z/4%2-1 A.

return 0. ptrx = &x. x). The first character in the file B.Calling B. When we mention the prototype of a function? A. return 0. Defining C. Is the following statement a declaration or definition? extern int i. } A. "r").26. Declaration C. A. printf("%d\n". Declaring D. 10 D. Definition D. What does fp point to in the program ? #include<stdio. Prototyping Answer: Option B 28. What will be the output of the program? #include<stdio.h> int main() { FILE *fp. fp=fopen("trial". *ptrx = 10. Error Answer: Option C 29. const int *ptrx. } A.h> int main() { const int x=5. 5 C. Function Answer: Option A 27.Error .Garbage value B.

b). Answer: Option A 31. *fp. printf("%Lf %f". a.h> int main() { FILE *fs. *ft. printf("%f %lf". fclose(fp. Answer: Option B 30. ft = fopen("C. double b=3. C. b). return 0. fp = fopen("A. printf("%Lf %Lf".C".14. which of the following printf() statement will you use? #include<stdio. b).C" B. a. Which of the following operations can be performed on the file "NOTES.printf("%f %Lf". Writing D. } A.h> float a=3. b). "r+").C" "C.B.TXT" using the below code? FILE *fp. Reading C. "r"). "A. B.C" "B. fs. "r").14. Which files will get closed through the fclose() in the following program? #include<stdio.C". A structure which contains a char pointer which points to the first character of a file.C" B. D. a.C". A. To print out a and b given below.The last character in the file. fp = fopen("NOTES. C. a. fs = fopen("B. Appending Answer: Option D 32. A. "B. The name of the file.Read and Write . ft).TXT".C" "C. D. "r").

h> int main() { int j=1.enum B. 256 times Answer: Option B 35.254 times B. } return 0. Float Answer: Option C B. &a.scanf("%f %lf". &b). How many times the while loop will get executed if a short int is 2 byte wide? #include<stdio. j). Answer: Option D 34. To scan a and b given below. while(j <= 255) { printf("%c %d\n".h> float a. j. Character C. &a. Infinite times C.Error in fclose() 33.C" Answer: Option D D. j++. Integer D.C. &a. . Which of the following cannot be checked in a switch-case statement? A. A. &b). scanf("%f %f". "A. double b. &a. 255 times D. D. scanf("%f %Lf". which of the following scanf() statement will you use? #include<stdio. &b). } A. C. &b). scanf("%Lf %Lf".

Sign up to vote on this title
UsefulNot useful