P. 1
Technical Questions

Technical Questions

|Views: 40|Likes:
Published by Astha Lad

More info:

Published by: Astha Lad on Jan 25, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less





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

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

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

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

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

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

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

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

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

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

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->