C Language MCQ - English
Which of the following cannot be checked in a switch-case statement?
Answer : C
View More Related Question
1) What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h>
void main()
{
int ch;
printf("enter a value between 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1: printf("1\n");
default: printf("2\n");
}
}
2) Switch statement accepts.
3) Study the following 'C' program #include<stdio.h>
On the execution of above program, what will be the value of variable a?
void main()
{
int a=7, b=5;
switch (a/a % b)
{
case 1 : a= a-b;
case 2 : a= a+b;
case 3 : a= a*b;
case 4 : a= a/b;
default : a= a;
}
}
4) What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h>
void main()
{
char *ch;
printf("enter a value between 1 to 3:");
scanf("%s", ch);
switch (ch)
{
case "1": printf("1");
break;
case "2": printf("2");
break;
}
}
5) What is the output of this C code(When 2 is entered)?
#include <stdio.h>
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1: printf("1\n");
break;
printf("hi");
default: printf("2\n");
}
}