Tuesday, July 7, 2009

C programming TECHNICAL MCQ Exercise -12

Q. 1 . Find out the output
 #include"limits.h" 
void main()
 {
 printf("%d",sizeof(-INT_MIN)); 
a . 0
 b . 2 
c . 32768 
d . 65536

 Q. 2 . Find the correct output
 union yyy
 {
 int i; 
float f;
 }
y; 
void main()
 { 
y.i=23.786;
 printf("%d",y.i); 
a . Error b . Garbage c . 23 d . None of these 

Q. 3 . Find out the output. 
int a=6;
 void main() 
{
 static int *x=&a; 
printf("%d",*x); 
}
 a . 6 b . 0 c . Error, illegal initialization d . None of these

 Q. 4 . Find the output 
void main() 
{
 int x=5;
 if(x=1) printf("one");
 else printf("five"); 
printf("%d",x); 
}
 a . One5 
b . Five5
 c . One1
 d . Five1 

Q. 5 . Find the output.
 void main() {
 char ch; 
if("printf("")") printf("Ok"); 
else printf("Bye");
 }
 a . Ok b . Bye c . 0Ok d . 0Bye 

Q. 6 . Find the correct output 
void main()
 {
 int i=5;
 i=++i + --i - ++i;
 printf("%d",i);
 }
 a . 6 b . 7 c . 5 d . None of these

 Q. 7 . Find the correct output 
void main() {
 int i; 
float f=3.14;
 float compute(float);
 i=compute(f); 
printf("%d",i); 
float compute(float x) 
{
 if(x==3.14)
 return(0);
 else 
return(1);
 } 
a . Suffering b . Garbage c . 0 d . 1 

Q. 8 . Find the correct output

 #define mul(x,y) x*y 
void main() 
{
 int a=5,b=6; 
printf("%d",mul(a+1,b-1)); 
a . 10 b . 30 c . 35 d . None of these

 
Q. 17 . The errors that can be pointed out by the compiler are
a . syntax error
b . semantic error
c . logical error
d . all the above
Q. 18 . Find the o/p
struct date
{
int day,month,year;
}
void main()
{
struct date today={3,7,6,2007};
printf("%d %d %d",today.day,today.month,today.year);
}
a . 3 7 6
b . 7 6 2007
c . Compilation error
d . None of these
Q. 19 . Maximum range of an integer
a . MAX_MAX
b . INT_MAX
c . SIZEOF_INT
d . MAX_INT
Q. 20 . Find the output
void main()
{
int *p,**q,i=5;
p=&i;
q=p;
**q=10;
printf ("%d %d",*p,**q);
}
a . 5 10
b . 10 10
c . 5 5
d . None of these
Q. 21 . Recursion
a . Execution is faster.
b . Additional storage space is not required.
c . A queue is needed to process the recursion.
d . Helps in writing compact code.
Q. 22 . Find out the false statement.
a . The function main() returns an integer by default.
b . A function can be a part of an expression.
c . Size of a function can be measured using sizeof() operator.
d . A stack frame is created in memory for each function call.
Q. 23 . 80x86 Microprocessor wordlength is of
a . 8 bits
b . 16 bits
c . 24 bits
d . 32 bits
Q. 24 . What is the octal equivalent of a decimal number (179)10
a . (263)8
b . (363)8
c . (163)8
d . (463)8
Q. 25 . Find the output.
struct st
{
int roll;
char name[15];
}s{10,"lakshya"};
void main()
{
printf("%d %s", (&s)->roll,(&s)->name);
}
a . 15 lakshya
b . Garbage lakshya
c . Garbage garbage
d . None of these
Q. 26 . If float and double are defined with type register the compiler treats them as
a . Auto variables
b . Static variables
c . Register variables
d . Extern variables
Q. 27 . Find the correct output
void main()
{
struct dist
{
char *c;
int i;
struct dist *d;
};
static struct dist arr[]={{"Raipur",1,arr+1},
{"Kolapur",2,arr+2},
{"Bhabanipur",3,arr}
};
struct dist *dis=arr;
printf("%s",arr[(++dis)->i].c);
}
a . Kolapur
b . Raipur
c . Bhabanipur
d . aipur
Q. 28 . Find out the output
void main()
{
char a[10]="lakshya";
int i=0,j=0;
while(i<=strlen(a))
 {
 i=j++;
 if(a[i]==’a’a[i]==’e’a[i]==’i’a[i]==’o’a[i]==’u’) 
{
 while(ip); 
10. 
a . Line no.8 b . Line no. 9 c . Line no.6 d . None 


No comments:

Blog List