Tuesday, July 7, 2009

C programming TECHNICAL MCQ Exercise -18

MCQ of c programming 20


Q. 1 . Arrange the operators ~,= =, &&, *, ^ in the increasing order of precedence.
a . = =, ^ , * , && , ~
b . && , ^ , = = , * ,~
c . * , = = , && , ^ , ~
d . && , = = , ^ , * ,~

Q. 5 . Which one of the following is/are wrong?
int a,b[5],c[3];
I. a=b[2];
II. b[3]=a;
III. b[1]=c[2];
IV. c[0]=b[2
a . only II
b . II & III
c . III & IV
d . only I
Q. 6 . Find the correct output
void main()
{
int a=1,b=2,c=3,d=4;
printf("%d",!a?b?!c:!d:a);
}
a . 1
b . 2
c . 3
d . 4
Q. 7 . Find the correct output
void main()
{
int a=5,b=6,c=2,d;
d=(a++,++b,c++);
printf("%d%d%d",d,a,c);
}
a . 263
b . 252
c . 162
d . 253
Q. 8 . Find the output.
void main()
{
unsigned int i=5;
while(i-->=0)
printf("%d",i);
}
a . 12345
b . lvalue required
c . infinite loop
d . None of these
Q. 9 . Which of the following function is appropriate to read one character at a time?
a . fscanf()
b . fgetc()
c . read()
d . fgets()
Q. 10 . Find the output
static int i=5;
void main()
{
int i=10;
call(i/5);
printf("%d",i);
}
call(int i)
{
return i/2;
}
a . 1
b . 10
c . 5
d . None of these
Q. 11 . Find out the output
void main()
{
char *p;
printf("%d %d ",sizeof(*p+++2),sizeof(p+++4));
}
a . 1 2
b . 2 2
c . Error
d . 1 1
Q. 12 . Find out the output
void main()
{
show(5);
}
show(int x)
{
static int i=1;
while(i++<5) x="65536+1;" p="0X0000;" p="10;" arr2d="=" arr2d ="=" x="55"> are known as
a . Data access operators
b . Structure access operators
c . Member access operators
d . None of these
Q. 26 . Find the output
void main()
{
FILE *p;
printf("%d %d",stderr->fd,_streams[3].fd);
}
a . 2 3
b . 4 4
c . 1 2
d . Error
Q. 27 . Find the output
void main()
{
printf("%d",wow(5));
}
wow(int x)
{
if(x<=0)
 return 1; 
else 
return (wow(x-1)+x); 
a . 15 
b . 16 
c . 11 
d . 12 

Q. 28 . Static global variable have 
a . Internal linkage 
b . External linkage 
c . No linkage 
d . None of these 

Q. 29 . Find out the output 
void main() int c; 
int a=5,b=10; 
c=a+=b-=a; 
printf("%d %d %d",a,b,c); 
a . Compile time error 
b . 5 10 5 
c . 10 5 10 
d . 10 10 5 

Q. 30 . Which of the following is/are true for nested if 
I. It can only test for equality. 
II. Conditions may be repeated for number of times. 
III. It can evaluate relational or logical expressions. 
IV. Character constants are automatically converted to integers. 
a . All of the above 
b . I & II
 c . I, II & III 
d . II, III & IV 

No comments:

Blog List