C MCQ - Standard Input & Output

21.What is the output of the following code?

 
int main() {
int i=1;
i=2+2*i++;
printf("%d",i);
return 0;
}


A. 2
B. 3
C. 4
D. 5

View Answer


22.What is the output of the following code?

 
main ( ) 
{
int i;
i=1;
i=i+2*i++;
printf( "%d" , i);
}

A. 2
B. 3
C. 4
D. 5

View Answer


23. What is the output of this program?

 
main ( ) 
{
int i=2+3, 4>3, 1;
printf( "%d" , i);
}

A. 1
B. 4
C. 3
D. 5

View Answer


24. What is the output of this program?

 
main ( ) 
{
int i=5;
printf( "%d %d %d \n" , i,i<<2,i>>2);
}

A. 5 20 1
B. 5 1 20
C. 5 20 20
D. 5 1 1

View Answer

25. What is the output of this program?

 
main ( ) 
{
int i=5;
printf( "%d %d %d \n" , i,i<<2,i<<2);
}

A. 5 20 1
B. 5 1 20
C. 5 20 20
D. 5 1 1

View Answer

26. What is the output of this program?

 
int main()
{
int i=5;
printf( "%d %d %d \n" , i,i<2,i>2);
return 0;
}

A. Compilation error
B. Garbage value
C. 5 0 1
D. 5 1 0

View Answer


27. What is the output of this program ?

 
int main()
{
int i=5;
printf( "%d %d %d \n" , i,i&&2,i||2);
return 0;
}

A. 5 1 1
B. Compilation error
C. Garbage value
D. 5 0 1

View Answer


28. What is the output of this program ?

 
int main()
{
int i=5;
printf( "%d %d \n" , i,i|2);
return 0;
}

A. 5 7
B. 5 1
C. Garbage value
D. 5 0

View Answer


29. What is the output of this program 32 bit c compiler ?

 
int main()
{
int i=1;
i=i+i*i++;
printf("%d",i);
return 0;
}

A. 3
B. 4
C. 5
D. 6

View Answer


30. What is the output of this program ?

 
int main()
{
int i=-2;
i=i+i*i++;
printf("%d",i);
return 0;
}

A. -2
B. -1
C. 1
D. 2

View Answer







Also check :


Discussion


* You must be logged in to add comment.