Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Control Instructions
What will be the output of the program? #include
int main() { char j=1; while(j < 5) { printf("%d, ", j); j = j+1; } printf("\n"); return 0; }
1 2 3 ... 127
1 2 3 ... 255
1 2 3 ... 127 128 0 1 2 3 ... infinite times
1, 2, 3, 4
Correct Answer:
1, 2, 3, 4
← Previous Question
Next Question→
More Questions from
Control Instructions
What will be the output of the program? #include
int main() { int i=3; switch(i) { case 1: printf("Hello\n"); case 2: printf("Hi\n"); case 3: continue; default: printf("Bye\n"); } return 0; }
What will be the output of the program? #include
int main() { int x=1, y=1; for(; y; printf("%d %d\n", x, y)) { y = x++ <= 5; } printf("\n"); return 0; }
Point out the error, if any in the for loop. #include
int main() { int i=1; for(;;) { printf("%d\n", i++); if(i>10) break; } return 0; }
Point out the error, if any in the program. #include
int main() { int P = 10; switch(P) { case 10: printf("Case 1"); case 20: printf("Case 2"); break; case P: printf("Case 2"); break; } return 0; }
Point out the error, if any in the while loop. #include
int main() { int i=1; while() { printf("%d\n", i++); if(i>10) break; } return 0; }
Point out the error, if any in the program. #include
int main() { int i = 1; switch(i) { printf("This is c program."); case 1: printf("Case1"); break; case 2: printf("Case2"); break; } return 0; }
Point out the error, if any in the while loop. #include
int main() { void fun(); int i = 1; while(i <= 5) { printf("%d\n", i); if(i>2) goto here; } return 0; } void fun() { here: printf("It works"); }
Which of the following errors would be reported by the compiler on compiling the program given below? #include
int main() { int a = 5; switch(a) { case 1: printf("First"); case 2: printf("Second"); case 3 + 2: printf("Third"); case 5: printf("Final"); break; } return 0; }
Point out the error, if any in the program. #include
int main() { int a = 10, b; a >=5? b=100: b=200; printf("%d\n", b); return 0; }
Point out the error, if any in the program. #include
int main() { int i = 1; switch(i) { case 1: printf("Case1"); break; case 1*2+4: printf("Case2"); break; } return 0; }
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments