Test PDF
Test PDF
int main()
{
int main = 3;
printf("%d", main);
return 0;
}
Which of the following is true?
(a) It will cause a compile-time error
(c) It will run without any error and prints 3
Answer: c
Q2.
int i=5, j=6,z;
printf("%d", i+++j);
What is the output?
(a) 11
(c) 10
Answer: a
Explanation: Treat it as i++ + j
Q3.
return 0;
}
(a) Compile-Error
(c) x = 20, y = 10
Answer: c
Explanation: Swaps values
Q4.
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
(a) 2, 3, 4
(c) 4, 6, 15
(b) 3, 2, 15
(d) 2, 4, 8
Answer: b
Q5.
int const *p = 5;
printf("%d", ++(*p));
What is the output?
(a) Error (b) 5
(c) 6
(d) 7
Answer: a
Q6.
Q8.
Answer: d
(b) 10000010
(d) 11001000
Answer: a