C Language MCQ’S | Control Instructions 14

66.
Value of c after the following expression (initializations a = 1, b = 2, c = 1): c += (-c) ? a : b;

A. syntax error
B. c = 1
C. c = 2
D. c = 3

 

67. Comment on the following expression? c = (n) ? a : b; can be rewritten as

A. if (!n)c = b; else c = a
B. if (n <= 0)c = b; else c = a;
C. if (n > 0)c = a; else c = b;
D. All of the mentioned

 

68.
What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf(“hello”);
if (x == 5)
printf(“hi”);
else
printf(“no”);
}

A) hi
B) hello
C) no
D) error


 

69. What will be the output of the following C code?

#include <stdio.h>
int x;
void main()
{
if (x)
printf(“hi”);
else
printf(“how are u”);
}

A) hi
B) how are you
C) compile time error
D) error


 

70. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5;
if (true);
printf(“hello”);
}

A) It will display hello
B) It will throw an error
C) Nothing will be displayed
D) Compiler dependent

 

Visitor Counter

0056720