C MCQ Set-2 : – Multiple Choice Questions in C Set-2

Set-26 C MCQ

1. What is the output of this C code in 64-bit compiler?

void main()
{
int x = 97;
int y = sizeof(x++);
printf(“x =%d and y=%d”, x,y);
}

A. x =97 and y=4
B. x=98 and y=4
C. x=99 and y=4
D. Run time error

Ans:A
C MCQ Set-2 Explaination


2. What is the output of this C code?

#include
int main()
{
unsigned int i = 23;
signed char c = -23;
if (i > c)
printf(“Yes”);
else
printf(“No”);
}

a) Yes
b) No
c) Depends on the compiler
d) Depends on the operating system

Answer:B
C MCQ Set-2 Explaination


  1. What is the output of C Program?

int main() {
if(“abc”) {
printf(“India\n”);
}
if(‘c’) {
printf(“Honey\n”);
}
printf(“ZING”);
return 0;
}

A) Error
B) Honey ZING
C) India ZING
D) India Honey ZING

Answer D
C MCQ Set-2 Explaination


4.What will be the output of following program.

int main()
{
if(!printf(“”))
printf(“Okkk”);
else
printf(“Hiii”);
return 0;
}

A. Okkk
B. Hiii
C. Error
D. None

Answer A
C MCQ Set-2 Explaination


5.What will be the output of following program ?

int main()
{
char val=1;
if(val–==0)
printf(“TRUE”);
else
printf(“FALSE”);
return 0;
}

A. FALSE
B. Error
C. TRUE
D. None

Answer A
C MCQ Set-2 Explaination


  1. What will be the output of following program ?

int main()
{
int a=10;
if(a==10)
{
printf(“Hello…”);
break;
printf(“Ok”);
}
else
{
printf(“Hii”);
}
return 0;
}

A. Hello…
B. Hello…OK
C. OK
D. Error

Answer D
C MCQ Set-2 Explaination


7.What is the output of C Program with Switch Statement?

int main() {
int a=5;
switch(a) {
case 0:
printf(“0 “);
case 3:
printf(“3 “);
case 5:
printf(“5 “);
default:
printf(“RABBIT “);
}
a=10;
switch(a) {
case 0:
printf(“0 “);
case 3:
printf(“3 “);
case 5:
printf(“5 “);
default:
printf(“RABBIT “);
break;
}
return 0;
}

A) 5 RABBIT
B) 0 3 5 RABBIT 0 3 5 RABBIT
C) 0 3 5 RABBIT RABBIT
D) 5 RABBIT RABBIT

Answer D
C MCQ Explaination


8.What is the output of C Program with switch statement?

int main() {
int a=3;
switch(a) {
case 2:
printf(“ZERO “);
break;
case default:
printf(“RABBIT “);
}
}

A) RABBIT
B) ZERO RABBIT
C) No output
D) Compiler error

Answer D
C MCQ Explaination


9.What is the output of C Program with switch statement or block?

int main() {
int a=3;
switch(a)
printf(“Hello”);
printf(“MySwitch”);
}

A) MySwitch
B) No Output
C) HelloMySwitch
D) Compiler Error

Answer A
C MCQ
Set 2 Explaination


  1. What is the output of C Program?

int main()
{
int a;
switch(a)
{
printf(“APACHE “);
}
printf(“HEROHONDA”);
}

A) APACHE HEROHONDA
B) HEROHONDA
C) No Output
D) Compiler error

Answer B
C MCQ Set-2 Explaination


  1. What is the output of C Program with switch statement or block?

int main() {
char code=64;
switch(code) {
case 64:
printf(“SHIP “);
break;
case 8*8:
printf(“BOAT “);
break;
default:
printf(“PETROL”);
}
printf(“CHILLY”);
}

A) SHIP CHILLY
B) BOAT CHILLY
C) BOAT PETROL CHILLY
D) Compiler error

Answer D
C MCQ Set
2 Explaination


C MCQ Set-1
C MCQ Set-2
C MCQ Set-3
C MCQ SET 4

Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *