Q. 1 . Find out the output
void main()
{
int i,j,a[6],b[3];
j=a[i=0]=1;
printf("%d","lakshya"[(sizeof(a[i],"lakshya"[sizeof b[j]]))]);
}
a . 2
b . 97
c . 117
d . 118
Q. 2 . Find the output.
void main()
{
int x=3;
float y=1;
while(x! =y)
{
x--;
y++;
if(x==y)
printf("%d %d",x,y);
}
a . 2 0
b . 2 suffering
c . 2 2
d . Error
Q. 3 . An I/O stream is
a . a text stream
b . a binary stream
c . Both a and b
d . None of these
Q. 4 . Find the correct output
void main()
{
int i=5;
i=i++ - --i + ++i;
printf("%d",i);
}
a . 5
b . 7
c . 8
d . None of these
Q. 5 . Find the output.
extern int x;
void main()
{
typedef int myint;
myint x;
printf ("%d", x) ;
}
a . 0
b . Garbage
c . Error, multiple declaration for x
d . None of these
Q. 6 . Find the output
void main()
{
int i=1;
for(i;i++<=3;)
{
switch(i) {
case 1:
printf("one");
continue;
case 2:
printf("two");
break;
case 3:
printf("three");
continue;
}
}
}
a . onetwothree
b . twothree
c . Error, misplaced continue
d . No output
Q. 7 . Find the correct output?
void main()
{
int n=2,i;
float s=0.0;
for(i=1;i<=n;i++)
s=s+(float)1/(i*i);
}
a . 1.000000
b . 1
c . 1.500000
d . 1.250000
Q. 8 . Find the o/p
struct date
{ int day,month,year;
}
void main()
{
struct date today={3,7,6,2007};
printf("%d %d %d",today.day,today.month,today.year);
}
a . 3 7 6
b . 7 6 2007
c . Compilation error
d . None of these
Q. 9 . Find out the output
void main()
{
char *p="rama";
char *q=0;
char *r="\bsita";
strcpy(q,p);
strcat(q,r);
printf("%s",q);
}
a . ramsita
b . ramasita
c . rama\sita
d . None of these
Q. 10 . Find out the output
void main()
{
int x=32768;
if(2*x)
printf("HaHa");
else printf("HoHo");
}
a . HaHa
b . HoHo
c . Expression syntax error
d . None of these
Q. 11 . Find the output.
void main()
{
int x=5;
void *p;
p=&x;
printf("%d",*(int *)p);
}
a . 5
b . Garbage
c . Generic pointer can not be dereferenced
d . No output
Q. 12 . Find out the output int x=5;
void modify(int);
void main()
{
printf("%d\t",x);
{
x=10;
modify(x);
printf("%d",x);
}
printf("%d",x);
}
void modify(x)
{
x=15;
x++;
}
a . 5 10 10
b . 5 16 16
c . Expression syntax error
d . None of these
Q. 13 . A set of names can be represented as a
a . Two dimensional array of characters
b . One dimensional array of strings
c . One dimensional array of pointers to character
d . All of the above
Q. 14 . A character constant is
a . 1 byte long
b . 2 bytes long
c . system dependent
d . none of these
Q. 15 . Predict output if value 10 is given as input.
main()
{
int i;
printf("%d",scanf("%d",&i));
}
a . 1
b . 10
c . Garbage
d . None of these
Q. 16 . Find the output.
void main() {
int i=10,*p;
p=&i;
printf ("%d %d",*(p++), (*p)++);
}
a . 11 10
b . 0 10
c . 10 11
d . Garbage garbage
Q. 17 . Find the output
union usa {
unsigned int x[2];
char ch[4];
}canada;
void main()
{
strcpy(canada.ch,"xyz");
printf("%s %d",canada.ch,canada.x[1]);
}
a . Error: Library function not allowed initializing union member.
b . xyz 120
c . xyz 121
d . xyz 122
Q. 20 . Find the output.
static int i;
void main() {
for(;~i;i--)
printf("%d",i);
}
a . 0 -1 -2 -3…….
b . 0
c . 0 -1 0 -1……
d . None of these
Q. 21 . Find the correct output
void main()
{
char a[4]="rama";
char b[]="shyama";
printf("%d %d", sizeof(a),sizeof( b)) ;
}
a . 4 7
b . 5 6
c . 5 7
d . 4 6
Q. 22 . The keywords in ‘r’ family are
a . register, real
b . register, return, repeat
c . register, return
d . none of these
Q. 23 . Find out the output
struct xx {
int xx;
char yy[10];
};
struct yy {
char xx[10];
int yy; };
struct xx *rec;
struct yy rect={"hari",20};
void main() {
rec=(struct xx*)▭
printf("%c %s",rec->xx,rec->yy);
}
a . hari
b . h ri
c . riha
d . r ha
Q. 24 . Find out the output
void main()
{
char *p;
printf("%d %d ",sizeof(*p+++2),sizeof(p+++4));
}
a . 1 2
b . 2 2
c . Error
d . 1 1
Q. 25 . Find the correct output
void main()
{
int i;
float f=3.14;
float compute(float);
i=compute(f);
printf("%d",i);
}
float compute(float x)
{
if(x==3.14)
return(0);
else
return(1);
}
a . Suffering
b . Garbage
c . 0
d . 1
Q. 26 . Find the correct output
void main()
{
int i,j=6;
for(;i=j;j-=2)
printf("%d",j);
}
a . Error
b . Garbage values
c . 642
d . 6420
Q. 27 . Find the output
void main()
{
char a[5]={‘c’,’i’,’t’,’e’, 0};
printf ("%s",a[4]);
}
a . 0
b . Null
c . Error
d . None of these
Q. 28 . Octal numbers are used
a . in computer hardware
b . when binary numbers are too long
c . external to the computer
d . in preference to 'hex' numbers
Q. 29 . 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. 30 . Find the output
void main()
{
int i=4,j=-3;
mul(&i,j);
printf("%d %d",i,j);
}
mul(int *a,int b)
{
a=*a**a;
b=b*b;
}
a . 4 3
b . 4 9
c . 16 -3
d . 16 9
No comments:
Post a Comment