Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Home
»
C Programming
»
Control Instructions
What will be the output of the program? #include<stdio.h> int main() { int k, num = 30; k = (num < 10)? 100 : 200; printf("%d ", 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 ", 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 "); case 1: printf("This is case 1 "); break; case 2: printf("This is case 2 "); break; case 3: printf("This is case 3 "); } 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 ", 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 ", 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 ":"%s ", 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(" "); return 0; }
What will be the output of the program? #include
int main() { int i=3; switch(i) { case 1: printf("Hello "); case 2: printf("Hi "); case 3: continue; default: printf("Bye "); } return 0; }
What will be the output of the program? #include
int main() { int x=1, y=1; for(; y; printf("%d %d ", x, y)) { y = x++ <= 5; } printf(" "); return 0; }
Point out the error, if any in the for loop. #include
int main() { int i=1; for(;;) { printf("%d ", i++); if(i>10) break; } return 0; }
Discussion & Comments
No comments yet. Be the first to comment!
Posting…
Name
Comment
Post Comment
Join Discussion
Discussion & Comments