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