Question 1
#include <stdio.h>
int main()
{
int i = 1024;
for (; i; i >>= 1)
printf(\"GeeksQuiz\");
return 0;
}
Question 2
#include <stdio.h>
#define PRINT(i, limit) do \\
{ \\
if (i++ < limit) \\
{ \\
printf(\"GeeksQuiz\\n\"); \\
continue; \\
} \\
}while(0);
int main()
{
int i = 0;
PRINT(i, 3);
return 0;
}
How many times GeeksQuiz is printed in the above program ?
Question 3
What is the output of the below program?
#include <stdio.h>
int main() {
int i = 2;
switch (i) {
case 0:
printf("Geeks");
break;
case 1:
printf("Quiz");
break;
default:
printf("GeeksQuiz");
}
return 0;
}
Question 4
#include <stdio.h>
int main() {
int i = 3;
switch (i) {
case 1:
printf("Geeks");
break;
case 1+2:
printf("Quiz");
break;
default:
printf("GeeksQuiz");
}
return 0;
}
What is the output of the above program?
Question 5
Predict the output of the below program:
#include <stdio.h>
#define EVEN 0
#define ODD 1
int main() {
int i = 3;
switch (i % 2) {
case EVEN:
printf("Even");
break;
case ODD:
printf("Odd");
break;
default:
printf("Default");
}
return 0;
}
Question 6
#include <stdio.h>
int main() {
int i;
if (printf("0"))
i = 3;
else
i = 5;
printf("%d", i);
return 0;
}
Predict the output of above program?
Question 7
#include <stdio.h>
int i;
int main() {
if (i) {
// Do nothing
} else {
printf("Else");
}
return 0;
}
What is correct about the above program?
Question 8
#include<stdio.h>
int main()
{
int n;
for (n = 9; n!=0; n--)
printf(\"n = %d\", n--);
return 0;
}
Question 9
#include <stdio.h>
int main()
{
int c = 5, no = 10;
do {
no /= c;
} while(c--);
printf (\"%d\\n\", no);
return 0;
}
Question 10
# include <stdio.h>
int main()
{
int i = 0;
for (i=0; i<20; i++)
{
switch(i)
{
case 0:
i += 5;
case 1:
i += 2;
case 5:
i += 5;
default:
i += 4;
break;
}
printf(\"%d \", i);
}
return 0;
}
There are 45 questions to complete.