This post contains 61-70 questions of c program. It will helpful to solve c aptitude questions, c quiz , c objective type questions etc in interview.
61-70 Questions
Q1:void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); } Answer: Ok here
Q2:
main() { clrscr(); } clrscr(); Answer: No output/error
Q3:
main() { static int var = 5; printf("%d ",var--); if(var) main(); } Answer: 5 4 3 2 1
Q4:
Cpreprocessor a) tales care of conditional compilation b) tales care of macros c) tales care of include files d) acts before compilations Answer:
Q5:
A preprocessor command a) need not start on a new line b) need not start on the first column c) has # as the first character d) comes before the first executable statement Answer:
Q6:
The following program main() { int a=4; change(a); printf("%d",a); } change(int a) { printf("%d",++a); } Answer: a) 5 5 b) 4 5 c) 5 4 d) 4 4
Q7:
The output of the following program is main() { static int x[]={1, 2, 3, 4, 5, 6, 7, 8}; int i; for(i=2;i<6;i++) x[x[i]]=x[i]; for(i=0; i<8;i++) printf("%d",x[i]); } Output: a) 1 2 3 3 5 5 7 8 b) 1 2 3 4 5 6 7 8 c) 8 7 6 5 4 3 2 1 d) 1 2 3 5 4 6 7 8 Answer:
Q8:
The order in which actual parameters are evaluated in a function call a) is from the left b) is from the right c) is compiler dependent d) none of the above Answer:
Q9:
The default parameter passing mechanism is a) call by value b) call by reference c) call by value result d) none Answer:
Q10:
C does no automatic array bound checking. This is a) true b) false c) C's asset d) C's shortcoming Answer: