Govt. Exams
Entrance Exams
Advertisement
Topics in C Programming
What is the output?
for (int i = 1; i
for (int i = 1; i
Correct Answer:
A. 1 2
EXPLANATION
When i becomes 3, break is executed, exiting the loop. So only 1 and 2 are printed.
What will be printed?
int x = 0;
if (x = 5)
printf("True");
else
printf("False");
int x = 0;
if (x = 5)
printf("True");
else
printf("False");
Correct Answer:
A. True
EXPLANATION
x = 5 assigns 5 to x and evaluates to 5 (non-zero), which is true. So 'True' is printed.