void main()
{
int i=1, j=2;
switch(i)
{
case 1: printf("GOOD"); break;
case j: printf("BAD"); break;
}
}Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
70
Questions
2/4
Page
Pick an option on a question to see the right answer and solution.
void main()
{
int i=1, j=2;
switch(i)
{
case 1: printf("GOOD"); break;
case j: printf("BAD"); break;
}
}Select an option to see the answer and solution.
void main()
{
int i;
printf("%d", scanf("%d", &i)); // value 10 is given as input here
}Select an option to see the answer and solution.
void main()
{
int i=0;
for(;i++;printf("%d", i));
printf("%d", i);
}Select an option to see the answer and solution.
void main()
{
struct xx
{
int x=3;
char name[] = "hello";
};
struct xx *s = malloc(sizeof(struct xx));
printf("%d", s->x);
printf("%s", s->name);
}Select an option to see the answer and solution.
void main()
{
extern int i;
i=20;
printf("%d", sizeof(i));
}Select an option to see the answer and solution.
void main()
{
int i=0, j=0;
if(i && j++)
printf("%d..%d", i++, j);
printf("%d..%d", i, j);
}Select an option to see the answer and solution.
void main()
{
static int i=5;
if(--i){
main();
printf("%d ", i);
}
}Select an option to see the answer and solution.
void main()
{
int i=-1, j=-1, k=0, l=2, m;
m = i++ && j++ && k++ || l++;
printf("%d %d %d %d %d", i, j, k, l, m);
}Select an option to see the answer and solution.
void main()
{
int i = -1;
+i;
printf("i = %d, +i = %d", i, +i);
}Select an option to see the answer and solution.
void main()
{
char *str1 = "abcd";
char str2[] = "abcd";
printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd"));
}Select an option to see the answer and solution.
void main()
{
char not;
not = !2;
printf("%d", not);
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
register i=5;
char j[]= "hello";
printf("%s %d", j, i);
}Select an option to see the answer and solution.
void main()
{
int i=5, j=6, z;
printf("%d", i+++j);
}Select an option to see the answer and solution.
void main()
{
int i = abc(10);
printf("%d", --i);
}
int abc(int i)
{
return(i++);
}Select an option to see the answer and solution.
void main()
{
char a[]="12345";
int i = strlen(a);
printf("%d", ++i);
}Select an option to see the answer and solution.
void main()
{
int i;
char a[]="�";
if(printf("%sn", a))
printf("Ok here n");
else
printf("Forget itn");
}Select an option to see the answer and solution.
void main()
{
int i=i++, j=j++, k=k++;
printf("%d %d %d", i, j, k);
}Select an option to see the answer and solution.
void main()
{
static int i=i++, j=j++, k=k++;
printf("%d %d %d", i, j, k);
}Select an option to see the answer and solution.
#define prod(a,b) a*b
void main()
{
int x=3, y=4;
printf("%d", prod(x+2, y-1));
}Select an option to see the answer and solution.
void main()
{
char p[]="%dn";
p[1] = 'c';
printf(p, 65);
}Select an option to see the answer and solution.