Tuesday, July 7, 2009

C programming TECHNICAL MCQ Exercise -19


MCQ of c programming 21 

Q. 1 . Find the correct output 
#define SWAP(type,i,j) 
{
type t=i;
i=j;
j=t;
void main() 
int s=5,t=2; 
SWAP(int,s,t); 
printf("%d %d",s,t); 
a . 5 2 
b . 2 5 
c . 5 5 
d . None 

Q. 2 . Find the correct output 
#define min(x,y) x=(xb) a=a-b; else b=b-a; 
printf("%d",a);
 } 
a . 3 
b . 6 
c . 18 
d . None of these 

Q. 12 . Unary operators are 
a . Operator dependant 
b . Position dependant 
c . Value dependant 
d . Both b and c.

Q. 13 . what is the o/p in turbo compiler? 
struct stud { 
int x:18; 
char *y; 
float z; 
}s1; 
void main() 
printf("%d",sizeof(s1)); 
a . 7 
b . 1 
c . 8 
d . Error 

Q. 23 . State the true statement.
‘void ‘ is an empty data type associated with
a . all aggregate types
b . all data types
c . all functions and pointers
d . all the above
Q. 24 . The area or scope of the variable depends on its
a . Date type
b . Storage class
c . System type
d . None of these
Q. 25 . Aspect ratio of a monitor is
a . height and width ratio
b . number of pixels per inch
c . diagonal length of monitor
d . none of these
Q. 26 . Find the correct output
#define div(x) x/x
void main()
{
printf("%d",div(16)*16);
}
a . 1
b . 16
c . 256
d . None of these
Q. 27 . Find the output if inout is 5 6?
void main()
{
int x,y;
scanf("%d",&x);
scanf("%c %d",&y);
printf("%d %d",x,y);
}
a . 5 6
b . 5 7
c . 5 garbage
d . garbage garbage

Q. 18 . Find the correct output
void main()
{
int *p,*q="hello";
*p=*q;
printf("%s",p);
}
a . Error, suspicious pointer conversion
b . he
c . hello
d . None of these
Q. 19 . Find out the output.
void main()
{
int i=98;
while(100-i++)
printf("%u",i);
switch(i)
case ‘e’:
printf("Fool");
}
a . 98 99 100
b . 99 100
c . 99 100 Fool
d . Expression syntax error
Q. 20 . Find the output.
#include"stdio.h"
void main()
{
FILE *p;
char ch;
p=fopen("raja.txt","w");
putc(50,p);
putc(80,p);
putc(70,p);
while((ch=getc(p))!=EOF)
putch(ch);
fclose(p);
}
a . 508070
b . 2PF
c . 50PF
d . None of these
Q. 21 . The main advantage of union over structure is
a . Memory mapping
b . Memory utilization
c . Memory optimization
d . Memory leak
Q. 22 . ‘for’ loop can’t be written using do-while loop if
a . Start value is not given
b . Stop value is false
c . Step value is not given
d . Stop value is true
Q. 23 . Which of the following is false regarding bit fields?
a . Bit fields may share a storage unit with other structure members.
b . Bit fields must entirely reside in a storage unit its appropriate type.
c . Bit fields only applicable to unsigned integral but not signed integral.
d . Bit fields are used to construct the protocol header fields.
Q. 24 . Macros like INT_MIN, INT_MAX are defined in which header file.
a . stdio.h
b . limits.h
c . dos.h
d . none of these
Q. 25 . Find the correct output
void main()
{
int i=5;
i=i++ + ++i + i++;
printf("%d",i);
}
a . 18
b . 20
c . 24
d . None of these
Q. 26 . Find the output
void main()
{
printf("%f",9/5);
}
a . 1.0
b . 1.8
c . 2.0
d . None of these
Q. 27 . Find the output.
void main()
{
struct nm;
{
int roll[5];
char name[10];
};
printf("%d",sizeof(nm));
}
a . 20
b . 21
c . 10
d . None of these
Q. 28 . Which of the following is a 8 bit binary coding?
a . BCD
b . ASCII
c . EBCDIC
d . none of these
Q. 29 . Find out the output.
void main()
{
printf("%d",-65535);
}
a . -65535
b . 0
c . 1
d . -1
Q. 30 . Find out the output
void main()
{
int a="%d";
printf("%d",a);
}
a . %d
b . 25637
c . 37
d . %

No comments:

Blog List