Question 1 of 25
Hints left: 3
Q1
How many times i value is checked in the following C code? #include <stdio.h> int main() { int i = 0; while (i < 3) i++; printf("In while loop\n"); }
Q2
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; l1: while (i < 2) { i++; while (j < 3) { printf("loop\n"); goto l1; } } }
Q3
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; while (i < 2) { if (i == 1) break; i++; if (i == 1) continue; printf("In while loop\n"); } printf("After loop\n"); }
Q4
What will be the output of the following C code? #include <stdio.h> void main() { int k; for (k = -3; k < -5; k++) printf("Hello"); }
Q5
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; l1: while (i < 2) { i++; while (j < 3) { printf("loop\n"); goto l1; } } }
Q6
What will be the output of the following C code? #include <stdio.h> int main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); }
Q7
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; do { i++; printf("In while loop\n"); } while (i < 3); }
Q8
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch, ch + 1) { case 1: printf("1\n"); break; case 2: printf("2"); break; } }
Q9
How many times i value is checked in the following C code? #include <stdio.h> int main() { int i = 0; do { i++; printf("in while loop\n"); } while (i < 3); }
Q10
What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 1) if (x >= 0) printf("true\n"); else printf("false\n"); }
Q11
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { char *ch; printf("enter a value between 1 to 3:"); scanf("%s", ch); switch (ch) { case "1": printf("1"); break; case "2": printf("2"); break; } }
Q12
What will be the output of the following C code? #include <stdio.h> void main() { int i = 0, k; label: printf("%d", i); if (i == 0) goto label; }
Q13
What will be the output of the following C code? #include <stdio.h> void main() { int i = 0; do { printf("Hello"); } while (i != 0); }
Q14
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; do { i++; if (i == 2) continue; printf("In while loop "); } while (i < 2); printf("%d\n", i); }
Q15
What will be the output of the following C code? #include <stdio.h> int main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); }
Q16
What will be the output of the following C code? #include <stdio.h> int main() { int x = 97; switch (x) { case 'a': printf("yes "); break; case 97: printf("no\n"); break; } }
Q17
What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 1) if (x == 0) printf("inside if\n"); else printf("inside else if\n"); else printf("inside else\n"); }
Q18
What will be the output of the following C code? #include <stdio.h> void main() { double k = 0; for (k = 0.0; k < 3.0; k++) printf("Hello"); }
Q19
What will be the output of the following C code? #include <stdio.h> int main() { int *p = NULL; for (foo(); p; p = 0) printf("In for loop\n"); printf("After loop\n"); }
Q20
What will be the output of the following C code? #include <stdio.h> int main() { if (printf("%d", printf("))) printf("We are Happy"); else if (printf("1")) printf("We are Sad"); }
Q21
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch) { case 1: printf("1\n"); default: printf("2\n"); } }
Q22
What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 0) printf("true, "); else if (x = 10) printf("false, "); printf("%d\n", x); }
Q23
The keyword 'break' cannot be simply used within . . . . . . . .
Q24
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { double ch; printf("enter a value between 1 to 2:"); scanf("%lf", &ch); switch (ch) { case 1: printf("1"); break; case 2: printf("2"); break; } }
Q25
What will be the output of the following C code? #include <stdio.h> int main() { int x = 1; if (x > 0) printf("inside if\n"); else if (x > 0) printf("inside elseif\n"); }