Citicorp Placement Papers - C Language
Citicorp Placement Papers - C Language
Q. Find the output of the following code
main()
{
Int x=10,y=15;
x=x++;
y=++y;
printf(ā%d %dā, x, y);
}
Q. Find the output of the following code
int x;
main()
{
int x=0;
{
int x=10;
x++;
change_value(x);
x++;
Modify_value();
printf("First output: %d ",x);
}
x++;
change_value(x);
printf("Second Output : %d ",x);
Modify_value();
printf("Third Output : %d ",x);
}
Modify_value()
{
return (x+=10);
}
change_value()
{
return(x+=1);
}
Q. Find the output of the following code
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d ",x,y);
}
Q. Find the output of the following code
main()
{
char *p1="Data";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s ",p2);
}
Q. Find the output of the following code
main()
{
int x=6;
printf("%d %d %d ",x,x<<2,x>>2);
}
Q. Find the output of the following code
#include<stdio.h>
main()
{
char s1[]="International";
char s2[]="School";
s1=s2;
printf("%s",s1);
}
Q. Find the output of the following code
#include<stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Power");
strcpy(p2,"Systems and Designs");
strcat(p1,p2);
printf("%s",p1);
}
Q. What error does the following code shows?
void main()
{
int const * p=10;
printf("%d",++(*p));
}
Q. Find the output of the following code
main()
{
char s[ ]="India";
int i;
for(i=0;s[ i ];i++)
printf(" %c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Q. Find the output of the following code
main()
{
float x = 1.1;
double y = 1.1;
if(x==y)
printf("I love to read");
else
printf("I hate books");
}
Q. What error does the following code shows?
main()
{
extern int i;
i=10;
printf("%d",i);
}
Q. Find the output of the following code
main()
{
int a=-1,b=-1,c=0,d=2,e;
e=a++&&b++&&c++||d++;
printf("%d %d %d %d %d",a,b,c,d,e);
}
Q. Find the output of the following code
main()
{
int a=3;
switch(a)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}
Q. What error does the following code shows?
main()
{
char string[]="Welcome";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
Q. Find the output of the following code
main()
{
int i=- -5;
printf("c=%d",i);
}
Q. Find the output of the following code
main()
{
int x=5,y=10;
x=x++;
y=++y;
printf("%d %d",x,y);
}
Q. Find the output of the following code
main()
{
char *ptr = ?Energy Limited?;
(*ptr)++;
printf(?%s?,ptr);
ptr++;
printf(?%s?,ptr);
}
Q. Find the output of the following code
#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main()
{
int x=5,y=10;
swap1(x,y);
printf("%d %d",x,y);
swap2(x,y);
printf("%d %d",x,y);
}
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
Q. Explain while loop with a C language program.