Cpaper 1
Cpaper 1
SET-A
Note:-
The program output may depend on the information based on this assumptions (for
example sizeof(int) == 2 may be assumed).
Q2. main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Q3. main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
Q4. main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
Jobseersolution.wordpress.com Page 1
Q5). main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) {
printf(" %d ",*c);
++q; }
for(j=0;j<5;j++){
printf(" %d ",*p);
++p; }
}
Q6). main()
{
extern int i;
i=20;
printf("%d",i);
}
Q7). main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
Q8). main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}
Q9). main()
{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}
Jobseersolution.wordpress.com Page 2
Q10). main()
{
printf("%x",-1<<4);
}
Q11). main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
Q12). main()
{
int c=- -2;
printf("c=%d",c);
}
Q14). main()
{
int i=10;
i=!i>14;
printf("i=%d",i);
}
Q15). #include<stdio.h>
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
Jobseersolution.wordpress.com Page 3
printf("%d",++*p + ++*str1-32);
}
Q16). #include<stdio.h>
main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d----%d",*p,*q);
}
Q17). #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
Q18) #include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Q19). main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
Jobseersolution.wordpress.com Page 4
}
Q20). main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
Q22). main()
{
char *p="hai friends",*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);
}
Q25). main()
{
printf("%p",main);
}
Jobseersolution.wordpress.com Page 5
Q26) main()
{
clrscr();
}
clrscr();
Q29) main()
{
int i=400,j=300;
printf("%d..%d");
}
Q30) main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
Q31) main()
{
int i=1;
while (i<=5)
{
printf("%d",i);
if (i>2)
goto here;
i++;
}
}
fun()
Jobseersolution.wordpress.com Page 6
{
here:
printf("PP");
}
Q32) main()
{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
}
Q35) #include<stdio.h>
main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("GOOD");
break;
case j: printf("BAD");
break;
}
}
Jobseersolution.wordpress.com Page 7
Q36) main()
{
int i;
printf("%d",scanf("%d",&i)); // value 10 is given as input here
}
Q38) main()
{
int i=0;
for(;i++;printf("%d",i)) ;
printf("%d",i);
}
Q39) #include<stdio.h>
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
Q40) #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
}
Jobseersolution.wordpress.com Page 8
Q41) #include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Q42) main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
}
Q43) main()
{
printf("%d", out);
}
int out=100;
Q44) main()
{
extern out;
printf("%d", out);
}
int out=100;
Jobseersolution.wordpress.com Page 9