(A) Run-Time Error (B) Compile-Time Error (C) 1 2 3 4 (D) None of These

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

int

main(
){int a=1,
b=2,c=3,d=4;printf("%d %d",
a,b);printf(
" %d %d",c,d);
return(0);
}
(a)Run-Time Error
(b)Compile-Time Error
(c)1 2 3 4
(d)None of these

[Q002] What will be the output of the following program :


int main()
{
int a=1,b=2,c=3;
c=(--a,b++)-c;
printf("%d %d %d",a,b,c);
return(0);
}
(a)0 3 -3
(b)Compile-Time Error
(c)0 3 -1
(d)0 3 0

[Q003] What will be the output of the following program :


int main()
{
int a=1,b=2,c=3,d=4,e;
e=(a,a)+(b,c)+(c,d)-(d,b);
printf("%d",e);
return(0);
}
(a)Compile-Time Error
(b)10
(c)6
(d)2

[Q004] What will be the output of the following program :


int main()
{
float val=2.;
printf("%.2",val);
return(0);
}
(a)Compile-Time error
(b)2.00
(c)%.2
(d)2.000000

[Q005] What will be the output of the following program :


int main()
{
int a=5;
int b=6;;
int c=a+b;;;
printf("%d",c);;;;
return(0);
}
(a)Compile-Time Error
(b)Run-Time Error
(c)11
(d)None of these

[Q006] What will be the output of the following program :


int main()
{
int i,j;
for (i=1; i<=3; i++)
for (j=1; j<3; j++)
{
if (i == j)
continue;
if ((j % 3) > 1)
break;
printf("%d",i);
}
return(0);
}

[Q007] What will be the output of the following program :


#define swap(a,b) temp=a; a=b; b=temp;
int main()
{
static int a=5,b=6,temp;
if (a > b)
swap(a,b);
printf("a=%d b=%d",a,b);
return(0);
}
(a)a=5 b=6
(b)a=6 b=5
(c)a=6 b=0
(d)None of these

[Q008] What will be the output of the following program :


int main()
{
unsigned int val=5;
printf("%u %u",val,val-11);
return(0);
}
(a)Compile-Time error
(b)5 -6
(c)5 65530
(d)None of these

[Q009] What will be the output of the following program :


int main()
{
int x=4,y=3,z=2;
*&z*=*&x**&y;
printf("%d",z);
return(0);
}
(a)Compile-Time error
(b)Run-Time Error
(c)24
(d)Unpredictable

[Q010] What will be the output of the following program :


int main()
{
int i=5,j=5;
i=i++*i++*i++*i++;
printf("i=%d ",i);
j=++j*++j*++j*++j;
printf("j=%d",j);
return(0);
}
(a)Compile-Time Error
(b)i=1680 j=1680
(c)i=629 j=6561
(d)i=1681 j=3024

[Q011] What will be the output of the following program :


int main()
{
int i=5;
printf("%d %d %d %d %d",++i,i++,i++,i++,++i);
return(0);
}
(a)Compile-Time Error
(b)10 9 8 7 6
(c)9 8 7 6 6
(d)10 8 7 6 6

[Q012] What will be the output of the following program :


int main()
{
unsigned ch='Y';
printf("%d",sizeof ch);
return(0);
}
(a)Compile-Time Error
(b)2
(c)4
(d)1

[Q013] What will be the output of the following program :


int main()
{
int a=5;
printf("%d");
return(0);
}
(a)Compile-Time Error
(b)5
(c)Unpredictable
(d)No Output

[Q014] What will be the output of the following program :


int main()
{
int a=5,b=6;
printf("%d");
return(0);
}
(a)Compile-Time Error
(b)5
(c)6
(d)Unpredictable

[Q015] What will be the output of the following program :


int main()
{
int a=5,b=6,c=7;
printf("%d %d %d");
return(0);
}
(a)Compile-Time Error
(b)5 6 7
(c)7 6 5
(d)Unpredictable

[Q016] What will be the output of the following program :


#define Swap if (a != b) { \
temp=a; \
a = b; \
b = temp; \ //Swapping Done
}
int main()
{
int a=10,b=5,temp;
Swap;
printf("a=%d a=%d",a,b);
return(0);
}
(a)Compile-Time Error
(b)a=5 b=10
(c)a=10 b=5
(d)None of these

[Q017] What will be the output of the following program :


int main()
{
int val=50;
void *ptr;
ptr=&val;
printf("%d %d",val,*(int *)ptr);
return(0);
}
(a)Compile-Time Error
(b)50 50
(c)50 0
(d)None of these

[Q018] What will be the output of the following program :


int main()
{
int a=5,b=6;
Printf("%d %d %d",a,b,--a*++b);
return(0);
}
(a)Compile-Time Error
(b)5 6 30
(c)4 7 28
(d)None of these

[Q019] What will be the output of the following program :


int main()
{
int val=5;
void *ptr;
*(int *)ptr=5;
val=ptr;
printf("%d %d",*(int *)val,*(int *)ptr);
return(0);
}
(a)Compile-Time Error
(b)Unpredictable
(c)5 5
(d)None of these

[Q020] What will be the output of the following program :


int main()
{
int val=2;
val = - --val- val--- --val;
printf("%d",val);
return(0);
}
(a)Compile-Time Error
(b)3
(c)-1
(d)0

[Q021] What will be the output of the following program :


int main()
{
int i,n=10;
for (i=1; i<n--; i+=2)
printf("%d\n",n-i);
return(0);
}
(a)84
(b)840
(c)852
(d)864

You might also like