MCQ PRACTICE QUESTION

1.what will be the final value of x in the following C code?

#include<stdio.h>

void main()

{

  int x = 5*9/3+9;

}

1.       3.75

2.       3

3.       24

4.       Depends on compiler

2.what will the output of the following C code?

#include<stdio.h>

void main()

{

  int y = 3;

  int x = 5%2*3/2;

  printf(“value of x %d”, x);

}

1.       Compile time error

2.       Value of x 1

3.       Value of x 3

4.       Value of x 2

3.what will be the output of the following C code?

#include<stdio.h>

void main()

{

  int y= -3;

  int x = y%2;

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

}  

1.       1

2.       Implemention defined

3.       -1

4.       Compile time error

4.what will be the output of the following C code?

#include<stdio.h>

void main()

{

  int x = 5.3%2;

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

}  

1.       Compile time error

2.       1

3.       2.3

4.       0.3

5.what will be the output of the following C code?

#include<stdio.h>

int main()

{

  int x = -5;

  x= x/3;

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

1.       -3

2.       Compile time error

3.       -1

4.       Implementation defined