Tuesday, July 7, 2009

C programming TECHNICAL MCQ Exercise -16

Q. 1 . Find out the output
void main()
{
int x,y;
*(&x)=10;
*(&y)=13;
printf("won%cder%c",y,x);
}
a . der
b . won13der13
c . won1der1
d . won
der
Q. 2 . Find the correct output
void main()
{
struct place
{
char *str;
int i;
struct place *ptr;
};
static struct place a[]={{"Raipur",1,arr+1},
{"Nagpur",2,arr+2},
{"Kanpur",3,arr}
};
struct place *p=a;
int i;
for(i=0;i<=2;i++) 
{
 printf("%d",(2+a[i].i)); 
} } 
a . Error 
b . aipuragpuranpur 
c . ipurgpurnpur 
d . purpurpur 

Q. 3 . Find the correct output 
void main() 
int var,x=1,y=2; 
switch(var) 
case x: 
x++; 
case y: 
y++; 
printf("%d %d",x,y); 
a . 1 3 
b . 2 2 
c . No output 
d . None of these 

Q. 4 . Find the output. 
void main() 
char c[]="lak\\bshya"; 
printf("%s",c); } 
a . lashya 
b . lak\shya 
c . lak\bshya 
d . lakshya 
Q. 5 . File opening is 
a . a action of connecting a program to a file 
b . a action of connecting a program to a buffer 
c . a default action of file processing 
d . None of these 

Q. 6 . Find out the output. 
int funcall(); 
void main() 
int z; 
z=funcall(); 
printf("%d",z); 
int funcall() 
auto int arr[]={15,2,3,4,5,6},x=5; 
return x=arr[0]; 
x=arr[1]; 
printf("%d",x); 
a . 15 
b . 2 
c . Error 
d . Garbage output 
Q. 7 . Find the output 
void main() 
if(printf("Hello")); 
else printf("Hai"); 
a . Hello 
b . Hai 
c . Compilation error 
d . Statement missing 
Q. 8 . The value with in [ ] in an array declaration specifies 
a . Largest permitted subscript value 
b . Size of the array 
c . Both a and b 
d . None of these 

Q. 9 . Find the output. 
void main() 
int x=0xFFFB; 
printf("%d",x); 
a . 5 
b . -5 
c . 65631 
d . 32762 

Q. 10 . Find out the output. 

void main() 
int a=1,b=2,c=3,d=4; 
printf(" %d %d",a,b); 
printf(" %d %d",c,d); 
a . Run time Error 
b . Compile time Error 
c . 1 2 3 4 
d . None of these 

Q. 11 . Find out the true statement. 
a . A union variable can be assigned to another union variable. 
b . The address of union variable can be extracted by using & operator. 
c . A function can return a pointer to the union. 
d . All the above 

Q. 12 . Find the correct output 
void main() 

int x=11,y=5,z=2; 
x%=y*=z; 
printf("%d",x); 
a . 2 
b . 1 
c . 25 
d . 27 

Q. 13 . Find the output 
void main() 
int i=-3,j=2,k=0,m; 
m=++i && j++ && ++k; 
printf("\n%d, %d, %d, %d",i,j,k,m); 
a . -2,-3, 1,1 
b . -3, 2, 0,1 
c . -2, 3, 0,1 
d . -2, 3, 1,1 

Q. 14 . Find out the output 
#include"stdio.h" 
void main() 
int (*p)(const char* , ...);
 p=printf; p("hello","%c",'CB');
 } 
a . helloC 
b . helloCB 
c . hello%c 
d . hello 

Q. 15 . Find the correct output 
void main() 
unsigned i=1; 
signed j=-1; 
if(ij) 
printf("greater"); 
else 
if(i==j) 
printf("equal"); 
a . less 
b . greater 
c . equal 
d . None of these 

