TECHNICAL
TEST2 by RVS
-----------------------------------------------------------------------------------------------------
1.#include<stdio.h>
int main(){
int i,j;
i=j=(2,3),0;
while(--i&&j++)
printf(" %d %d",i,j);
return 0;
}
a)1 3 b)none c)13
02 d)24 25
2.
int main()
{
int i=1,n;
clrscr();
for(i=0,n=0;i<=5;n+=i++);
printf("%d",n,n=9);
}
a)25 b)21 c)9 d)15
3.int
main()
{
char c=’a’;
do
printf("%d ",c);
while(c--);
return 0;
}
a)
finate loop prints 65,64,63….0
b)infinite
loop c)compilation error d) finite loop prints 65,66,67……
4.
#include<stdio.h>
int main()
{
int i=10;
int
no[2][4]={1,0,2};
printf("%d",sizeof(no));
}
a)6 b)8 c)2 d)16
6.
main(){
char*str=”I love java”;
str=str+3;
printf(“%s”,str);
}
a.i love java b)error c)ove java
d)ve java
7.
void main()
{
char *s="\123\n";
printf("%d",sizeof(s));
}
a)4 b)2 c)6
d)error
8.
main()
{
char *str="ECETT";
clrscr();
printf("%s %s
%c ",str+1,str,*str++);
}
a)ETT
CETT E b)ECE TT T c)error
d)CET CETT C
9.
main()
{
char a[]="%d\n";
clrscr();
a[1]='c';
printf(a,68);
getch();
}
a)error b)D
c)c d)D with new line
10.
main()
{
printf(“%d”,10?0?5:1:12)
}
a)
1 b)12 c)12 d)0
11.
void main()
{
int
a=3;
clrscr();
if(a==1);
a=2<<1;
printf("%d",a,a=~a);
}
a. 4
b.
nothing
c.
-5
d.
1
12. main(){
char*s={”I love java”};
printf(“%c”,s[0]);
}
a)error b)i love java c)I
d)null
13.
#include<stdio.h>
main()
{
char not=!EOF;
clrscr();
printf("\n%d %d",EOF,not);
}
a.
0 0 b.error c.-1 0 d.-1 1
14.
# include <stdio.h>
main()
{
char not='\0';
int
i;
i=not==NULL;
clrscr();
printf("%d",i);
}
a.48 b.compile time error
c.0 d.1
15.What
will be output of following c code?
#include<stdio.h>
int main(){
int i=3,j=2;
clrscr();
while(i--?--j:j++)
printf("%d",j);
return 0;
}
a.-1 b)0 1 c)0 d)1
16
(5 marks)
Print
the following using loops
54321012345
No comments:
Post a Comment