Question 1 of 25
Hints left: 3
Q1
Which for loop has range of similar indexes of 'i' used in for (i = 0;i < n; i++)?
Q2
What will be the output of the following C code? #include <stdio.h> int main() { do printf("In while loop "); while (0); printf("After loop\n"); }
Q3
What will be the output of the following C code? #include <stdio.h> int main() { short i; for (i = 1; i >= 0; i++) printf("%d\n", i); }
Q4
What will be the output of the following C code? #include <stdio.h> void main() { int i = 0; for (i = 0;i < 5; i++) if (i < 4) { printf("Hello"); break; } }
Q5
What will be the output of the following C code? #include <stdio.h> int main() { printf("%d ", 1); goto l1; printf("%d ", 2); } void foo() { l1: printf("3 ", 3); }
Q6
What will be the output of the following C code? (Assuming that we have entered the value 2 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"); break; printf("hi"); default: printf("2\n"); } }
Q7
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; } }
Q8
What will be the correct syntax for running two variable for loop simultaneously?
Q9
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; char c = 'a'; while (i < 2) { i++; switch (c) { case 'a': printf("%c ", c); break; break; } } printf("after loop\n"); }
Q10
What is an example of iteration in C?
Q11
Which loop is most suitable to first perform the operation and then test the condition?
Q12
What will be the output of the following C code? #include <stdio.h> int main() { float f = 1; switch (f) { case 1.0: printf("yes\n"); break; default: printf("default\n"); } }
Q13
What will be the output of the following C code? #include <stdio.h> void main() { int i = 5, k; if (i == 0) goto label; label: printf("%d", i); printf("Hey"); }
Q14
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; for (foo(); i == 1; i = 2) printf("In for loop\n"); printf("After loop\n"); } int foo() { return 1; }
Q15
What will be the output of the following C code? #include <stdio.h> int main() { while () printf("In while loop "); printf("After loop\n"); }
Q16
What will be the output of the following C code? #include <stdio.h> int main() { int a = 1; if (a--) printf("True"); if (a++) printf("False"); }
Q17
What will be the output of the following C code? #include <stdio.h> void main() { int k = 0; for (k) printf("Hello"); }
Q18
Which datatype can accept the switch statement?
Q19
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; while (i < 2) { l1 : i++; while (j < 3) { printf("Loop\n"); goto l1; } } }
Q20
What will be the output of the following C code? #include <stdio.h> int main() { switch (printf("Do")) { case 1: printf("First\n"); break; case 2: printf("Second\n"); break; default: printf("Default\n"); break; } }
Q21
Which of the following is an invalid if-else statement?
Q22
What will be the output of the following C code? #include <stdio.h> int x; void main() { if (x) printf("hi"); else printf("how are u"); }
Q23
What will be the output of the following C code? #include <stdio.h> void main() { char *str = ""; do { printf("hello"); } while (str); }
Q24
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; while (i < 2) { l1: i++; while (j < 3) { printf("loop\n"); goto l1; } } }
Q25
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; while (l1: i < 2) { i++; while (j < 3) { printf("loop\n"); goto l1; } } }