When 1 is entered, The output of the code below is?
#include
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("1\n");
default:
printf("2\n");
}
}
Answer: C
No answer description available for this question.
Enter details here
Predict the output of the below program:
#include
#define EVEN 0
#define ODD 1
int main()
{
int i = 3;
switch (i & 1)
{
case EVEN: printf("Even");
break;
case ODD: printf("Odd");
break;
default: printf("Default");
}
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the program, if a short int is 2 bytes wide?
#include
int main()
{
short int i = 0;
for(i<=5 && i>=-1; ++i; i>0)
printf("%u,", i);
return 0;
}
Answer: A
No answer description available for this question.
Enter details here
Point out the error, if any in the while loop.
#include
int main()
{
void fun();
int i = 1;
while(i <= 5)
{
printf("%d\n", i);
if(i>2)
goto here;
}
return 0;
}
void fun()
{
here:
printf("It works");
}
Answer: C
No answer description available for this question.
Enter details here
The output of the code below is
#include
void main()
{
int x = 0;
if (x == 0)
printf("hi");
else
printf("how are u");
printf("hello");
}
Answer: D
No answer description available for this question.
Enter details here
The modulus operator cannot be used with a long double.
Answer: A
No answer description available for this question.
Enter details here
The way the break is used to take control out of switch and continue to take control of the beginning of the switch?
Answer: B
No answer description available for this question.
Enter details here
What is the output?
#include
int main()
{
int n;
for (n = 9; n!=0; n--)
printf("n = %d", n--);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
Point out the error, if any in the program.
#include
int main()
{
int P = 10;
switch(P)
{
case 10:
printf("Case 1");
case 20:
printf("Case 2");
break;
case P:
printf("Case 2");
break;
}
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
In _______, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.
Answer: D
No answer description available for this question.
Enter details here