0% found this document useful (0 votes)
236 views4 pages

Cquiz 2

The document contains 10 coding questions with multiple choice answers. It tests concepts like conditional statements, operators, data types, enums, switch statements. The questions cover basic C programming constructs and logic.

Uploaded by

sim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views4 pages

Cquiz 2

The document contains 10 coding questions with multiple choice answers. It tests concepts like conditional statements, operators, data types, enums, switch statements. The questions cover basic C programming constructs and logic.

Uploaded by

sim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. What will be the output of following program ?

#include <stdio.h>
void main()
{
!printf("") ? printf(“Sunbeam”) : printf(“Karad”);
}
Answers
1. Sunbeam (ans)
2. karad
3. 1
4. 0

2. What will be the output of following program ?

#include<stdio.h>
enum menu
{ a=2,b,c,d=-1,e};
enum menu m;
int main()
{
printf(“%d %d”,b+a,e+d);
}
Answers
1. 2 3
2. 0 1
3. 5 -1 (ans)
4. Error

. What will be the output of following program ?

#include <stdio.h>
void main()
{
int a=10;
switch(a){
case 5+5:
printf(“Pune\n”);
default:
printf(“Karad\n”);
}
}
Answers
1. Pune (ans)
Karad
2. Pune
3. Karad
4. Compile time erro

. Find the output of the following:


int main()
{
int m=1,n=1;
if(--n && n || n--)
printf("%d",m ^ n);
else
printf("%d",m & n);
}
Answers
1. 0
2. 1 (ans)
3. -1
4. -2

5. What will be the output of following program ?


#include<stdio.h>
int main()
{
char ch;
if((~sizeof(ch) + !sizeof('A')))
printf("Hinjewadi");
else
printf("MarketYard");
return 0;
}
Answers
1. MarketYard
2. Hinjewadi (ans)
3. NO OUTPUT
4. Hinjewadi
MarketYard

6. Find the output of the following:


int main()
{
int x=0,y=0,z=0;
if(x!=3,y=!2,z==1,z)
printf("x=%d y=%d",x,y);
printf("x=%d y=%d z=%d",x,y,z);
}
Answers
1. x=0 y=0 x=1 y=1 z=0
2. x=1 y=0 x=0 y=0 z=0
3. x=0 y=0
4. x=0 y=0 z=0 (ans)

7. #include <stdio.h>

int main()
{
int var;

var=5>7?6:1!=8<9?50:60;

printf("%d", var);

return 0;
}

Answers
1. 6
2. 50
3. 1
4. 60 (ans)

8. What will be the output of following program ?


#include<stdio.h>
enum menu
{ a=2,b=3.56 };
enum menu m;
main()
{
printf(“%d%d”,a,b);
}
Answers
1. 2 3
2. 0 1
3. 2 3.56
4. Compile Time Erorr (ans)

9. What will be the output of following program ?


#include<stdio.h>

int main()
{
char ch = 65;
switch(++ch)
{
case 'A':
printf("Hinjewadi\n");
break;
case 'B':
printf("MarketYard\n");
default:
printf("Karad\n");
break;
}
return 0;
}
Answers
1. MarketYard (ans)
Karad
2. Karad
3. Hinjewadi
4. Compile Time Error

10. What will be the output of the program?

#include<stdio.h>
int main()
{
int i=4;
switch(i)
{
default:
printf("sunbeam\n");
case 1:
printf("E-DAC\n");
break;
case 2:
printf("E-DMC\n");
break;
case 3:
printf("E-DBDA\n");
}
return 0;
}
Answers
1. sunbeam E-DAC (ans)
2. E-DBDA sunbeam
3. E-DAC E-DBDA
4. sunbeam

You might also like