0% found this document useful (0 votes)
100 views9 pages

Predict The Output

The document contains 15 coding questions with multiple choice answers. The questions cover topics like data types, operators, arrays, pointers and multidimensional arrays in C programming.

Uploaded by

albinvinu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views9 pages

Predict The Output

The document contains 15 coding questions with multiple choice answers. The questions cover topics like data types, operators, arrays, pointers and multidimensional arrays in C programming.

Uploaded by

albinvinu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

Predict the output

1)main()
{
printf(“%d%d%d%d”,72,072,0x72,0X72);
}

a) Print error message while compilation


b) 72,72,126,123
c) 72 58 114 114
d) None of the above

2) main ()
{
char ch=291;
printf(“%d%d”,32770,ch,);
}
a) –32766,35
b) –32767,45
c) run time error
d) –32766,23

3) main()
{
int x;
X=3+4-7*8/5%10
printf(“x=%d”,X);
}
a) 6
b) run time error since mod produce zero
c) indefinite answer
d) 5

4) main()
{
float a=1.5;
int b=3;
a=b/2+b*8/b-b+a/3;
printf(“a=%f”,a);
}
a) 6.5
b) 7.5
c) 7
d) 5.5

5) main()
{
int a,b;
printf(“Enter values of a and b “);
scanf(“ %d%d “,&a,&b);
printf(“a=%d b=%d”,a,b);
}
a) no output
b) the value of a and b that are inputted
c) run time error
d) compilation error

6) main()
{
printf(“Menu is a list of options you have at a\
particular point in a program. It is just\
like a restaurant menu-everything has a\
misleading name and what you want is never\
available.”);
}

a) Menu is a list of options you have at a\


particular point in a program. It is just\
like a restaurant menu-everything has a\
misleading name and what you want is never\
available.
b) Unterminated string error will be displayed
c) Menu is a list of options you have at a\particular point in a
program. It is just\like a restaurant menu-everything has
a\misleading name and what you want is never\ available.
d) Menu is a list of options you have at a particular point in a
program. It is just like a restaurant menu-everything has a
misleading name and what you want is never available.
7) main()
{
/* This program is used to print the given
/* Integer and float */ */
int a=33000;
float=3.456;
printf(“a=%d b=%f\n”,a,b);
}
a) Compilation error
b) Out of range error
c) No result will be produced
d) Corresponding value for 330000 within the range and 3.456 will
be displayed.

8) main()
{
int I;
for(I=1;I<=9;I++);
printf(“%d”,I);
}
a) compilation error (semicolon not expected)
b) 1,2,3….9
c) 10
d) none of the above(blank screen)

9) main()
{
int a=100,*b,**c,***d;
b=&a;
c=&b;
d=&d;
printf(“%d%d%d%d”, a, *b, **c , ***d);
}
Note: address of a is 4002
address of b is 5006
address of c is 7008
address of d is 7008
a) compilation error (unpredictable value *b **c ***d)
b) 100,4002,5006,7008
c) 100,100,100,100
d) none of the above

10) main()
{
int x=10,y=20;
x=!x;
y=!y;
y=!x&&!y;
a) prì¥Á4G4444¿4444444444444>44
a) 5bjbjŽÙŽÙ555555555555555555 5-655ì³ 5ì³
5>¤555555555555555555555555555555ÿÿ¤555555555ÿÿ¤55555
5555ÿÿ¤55555555555555555
]55555ê5555555ê555ê5555555ê5555555ê5555555ê5555555ê55
5µ55555555555~ 555555~ 555555~ 555555~ 555555~ 55
6ì¥Á6G6 666¿6666666666666>66
7bjbjŽÙŽÙ777777777777777777 7-677ì³ 7ì³
7>¤777777777777777777777777777777ÿÿ¤777777777ÿÿ¤7777777
77ÿÿ¤77777777777777777
]77777ê7777777ê777ê7777777ê7777777ê7777777ê7777777ê777µ
77777777777~ 777777~ 777777~ 777777~ 777777~ 77
8(I=<4)
{
sub[I]=I*I;
printf(“%d\n”,sub[I]);
}
}
}
a) 10,20,40
b) 40
c) no output
d) compilation error

14) main()
{
static int a[]={0,1,2,3,4,};
static int *p[]={a,a+1,a+2,a+3,a+4}
int **ptr;
ptr=p;
**ptr++;
printf(“%d,%d,%d\n”,ptr-p,*ptr-a,**ptr);
*++*ptr;
printf(“%d,%d,%d\n”,ptr-p,*ptr-a,**ptr);
++**ptr;
printf(“%d,%d,%d\n”,ptr-p,*ptr-a,**ptr);
}

a) 1 1 1,1 2 2,1 2 3
b) 1 1 1 ,1 2 3,1 3 3
c) 1 2 2, 1 3 3, 1 3 4
d) compilation error
e) run time error

15) main()
{
static int t[3][2][4]= {
{
2,4,3,6,
1,6,7,9
},
{
8,2,1,1,
2,3,7,3
},
{
1,6,2,4,
0,7,9,5
}
};
printf(“%d%d”,t[2][1][3],*(*(*(t+2)+1)+3));
}

Note: Address of t starts from 204


a) 5 5
a) 5,210
b) 5,232
c) 5,208

You might also like