1. TEST 2
Q. 1 MCQ
1 . Which is the symbol for AND operator:
a. || b. && c. $$ d. None of these
2. printf(“0 && 1 = %dn”, 0 && 1); Out of this line is:
a. 0 && 1 = 0 b. 0 && 1 = 1 c. 0 && 1 = 2 d. 0 && 1 = 3
3. int x=10;
printf("%d",x++); Output is:
a. 10 b. 11 c. 12 d. None of these
4. ++ is ________ operator:
a. decrement b. Increment c. Add d. Plus-Plus
5 . When x=7, y=x++ what value x & y are holding?
a) x=7,y=7 b) x=7,y=6 c) x=6,y=7 d) x=8,y=7
6. When x=15, y=2 z=x%y what value z is holding?
a) z=0 b) z=1 c) z=7 d) none of the above
7. When a=12,b=11 c=a>=b what value c is holding?
a) c=0 b) c=1 c) c=-1 d) none of the above
8. When a=12, b=13 c=(a==b), what value c is holding?
a) c=1 b) c=0 c) c=-1 d) none of the above
9. When a=15 b=34 then consider , c=a>b, what value c is holding?
a) c=1 b) c=0 c) c=-1 d) none of the above
Q. 2 Guess ouput of following programs
1. #include<stdio.h>
main()
{
int num1=10,num2=20,num3;
num3 = num1 > 2 + num2!=3;
printf("%d",num3);
}
a. 20 b. 1 c. 0 d. 10
2. 2. #include<stdio.h>
void main()
{
int num=10;
if(num)
printf("If Executed");
else
printf("Else Executed");
}
a. If Executed b. Else Executed
c. Compile error : if must have condition d. Run-time error
3. #include<stdio.h>
main()
{
if(1 || 0)
printf("Dennis Ritchie is Father of C Programming");
else
printf("Why to learn C ?");
}
a. Why to learn C? b. Compile Error
c. Dennis Ritchie is Father of C Programming
4. main( )
{
int i=4, z=12;
if(i=5 || z>50)
printf(“hello”);
else
printf(“hye”);
}
5. Evaluate the below given program also write output.
main()
{
int k, num=30;
k=(num>5 ? (num<=10 ? 100 : 200 ) : 500);
printf(“n %d”,num);
getch();
}