Expressions

11

What will be the output of the program?

#include<stdio.h>
int main()
{
    int k, num=30;
    k = (num>5 ? (num <=10 ? 100 : 200): 500);
    printf("%d\n", num);
    return 0;
}
A. 200
B. 30
C. 100
D. 500

12

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=2;
    printf("%d, %d\n", ++i, ++i);
    return 0;
}
A. 3, 4
B. 4, 3
C. 4, 4
D. Output may vary from compiler to compiler

13

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x=55;
    printf("%d, %d, %d\n", x<=55, x=40, x>=10);
    return 0;
}
A. 1, 40, 1
B. 1, 55, 1
C. 1, 55, 0
D. 1, 1, 1

14

What will be the output of the program?

#include<stdio.h>
int main()
{
    int a=100, b=200, c;
    c = (a == 100 || b > 200);
    printf("c=%d\n", c);
    return 0;
}
A. c=100
B. c=200
C. c=1
D. c=300

15

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=3;
    i = i++;
    printf("%d\n", i);
    return 0;
}
A. 3
B. 4
C. 5
D. 6