Right Place For Right PersonTM |
Sponsored Ads |
|
C Interview Questions And Answers( Objective and Subjective)( NEW ) C Interview Questions And Answers C Objective Interview Questions And Answers(10) C Subjective Interview Questions And Answers(100) C syntax, semantics and simple programming questions(61) C Aptitude Questions(179) Objectives C Aptitude Questions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 C Aptitude Questions Questions 4. main() { static int var = 5; printf("%d ",var--); if(var) main(); } Answer: 5 4 3 2 1 Explanation: When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively. Questions 5. main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } } Answer: 2 2 2 2 2 2 3 4 6 5 Explanation: Initially pointer c is assigned to both p and q. In the first loop, since only q is incremented and not c , the value 2 will be printed 5 times. In second loop p itself is incremented. So the values 2 3 4 6 5 will be printed. Questions 6. main() { extern int i; i=20; printf("%d",i); } Answer: Linker Error : Undefined symbol '_i' Explanation: extern storage class in the following declaration, extern int i; specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with memory space allocated for it. Hence a linker error has occurred . Questions 7. main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); } Answer: 0 0 1 3 1 Explanation :Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR (||) operator. So the expression ‘i++ && j++ && k++’ is executed first. The result of this expression is 0 (-1 && -1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for ‘0 || 0’ combination- for which it gives 0). So the value of m is 1. The values of other variables are also incremented by 1. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Interview Questions And Answers
Struts interview questions and answers (Subjective) 500 Java Objective Questions and Answer Core Java Objective Questions And Answers Core Java Subjective Questions And Answers Core Java Interview Questions And Answers Core Java Interview Questions and Answers (Subjective) Core Java Interview Questions and Answers( Objective) 50 Servlet interview questions 155 Java Interview Questions EJB Interview Questions and Answers(Subjective) R4R,JSP Interview Questions and Answer(Subjective) R4R,Java Servlets Interview Questions and Answers(Subjective) Core Java Subjective ,Objective and Interview Questions And Answers 275 Core java interview questions Java Objective Questions and Answer Java Architect Interview Questions Applet Interview Questions and Answers Core Java example Servlet Objective Questions And Answers Servlet Subjective Questions And Answers Servlet Interview Questions And Answers JSP Objective Questions And Answers JSP Subjective Questions And Answers JSP Interview Questions And Answers | ||
| Comments: Give Your Comments: Advertiser PRIVACY POLICY ||User PRIVACY POLICY || R4R Group Srvices |