1. #include “stdio.h” int main() { int arr[5]; // Assume that base address of arr is 2000 and size of integer // is 32 bit arr++; printf(“%u”, arr); return 0; } (a) 2002 (b) 2004 (c) 2020 (d) lvalue required
Recursion in C
1. #include “stdio.h” int fun(int n) { if (n == 4) return n; else return 2*fun(n+1); } int main() { printf(“%d “, fun(2)); return 0; } (a) 4 (b) 8 (c) 16 (d) Runtime Error 2. Consider the following recursive
functions in C
1. #include “stdio.h” int main() { int i = 5; printf(“%d %d %d”, i++, i++, i++); return 0; } (a) 7 6 5 (b) 5 6 7 (c) 7 7 7 (d) Compiler Dependent 2. #include “stdio.h” int main() {
Loops in C
1. #include “stdio.h” int main() { int i; for (i = 9; i!=0; i–) printf(“i = %d”, i–); return 0; } (a) 9 7 5 3 1 (b) 9 8 7 6 5 4 3 2 1 (c) Infinite Loop
Decision Control in C
1. Find output of the following program #include “stdio.h” int main() { int i; if (printf(“0”)) i = 4; else i = 6; printf(“%d”, i); return 0; } (a) 4 (b) 6 (c) 04 (d) 06 2. Find output of
Operators in C
1. Find output of the following program #include “stdio.h” int main() { int x, y = 5, z = 5; x = y == z; printf(“%d”, x); getchar(); return 0; } (a) Compiler Error (b) 0 (c) 1 (d) 8