questions

9
1. What does the following declaration mean? int (*ptr)[10]; A.ptr is array of pointers to 10 integers. B.ptr is a pointer to an array of 10 integers C.ptr is an array of 10 integers D.ptr is an pointer to array Answer-B- ptr is a pointer to an array of 10 integers. 2. What will be output of the following c program? #include<stdio.h> int main(){ int goto=5; printf("%d",goto); return 0;} (A) 5.(B) **.(C) **.(D) Compilation error.(E) None of these. Answer: (D) 3.How many bytes are occupied by near, far and huge pointers (LINUX)? A. near=2 far=4 huge=4. B. near=4 far=8 huge=8 C. near=2 far=4 huge=8.D. near=4 far=4 huge=4 Answer: (D) 4. Are the expression *ptr++ and ++*ptr are same? Ans-False. 5. Which of the declaration is correct? A. int length;B. char int;. C.int long; D.float double; Ans-A

Upload: chittaranjan-pradhan

Post on 16-Dec-2015

4 views

Category:

Documents


0 download

DESCRIPTION

c questions

TRANSCRIPT

1. What does the following declaration mean?int (*ptr)[10];A.ptr is array of pointers to 10 integers.B.ptr is a pointer to an array of 10 integersC.ptr is an array of 10 integersD.ptr is an pointer to arrayAnswer-B- ptr is a pointer to an array of 10 integers.2. What will be output of the following c program?#includeint main(){int goto=5;printf("%d",goto);return 0;}(A) 5.(B) **.(C) **.(D) Compilation error.(E) None of these.Answer: (D)3.How many bytes are occupied bynear, farandhugepointers (LINUX)?A. near=2 far=4 huge=4. B. near=4 far=8 huge=8C. near=2 far=4 huge=8.D. near=4 far=4 huge=4Answer: (D)4. Are the expression*ptr++and++*ptrare same?Ans-False.5. Which of the declaration is correct?A. int length;B. char int;. C.int long; D.float double;Ans-A6. How will you free the allocated memory ?A. remove(var-name);.B. free(var-name);.C. delete(var-name);.D. dalloc(var-name);Ans-B7. Which of the following is not logical operator?A. &;B. &&;C. ||; D.!Ans-A8. How will you print \n on the screen?A. printf("\n");B. echo "\\n";.C. printf('\n');.D. printf("\\n");Ans-D.9. Int main(){printf(%d\n,strlen(123456));}A.6.B.7.C.2.D.8Ans-A10. {printf(5+Good Morning\n);}A.Good Morning;B. Morning;C.M;D.GoodAns-B11. Which of the following is not a type of constructor?A. Copy constructor;B. Friend constructor;C. Default constructor;D. Parameterized constructorAns-B12. What is wild pointer in c?Ans- A pointer in c which has not been initialized is known as wild pointer13. What is size of void pointer?Ans- two byte14. what is the output ofvoidmain(){printf("%d",sizeof(5.2));}A.6;B.7;C.2;D.8;Ans- D-8byte15. Swap two variables without using third variableAns-#includeintmain(){inta=5,b=10;a=b+a;b=a-b;a=a-b;printf("a= %db=%d",a,b);16. What isdifferencebetweenuninitializedpointer and null pointer?Ans- An uninitialized pointer is a pointer which points unknown memory location while null pointer is pointer which points a null value or base address of segment.17.what is the output of the programvoidmain(){intx;for(x=1;x