Time remaining
:
:
Test Status
CTEST7
Ques 1 :
What is the output of following program?
void main(){
int a=2;
switch(a);
{
case 1: printf("A");
case 2: printf("B");
case 3: printf("C");
break;
case 4: printf("D");
default: printf("E");
break;
}
}
(A) A B C
(B) A B C E
(C) A B C D E
(D) error
Ques 2 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case 1: printf("A");
case 2: printf("B");
case 3: printf("C");
break;
case 4: printf("D");
default : printf("E");
break;
}
}
(A) B C
(B) B D
(C) B E
(D) error
Ques 3 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case 1: printf("A");
break;
case 2: printf("B");
continue;
case 3: printf("C");
break;
case 4; printf("D");
default: printf("E");
}
}
(A) B E
(B) B C E
(C) B C D E
(D) error
Ques 4 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case4: printf("A");
break;
case3: printf("B");
case2: printf("C");
case1: printf("D");
break;
default: printf("E");
}
}
(A) C
(B) D
(C) C D
(D) E
Ques 5 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case 4: printf("A");
break;
case 3: printf("B");
case default : printf("C");
case 1 : printf("D");
break;
case 5 : printf("E");
}
}
(A) C
(B) C D
(C) E
(D) error
Ques 6 :
What is the output of following program?
void f1(){
extern int g;
static int s=5;
int a;
++g;
a=s++;
printf("%d%d%d",a,s,g);
if(a<=6)
f1();
printf("%d%d%d",a,s,g);
}
void f2(){
static int s;
int a;
a=++s;
++g;
printf("%d%d%d",a,s,g);
if(a<=2)
f2();
printf("%d%d%d",a,s,g);
}
main(){
f1();
f2();
}
(A) 0 5 garbase
(B) 1 6 1
(C) 1 6 2
(D) error
Ques 7 :
What is the output of following program?
void main(){
int a,b,c,d;
a=b=c=d=1;
a=++b>1 || ++c>1 && ++d>1;
printf("%d%d%d",a,b,c,d);
}
(A) 1 1 2 1
(B) 1 2 1 1
(C) 1 2 2 1
(D) 1 2 1 2
Ques 8 :
What is the output of following program?
void main(){
int a;
a=1;
while(a<=10){
printf("%d",a);
if(a>3)
break;
a++;
}
printf("%d",a+10);
}
(A) 1 2 3 4 13
(B) 1 2 3 3 14
(C) 1 2 3 3 13
(D) 1 2 3 4 14
Ques 9 :
What is the output of following program?
void main(){
int a;
a=1;
while(a<=10){
printf("%d",a);
if(a>3 && a<8)
continue;
a++;
}
printf("%d",a+10);
}
(A) 1 2 3 4 5 6 ...................infinite
(B) 1 2 3 4 5 5 ...................infinite
(C) 1 2 3 4 4 4 ...................infinite
(D) 1 2 3 4 4 3 ...................infinite
Ques 10 :
What is the output of following program?
void main(){
int a=100;
printf("%d %u %o %x", a,a,a,a);
}
(A) 100 100 0000144 0x0064
(B) 100 100.00 0000144 0x0064
(C) 100 100 0000144 0x0032
(D) 100 100 0000127 0x0064
Ques 11 :
What is the output of following program?
void main(){
printf("%d%d%d",10<<1, 10>>1, ~10);
printf("%d%d%d",10^20, 10|20, 10&20);
}
(A) 20 5 -11 30 30 1
(B) 20 5 -9 30 30 0
(C) 5 20 -11 30 30 0
(D) 20 5 -11 30 30 0
Ques 12 :
What is the output of following program?
void main(){
int a=1;
a=a<<15;
printf("%d",a);
}
(A) 32767
(B) -32767
(C) 32768
(D) -32768
Ques 13 :
What is the output of following program?
void main(){
int a;
a=453<<16;
printf("%d",a);
}
(A) 0
(B) 1
(C) -1
(D) none of these
Ques 14 :
What is the output of following program?
void main(){
int a;
a=453>>16;
printf("%d",a);
}
(A) 0
(B) 1
(C) -1
(D) none of these
Ques 15 :
What is the output of following program?
void abc(int a){
++a;
printf("%d",a);
}
void main(){
int a=10;
abc(++a);
abc(a++);
printf("%d",a);
}
(A) 11 12 12
(B) 11 12 13
(C) 12 12 12
(D) 12 12 13
Ques 16 :
What is the output of following program?
void main(){
int a;
a=~0;
printf("%d",a);
}
(A) 0
(B) 1
(C) -1
(D) none of these
Ques 17 :
What is the output of following program?
void main(){
printf("%d%d%d",-10^9, -10|9, -10&9);
}
(A) 1 1 0
(B) 1 0 1
(C) -1 0 0
(D) -1 -1 0
Ques 18 :
What is the output of following program?
void main(){
float a;
a=8.5;
if(a==8.5)
printf("1");
else
printf("2");
}
(A) 1
(B) 2
(C) error
(D) none of these
Ques 19 :
What is the output of following program?
void main(){
int i;
i=1;
i=i+2*i++;
printf("%d",i);
}
(A) 3
(B) 4
(C) 5
(D) 6
Ques 20 :
What is the output of following program?
void main(){
int i=10;
printf("%d%d%d",++i, i++, ++i);
}
(A) 11 11 13
(B) 13 11 11
(C) 11 12 13
(D) 13 12 11
Submit Answer
Don't Refresh the Page !! ...