Q. 1 . Find the output void main()
{
int x=5, *p, q;
p=&x; q=p;
printf ("%d", ++*q);
}
a . 5
b . 6
c . Error, invalid indirection
d . None of these
Q. 2 . B language was developed by
a . Dennis Ritchie in 1972
b . Martin Richards in 1967
c . Geoffrey brown in 1968
d . Ken Thompson in 1970
Q. 3 . Find the output
#define float int
void main() {
int x=10;
float y=3;
y=x%y;
printf("%f",y);
}
a . 0
b . 1
c . 1.000000
d . Error, floating point format not linked
Q. 4 . 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. 5 . The PID of the kernel process is
a . 0
b . 1
c . undefined
d . 2
Q. 6 . Which operator is used both as an operator and a keyword?
a . Conditional operator
b . Cast operator
c . Sizeof operator
d . None of these
Q. 7 . Find the correct output
void main()
{
int x=0;
printf(x+"YUinlakshya%d",x=1);
}
a . 1
b . YUinlakshya1
c . Uinlakshya1
d . Uinlakshya1
Q. 8 . Find the correct output
#define int char
void main()
{
int a=65;
printf("%d",sizeof(a));
}
a . 1
b . 2
c . Garbage value
d . None of these
Q. 9 . Choose the appropriate one. A variable is called as
a . Lvalue
b . Modifiable lvalue
c . Rvalue
d . Modifiable rvalue
Q. 10 . Find the output
void main()
{
char x=’A’;
switch(x)
{
if(x==A)
{
printf("tomtom");
}
else
{
printf("tom");
default:printf("harry");
} } }
a . tomtom b . harry c . tomharry d . Error
Q. 11 . Find out the output
int j=10;
void main()
{
int j=5;
static int i;
i=j;
printf("%d",i);
}
a . 5
b . 10
c . Error, illegal initialization
d . None of these
Q. 12 . Find out the output
void fun(char**);
main()
{
char * argv[] = { "ab" ,"cd" , "ef" ,"gh", "ij" ,"kl" };
fun( argv );
}
void fun( char **p )
{
char* t;
t= (p+= sizeof(int))[-1];
printf( "%s" , t);
}
a . ab b . cd c . ef d . gh
Q. 13 . Find the correct output
void main()
{
char *p="abc123",*q="abc";
while(*p++=*q++)
printf("%c%c",*p,*q);
}
a . aabbcc
b . bbcc112233
c . bbcc1
d . aabbcc123
Q. 14 . Find the correct output
void main()
{
char s[]="Lakshya";
printf("%c",*&*s);
}
a . Error
b . Garbage value
c . No output
d . L
Q. 15 . Find out the output
void main()
{
int a= 0;
int b = 20;
char x =1;
char y =10;
if(x,b--,x--,x++)
printf("%d",x);
}
a . 0
b . 1
c . 2
d . None of the above
Q. 16 . Find the correct output
void main()
{
int a=9;
char c;
c=2*20.5+a;
printf("%c",c);
}
a . a b . b c . 9 d . Error
Q. 17 . Find the output
void main()
{
int x=65536,y;
y=sizeof(++x);
printf("%d %d",x,y);
}
a . 0 2
b . 1 2
c . 65536 2
d . None of these
Q. 18 . Find out the output
void main()
{
static char *s[ ] = {"black", "white", "yellow", "violet"};
char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
p = ptr; **++p;
printf("%s",*--*++p + 3);
}
a . ck b . te c . violet d . Error
Q. 19 . A bit field is
a . A pointer variable in a structure
b . One bit or a set of adjacent bits within a word.
c . A pointer variable in a union.
d . None of these
Q. 20 . Find out the output
void main()
{
int x=10;
x=callme(x);
printf("%d",x);
}
callme(int x)
{
int i=5;
x=x/2-3;
return x,i;
}
a . 3
b . 5
c . Can’t return more than one value
d . Function should have a return type
Q. 21 . 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. 22 . Find the output
union res { char a:6; int b:8; }
void main()
{
union res s;
printf("%d",sizeof(s));
}
a . 14
b . 8
c . 1
d . 2
Q. 23 . The function call
fseek(ptr,0,0),is same as
a . ptr=rewind(ptr)
b . ptr=fopen()
c . ftell(ptr)
d . None of these
Q. 24 . Find out the output
#define CUBE(x) (x*x*x)
main() {
int a=3;
char *b;
b=&a;
a=CUBE(*b++);
printf("\n %d %d",a,b);
}
a . 64 4
b . 27 4
c . 27 6
d . None of these
Q. 25 . Find the correct output
void main()
{
int i=5;
i=i++ + ++i + i++;
printf("%d",i);
}
a . 18
b . 20
c . 24
d . None of these
Q. 26 . Find out the output
int main(void)
{
int x=256;
if (*(char *)&x == 255)
{
printf("Little Endian\n");
}
else {
printf("Big Endian\n");
}
return 0;
}
a . Big Endian
b . Little Endian
c . Error
d . None of these
Q. 27 . Find out the output.
struct xyz
{
int xyz ;
}
xyz;
union xyz
{
int xyz;
}xyz;
void main()
{
printf("%d ",xyz.xyz);
}
a . 1
b . 0
c . compile time error
d . None of these
Q. 28 . Find out the output
void main()
{
char s[]="Lakshya";
printf("%c %c",*(&s),*(&s[0]));
}
a . L L
b . Prints character present at whole address of s, then L
c . La
d . Error, lvalue required
Q. 29 . Which of the following is a valid hexadecimal integer constant?
a . -0xa
b . 0x5.2
c . 0xIF
d . all of the above
Q. 30 . The function call
fseek(ptr,0,0),is same as
a . ptr=rewind(ptr)
b . ptr=fopen()
c . ftell(ptr)
d . None of these
No comments:
Post a Comment