TECHNICAL TEST-2
NAME:_____________________Branch________
Roll
Number____________
1.
void main()
{
int i =0;
for( ; i<=2; )
printf(“%d”,++i);
}
a.0 1 2 b.0 1 2 3
c.1 2 3 d. 1 2
2.
void main()
{
int x=6,y=3;
x/=x/y;
printf(“%d”,x);
}
a.6 b.2
c.3 d.0
3.void
main()
{
int a,b;
a=1,3,5;
b=(2,4,6);
printf(“\n%d”,a+b);
}
a.3 b.7 c.21 d. 17
4.void main()
{
int a=25;
clrscr();
printf(“%o %x”,a,a);
}
a. 25 25 b.025 0x25
b. 12 42 d.31 19
5.void main(){
int a=5,b=10,c=1;
if(a&&b>c){
printf("RISE");
}
else{
break;
}}
a.RISE b)it will print
nothing
c)Compilation
error d)none
6.
void main(){
int a=100;
if(a>10)
printf("CIVIL");
else if(a>20)
printf("EEE");
else if(a>30)
printf("CSE");
}
a.CIVIL b.EEE
c.CIVIL EEE
CSE d.CSE
7.
void main(){
int m=5,n=10,q=20;
if(q/n*m)
printf("William
Gates");
else
printf(" Warren Buffet");
printf(" Carlos
Slim Helu");
}
a.William Gates c.Runtime error
b.Warren Buffet
Carlos Slim Helu d.Compilation error
e.None
of the above
8.void main(){
int a=10;
if(printf("%d",a>=10)-10)
for(;;)
break;
else;
}
Choose all that apply:
a. It will print nothing b.0 c.1
D.Compilation error:
misplaced else
9.int main()
{
int i=5, j=-2, k=-3, m;
m = i++ || ++j && ++k;
printf("%d, %d, %d, %d\n", i, j,
k, m);
return 0;
}
A. 5, -2, -3, 0 B. 6,
-1, -2, 0
C.6, -1, -2, 1 D. 6,
- 2, -3, 1
10.int
int
|
||||||||
|
11.void main()
{
Int i=0;
For(i=0;i<20;i++)
{
switch(i){
default:
i+=4;break;
case 0: i+=5;
case 1: i+=2;
case 5:i+=5;}
printf(“%d”,i);
}}
a.12 17
22 b.0 5
9 13 17 c.16
21 d.5 9
13 17
12. void main()
{
int i=2;
for(i=0;i++;printf(“%d”,i));
printf(“%d”,i);
}
a.2 b.1 c.0 d.3
13. void main()
{
int k=5^8;
printf(“%d”,k);
}
a.11 b.12 c.13 d.14
14.void main()
{
printf(“abcde\rABC”);
}
a.abcde b.ABC c.ABCde d.abcdeABC
15.void main()
{
int i=20;
do{
printf(“%d”,++i);
}while(5,4,3,2,1,0);
}
a. 20 b.21 c.21
22 d.21 22 23 24 25
16.void main()
{
float a=6.60,b=3.30;
printf(“%f”,a%b);
}
a. 0 b. 2 c.
error d. none
17.void main()
{
int i=9;
int
a=5+8*6/3-2+i-- + --i;
printf(“%d”,i);
}
a.9 b.35 c.7 d.36
18. void main()
{
printf(“%d,%g,%g”,5/2,5.5/2,(float)5/2);
}
a. 2 2.75 2.5 b.2 2.75 2 c. 2
2.75 2 d.error
19.which of the
following statement is wrong
1. 5+5=a; 2.ss=12.25;
3.st=’m’*’b’; 4.is=’a’+10;
a. 3,4 b.1,3,4 c.1 d.3
20.
# define N >90
# define M >80
Void main()
{
int x=10,p;
p=x*5N;
p=p+90M;
printf(“%d”,p);
}
a.
0 b.90 c.80 d.1
21. Write a Program for floyd’s
triangle
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Ans:
1 | c |
2 | c |
3 | b |
4 | d |
5 | c |
6 | a |
7 | e |
8 | a |
9 | d |
10 | d |
11 | a |
12 | b |
13 | c |
14 | c |
15 | b |
16 | c |
17 | c |
18 | a |
19 | c |
20 | d |
No comments:
Post a Comment