Q. 16 . Find the correct 
output 
#define CAL(X) X+1 
void main() 
int a=3; 
int b=4*CAL(a*4); 
printf("%d",b); 
a . Garbage value 
b . 52 
c . 64 
d . 49 

Q. 17 . Self referential structure 
a . Used to create a memory link. 
b . Plays an important role in linked list creation. 
c . Contains the object of same structure which is of pointer type. 
d . All the above 

Q. 18 . Find the correct output 
void main() { 
int *p,i=10; 
void *q; p=&i; 
q=p; 
printf("%d",*q++); 
a . 10 
b . 11 
c . Error 
d . None of these 
Q. 19 . Find the output 
struct xx 
char y; int x; }; 
void main()
 { 
struct xx s={‘a’,15}; 
switch(s) { 
case ‘a’: 
printf("Allowed"); 
break; 
case 15: 
printf("Not allowed");
 break; 
default: 
printf("No"); 
} } 
a . Allowed 
b . Not allowed 
c . No 
d . None of these 

Q. 20 . Find the output. 
void main() 
int i; 
for(i=-9;!i;i++); 
printf("%d",-i);
 } 
a . 8 
b . 9 
c . 0 
d . 1 


Q. 12 . Find the correct output
void main()
{
int i=5,j=3;
printf("%d",show(i,j));
}
show(int a,int b)
{
a=a*5;
b*=b;
return(!a+ --b);
}
a . Error
b . 0
c . 8
d . 2
Q. 13 . Find out the output
#include"limits.h"
void main()
{
int a[INT_MAX];
printf("%d",sizeof(a));
}
a . 32767
b . 63534
c . -2
d . 2
Q. 14 . Find the correct output
void main()
{
int a;
char b;
float c;
printf("%d",sizeof(a+sizeof(b+c));
}
a . 2
b . 1
c . 4
d . Error
Q. 15 . Find out the output
int i;
int increment( int i )
{
i++;
return i;
}
int main()
{
for( i = 0; i < i="increment(" i="%d\n" i="9" i="10" i="11" p="CITE" q="CITE" p="=" a="5,b=" p="&a;" p="10;" a="4,b=">b?c=a:c=b);
}
a . 4
b . 5
c . Error, lvalue required
d . None of these
Q. 22 . Find the output.
void main()
{
int *p, a[5]={1, 2, 3, 4, 5};
p=&a;
printf("%d %d %d",*p,++*p,++*p);
}
a . 1 2 3
b . 3 2 1
c . 3 3 2
d . None of these
Q. 23 . A union can be a member of
a . Structure
b . Array
c . Both a and b
d . None of these
Q. 24 . Find the correct statement
a . int a=10;
int arr[a];
b . int a,b,c;
int *p={&a,&b,&c};
c . static int a,b,c;
int *q={&a,&b};
d . int a=1,b=2,c=3;
int arr[]={a,b,c};
Q. 25 . Find out the output
void main()
{
int a=10;
a=call(a=call(~a));
printf("%d",a);
}
call(int a)
{
return a;
}
a . 10
b . -11
c . 0
d . None of these
Q. 26 . Find the correct output
#define FLOAT(x) 3.##x
void main()
{
printf("%f",FLOAT(14));
}
a . 3.14
b . 3.140000
c . 3.000000
d . None of these
Q. 27 . State the correct statement.
a . Nested union is not possible.
b . Self referential union is possible
c . Different interpretations for the same memory location are possible in structure.
d . Both a and c
Q. 28 . Find out the output
void main()
{
int a=256;
char *p=&a;
*++p=2;
printf("%d",a);
}
a . 512
b . 258
c . Error
d . None of these
Q. 29 . Find the correct output
void main()
{
static int i=i++,j=j++;
printf("%d%d",i,j);
}
a . 11
b . Garbage value
c . Error
d . None of these
Q. 30 . The keywords in ‘r’ family are
a . register, real
b . register, return, repeat
c . register, return
d . none of these

No comments:

Blog List