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() { int k, num = 30; k = (num < 10)? 100 : 200; printf("%d\n", num); return 0; }
200
30
100
500
Correct Answer:
30
← Previous Question
Next Question→
More Questions from
Control Instructions
What will be the output of the program? #include
int main() { int a=0, b=1, c=3; *((a)? &b : &a) = a? b : c; printf("%d, %d, %d\n", a, b, c); return 0; }
What will be the output of the program? #include
int main() { int x = 3; float y = 3.0; if(x == y) printf("x and y are equal"); else printf("x and y are not equal"); return 0; }
What will be the output of the program? #include
int main() { int i=4; switch(i) { default: printf("This is default\n"); case 1: printf("This is case 1\n"); break; case 2: printf("This is case 2\n"); break; case 3: printf("This is case 3\n"); } return 0; }
What will be the output of the program? #include
int main() { int a = 500, b = 100, c; if(!a >= 400) b = 300; c = 200; printf("b = %d c = %d\n", b, c); return 0; }
What will be the output of the program? #include
int main() { int a = 300, b, c; if(a >= 400) b = 300; c = 200; printf("%d, %d, %d\n", a, b, c); return 0; }
What will be the output of the program? #include
int main() { char str[]="C-program"; int a = 5; printf(a >10?"Ps\n":"%s\n", str); return 0; }
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; }
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; }
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments