Tuesday, July 7, 2009

C programming TECHNICAL MCQ Exercise -10

Q. 1 . Find the correct output
void main()
{
int i;
for(i=1;i<=3;i++)
 { 
if(i==3) 
break; 
printf("%d",i);
 }
 for(i=1;i<=3;i++) 
if(i==3) 
goto last; 
printf("%d",i);
 } end: ; 
a . 123123 b . 1212 c . Error d . Garbage values 

Q. 2 . Which member of a union is in use at any time can be known explicitly using 
a . Enum 
b . Bit fields 
c . Static members 
d . Can’t be determined 

Q. 3 . The Turbo C implementation of C language supports
 a . High level file I/O
 b . System level file I/O 
c . Both a and b 
d . Executable files only 

Q. 4 . The commonly used functions for writing to a text stream are 
a . putc() 
b . fputc() 
c . fputs() 
d . All of the above 

Q. 5 . A bit field can be of 
a . int 
b . float 
c . double 
d . All of these 

Q. 6 . An assembler which runs on a computer for which it produces object codes is called as 
a . one pass assembler 
b . two pass assembler 
c . self assembler 
d . none of these 


Q. 7 . Find the output 
void main() { 
char a=’H’; 
switch(a) {
 case ‘H’:
printf("%c",’H’); 
case ‘E’:
printf("%c",’E’); 
case ‘L’:
printf("%c",’L’); 
case ‘L’:
printf("%c",’L’); 
case ‘O’: 
printf("%c",’O’); 
} }
 a . HELLO b . HEL c . Error d . HELO 

Q. 8 . Width of a data bus of the microprocessor is known as 
a . Byte Regs 
b . Word Regs 
c . WordLength 
d . None


 Q. 9 . Find the output 
void main() {
 char *p= (char*) 0x21; 
printf ("%d %p", p, p); 
a . 21 0021
 b . 21 21 
c . 33 0021 
d . None of these 


Q. 10 . In a hard disk a track is a collection of 
a . sectors 
b . clusters
c . cylinders 
d . none of these 



Q. 11 . Find the output. 
void main() { 
int a=5; 
a=find(a+=find(a++)); 
printf("%d", a); 
int find(int a) {
 return ++a; 
a . 12 b . 13 c . 15 d . None of these 


Q. 12 . Find the correct output 
void main() 
printf("%d","lakshya"[1]);
 } 
a . l b . a c . 97 d . None of these 

Q. 13 . Find the output. 
union res { int a:16; char b:10; } 
void main() { 
union res s; 
s.b=’B’;
 s.a=10; 
printf("%c %d", s.b, s.a) ; 
}
 a . 2048 10 b . B 2144 c . B 10 d . None of these 

Q. 14 . Find out the output.
 void main() { 
char *s="Rani"; 
printf("%s\r%s",s,s); 
a . Rani 
b . RaniRani 
c . Rani\0 
d . Ranii 

Q. 26 . 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
Q. 27 . Most of the errors blamed on a computer are actually due to
a . programming errors
b . hardware damage
c . data entry errors
d . physical conditions
Q. 28 . Find the correct output
struct abc
{
int x;
char c;
union xyz
{
int a;
char b;
float c;
}p;
}q;
void main()
{
printf("%d",sizeof(q));
}
a . 2
b . 4
c . 7
d . None of these
Q. 29 . Find the output
void main()
{
int *q,**p,x=4;
q=&x;
p=&q;
(**p)++;
++*p;
printf("%d",**p);
}
a . 5
b . 6
c . Garbage output
d . Error, non portable pointer conversion
Q. 30 . Which storage class can precede any data type in the parameter list?
a . Auto
b . Static
c . Register
d . Extern

No comments:

Blog List