Expressions

31

What would be the output of the following program ?

#include<stdio.h>
int main()
{
    static int a[20];
    int i = 0;
    a[i] = i  ;
    printf("%d, %d, %d\n", a[0], a[1], i);
    return 0;
}
A. 1,0,1
B. 1,1,1
C. 0,0,0
D. 0,1,0

32

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

33
Which of the following are unary operators in C?
1.    !
2.    sizeof
3.    ~
4.    &&
A. 1,2
B. 2,3
C. 2,4
D. 1,2,3

34

Are the following two statements same ?


a<=20?b=30:c=30;
(a<=20)?b:c=30;

A. yes
B. no

35

What will be the output of the program ?

#include<stdio.h>
int main()
{
    int x=10,y=20,z=5,i;
    i=x<y<z;
    printf("%d\n",i);
    return 0;
}

A. 1
B. 0
C. Error
D. None of these