For a 32-bit compiler
1.
A).(int *) func();
B).int (*func)();
C).int func(int *);
Which is declaration for pointer to function?
A).A B).B C).C D).None
2.
void add(int*,int);
main()
{
int i=10,j=10;
add(&i,j);
printf("%d %d",i,j);
}
void add(int *x,int y){
*x=*x+1;
y=y+1;
}
What is the output?
A).10 10 B).11 10 C).10 11 D).11 11
3.
char *pa[5]={"DOG","CAT","FISH"};
printf("%c",*(*(pa+1)+2));
What is the output?
A).O B).A C).T D).S
4.
struct node{
char data;
struct node *next;
}a,b,*p=&a,*q=&b;
Which can't link b after a
A) a.next=q; B) p.next=&b; C)p->next=&b; D). (*p).next=q;
5.
struct student{
int age;
int num;
} std,*p;
P=&std;
Which is incorrect to get the age
A). std.age; B). student.age; C). p->age; D). (*p).age;
6.
enum list1
{ x1.
x2,
x3,
x4=6,
x5,
x6};
x2,x6=?
A). 1,6 B).1,8 C).2,6 D).2,8
7.
union structure{
unsigned short a;
unsigned short b[2];
unsigned short c;
} data;
int d,e;
data.a=2;
data.c=4;
d=data.a;
e=sizeof(data);
d=?
A).1 B).2 C).3 D).4
8. As question 7
e=?
A). 2 B).4 C).6 D).8
9.
void inc();
main()
{
int i,counter=0;
for(i=0;i<5;i++)
inc();
printf("%d",counter);
}
inc()
{
static int counter=0;
counter++;
}
What is the output?
A).0 B).1 C).4 D).5
10.
A) #define func(x) (x)*(x)+(x)*2+4
B) #define DEBUG
C) #define AND &&
Which is not correct MACRO?
A).A B).B C).C D).None
11.
main()
{
int x=3,y=3,i;
i=power(x,y);
}
int power (int x,int y)
{
if(y==1)
return x;
else
return (x * power(x,y-1));
}
i=?
A).9 B).27 C).81 D).54
12.
int m,n;
for(n=1;n<=5;n++){
for(m=0;m<n;m++){
printf("*");
}
printf("\n");
}
What is the output?
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.