C Online Test 5

C Langauge Practice Programs-MCQs-Objective-Questions

C Online Test 5

C Langauge Practice Programs-MCQs-Objective-Questions1. What is the output of the following code?

void main()
{
int x;
x = 3 > 2 > 1;
printf(“%d” , x);
}


2. What is the output of the following code?

void main()
{
printf(“%X” , -1<<4);
}


3. What is the output of the following code?

void main()
{
int c = – -2;
printf(“c=%d”,c);
}


4. What is the output of the following code?

void main()
{
int i=5;
printf(“%d%d%d%d%d” , i++,i–,++i,–i, i);
}


5. What is the output of the following code?

void main()
{
int i;
printf(“%d” , scanf(“%d”,&i)); // value 10 is given as input here
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


6. What is the output of the following code?

void main()
{
int i=5;
printf(“%d”,++i++);
}


7. What is is the output of the following code?

void main()
{
int i;
i = 10 + 010 + 0x20;
printf(“%d “, i);
}


8. What is the output of the following code?

void main()
{
printf(“%d”,printf(“Hello”));
}


9. What is the output of the following code?

void main()
{
int x,y;
printf(“%d”,scanf(“%d%d”,&x,&y));
}


10. What is the output of the following code?

void main()
{
int x=5,y=7;
printf(“%d\n”,y/x);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


11. Wat is the output of the following code?

void main()
{
printf(“%d”, 5?2?0?8:9:7:3);
}


12. What is the output of the following code.

void main()
{
int i = 10;
i = !i > 14;
printf(“i = %d”,i);
}


13. What is the output of the following code.

void main()
{
int a,b,c;
a=4;
b=7;
c=a==b;
printf(“%i”,c);
}


14. what is the output of the following C program?

void main()
{
int y = 128;
const int x = y;
printf(“%d”,x);
}


15. What is the output of the following code.

void main()
{
int i=12345;
printf(“%2d”,i);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


16. What is the output of the following code.

void main()
{
int x=2,y=6,z=6;
x = y == z;
printf(“%d”,x);
}


17. What is the output of the following program.

void main()
{
int x,j,k;
j=k=6;
x=2;
x=j*k;
printf(“%d”, x);
}


18. What is the output of the following program?

void main()
{
int x;
x = 11 ^ 5;
printf(“%d” , x);
}


19. Which keyword is used to define constants in ‘C’?

a.final b.const c.typedef d.enum

20. What is the output of the following code.

printf (“%d”, 3>2?(4<5?4:5):3);


21. What is the output of the following code.

void main()
{
printf(“%c”, ‘1’ + 1);
}
a. ASCII value of ‘1’ is required to find out the answer

b. 2

c. 50

d. Syntax error


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


22. Which of the following are unary operators in C?

A. !

B. sizeof

C. ~

D. &&

E. =


23. What is the output of the following code?

int main()
{
int x = 4, y, z;
y = –x;
z = x–;
printf(“%d%d%d\n”,x,y,z);
return 0;
}
A. 4 3 3

B. 4 3 2

C. 3 3 2

D. 2 3 3

E. 2 2 3


24. What will be the output of the following program?

void main()
{
int i = 2;
int j = i + (1,2,3,4,5);
printf(“%d\n”, j);
}


25. Which of the following is the correct output for the program given below?

void main()
{
int x = 55;
printf(” %d %d %d “, x>=55, x=40, x>=10);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


26. What is the output of the following code.

void main()
{
int k, num=30;
k = (num>5 ? (num<=10 ? 100 : 200) : 500);
printf(“%d\n”, k);
}
A. 200

B. 30

C. 100

D. 500


27. What is the output of the following code.

void main()
{
int a = 100, b = 200, c;
c = ( a==100 || b > 200);
printf(“c=%d\n”,c);
}


28. What is the output of the following code?

void main()
{
printf(“\n%d,%d,%d,%d”,printf(“\na”),printf(“\nab”),
printf(“\nabc”),printf(“\nabcd”));
}


29. What is the output of the following code?

void main()
{
int a;
a = (1,2,3,4,5);
printf(“\n a = %d”,a);
}


30. What is the output of the following code?

void main()
{
int a;
a = 1,2,3,4,5;
printf(“\n a = %d”,a);
}


31. What is the output of the following code?

void main()
{
int a,x=5;
a = (x++,++x,–x);
printf(“\n a = %d”,a);
printf(“\n x = %d”,x);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert

Share this post