The output of the code below is
#include
void main()
{
double ch;
printf("enter a value btw 1 to 2:");
scanf("%lf", &ch);
switch (ch)
{
case 1:
printf("1");
break;
case 2:
printf("2");
break;
}
}
Answer: A
No answer description available for this question.
Enter details here
Which of the following is an invalid if-else statement?
Answer: A
No answer description available for this question.
Enter details here
What will be the output of the program?
#include
int main()
{
unsigned int i = 65536; /* Assume 2 byte integer*/
while(i != 0)
printf("%d",++i);
printf("\n");
return 0;
}
Answer: D
No answer description available for this question.
Enter details here
If scanf() is used to store a value in a char variable then along with the value a carriage return(\r) also gets stored it.
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the program?
#include
int main()
{
int x=1, y=1;
for(; y; printf("%d %d\n", x, y))
{
y = x++ <= 5;
}
printf("\n");
return 0;
}
Answer: A
No answer description available for this question.
Enter details here
do-while loop terminates when conditional expression returns?
Answer: B
No answer description available for this question.
Enter details here
#include
int main()
{
int i;
if (printf("0"))
i = 3;
else
i = 5;
printf("%d", i);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
What will be the output of the program?
#include
int main()
{
int a = 300, b, c;
if(a >= 400)
b = 300;
c = 200;
printf("%d, %d, %d\n", a, b, c);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
What will be the output of the program?
#include
int main()
{
int i=3;
switch(i)
{
case 1:
printf("Hello\n");
case 2:
printf("Hi\n");
case 3:
continue;
default:
printf("Bye\n");
}
return 0;
}
Answer: A
No answer description available for this question.
Enter details here
Point out the error, if any in the program.
#include
int main()
{
int i = 1;
switch(i)
{
printf("This is c program.");
case 1:
printf("Case1");
break;
case 2:
printf("Case2");
break;
}
return 0;
}
Answer: C
No answer description available for this question.
Enter details here