C Online Exam-Quiz4

C Online Exam-Quiz4

1. The output of the following program is:

#include<stdio.h>

main()

{

int a=0;

while(a>=9)

a++;

printf(“%d”,a);

}

 
 
 
 

2. The output of the following program is:

#include<stdio.h>

int main()

{

int i=(0,2,3);

if(i)

printf(“Hello “);

else

printf(“How Are you?”);

printf(“%d\n”,i);

return 0;

}

 
 
 
 

3. The output of the following program is:

#include<stdio.h>

main()

{

if((-10 && 10) || (20 && -20))

printf(“TRUE”);

else

printf(“FALSE”);

}

 
 
 
 

4. What will be the values of a, b, c after the execution of the followings?

int a=2, b=3, c=0;

c += –a * b++;

 

A) a=3, b=9, c=4 B) a=1, b=3, c=6
C) a=1, b=4, c=6 D) a=1, b=4, c=3
 
 
 
 

5. The output of the following program is:

#include<stdio.h>

main()

{

int a;

a=10,20,30;

printf(“%d”,a);

}

 
 
 
 

6. Which of the following statement is equivalent to

x= a++ * b;

  1. a=a+1;

          x=x*b;

  1. x=a*b;

          a=a+1;

  1. x=a*b;

        x=x+1;

  1. None of These
 
 
 
 

7. The output of the following program is:

#include<stdio.h>

main()

{

switch(‘u’)

{

case ‘a’:

case ‘e’:

case ‘i’:

case ‘o’:

case ‘u’:

printf(“Vowel”);

break;

default:

printf(“Consonant”);

}

}

 
 
 
 

8. The output of the following program is:

#include<stdio.h>

main()

{

int x=5;

if(x>=6);

printf(“Hello”);

}

 
 
 
 

9. The output of the following program is:

#include<stdio.h>

main()

{

int x=2;

if(x=1)

printf(“TRUE”);

else

printf(“FALSE”);

}

 
 
 
 

10. The output of the following program is:

#include<stdio.h>

main()

{

int a=(10,20,30);

printf(“%d”,a);

}

 
 
 
 

11. The output of the following program is:

#include<stdio.h>

main()

{

int x;

x=10==20!=30;

printf(“%d”,x);

}

 
 
 
 

12. What will be the values of a, b, c after the execution of the followings?

int a=20, b=5, c=2;

c /= ++a * –b;

 
 
 
 

13. The output of the following program is:

#include<stdio.h>

main()

{

switch(a)

{

case ‘a’:

case ‘e’:

case ‘i’:

case ‘o’:

case ‘u’:

printf(“Vowel”);

break;

default:

printf(“Consonant”);

}

}

 
 
 
 

14. Which of the following are incorrect statements?

int a=7;

  1. if(a==7) printf(“Correct”);
  2. if(7==a) printf(“Correct”);
  3. if(a=7) printf(“Correct”);
  4. if(7=a) printf(“Correct”);
 
 
 
 

15. The output of the following program is:

#include<stdio.h>

main()

{

int x=-0.5;

if(!x)

printf(“Hello”);

}

 
 
 
 

16. The loop which is executed at least one is

 
 
 
 

17.

19) What is the other statement that can avoid multiple nested if conditions?
A) Functions B) Switch Statements
C) If else statements with ‘break’ D) Loop statements
 
 
 
 

18. Which of the following statement is equivalent to

x= –a * b;

  1. a=a-1;

          x=a*b;

  1. x=a*b;

          a=a-1;

  1. x=a*b;
  2. None of These
 
 
 
 

19. The output of the following program is:

#include<stdio.h>

#define TRUE 1

main()

{

if(TRUE)

printf(“1 “);

printf(“2 “);

else

printf(“3 “);

printf(“4 “);

}

 
 
 
 

20. The output of the following program is:

#include<stdio.h>

main()

{

switch(‘d’)

{

case ‘a’:

case ‘e’:

case ‘i’:

case ‘o’:

case ‘u’:

printf(“Vowel”);

break;

default:

printf(“Consonant”);

}

}

 
 
 
 

21. The output of the following program is:

#include<stdio.h>

main()

{

int x;

x=5>7+3 && 8;

printf(“%d”,x);

}

 
 
 
 

22. #include<stdio.h>

main()

{

int a=10,20,30;

printf(“%d”,a);

}

 
 
 
 

23. Which Statement is correct?

A) Switch case can only be used with ‘int’
B) Switch case can only be used with ‘char’
C) Switch can be used with all data type

D) Switch case can only be used with ‘char’ and ‘int’

 
 
 
 

24. The output of the following program is:

#include<stdio.h>

main()

{

int a=100,b=200,c=300;

if(c>b>a)

printf(“TRUE”);

else

printf(“FALSE”);

}

 
 
 
 

Question 1 of 24

error: Content is protected !!