# Citicorp Placement Paper

AMCAT

Paper: Citicorp Placement Paper (Technical-C) Placement Process

C questions

1. main()
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d",x,y);
}

ans: 10 ,16

2. 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);
}

ans:First output: 12Second Output : 1Third Output : 1

3. main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d",x,y);
}

ans:56 93

4. main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s",p2);
}

ans: an empty string

5. main()
{
int x=5;
printf("%d %d %d",x,x<<2,x>>2);
}

ans:5 20 1

6. #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;
}

ans:10 5 10 5

7. main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s",ptr);
ptr++;
printf("%s",ptr);
}

ans:Samco Systems amco system

8. #include
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}

Ans Compilation error giving it cannot be an modifible 'lvalue'

9. #include
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}

Ans : RamcoSystems

10.enum day = { jan = 1 ,feb=4, april, may}
what is the value of may?
a)4

b)5
c)6
d)11
e)none of the above

ans=6

11.main
{
int x,j,k;
j=k=6;

x=1;
x=j*k;
printf("%d", x);
}

ans:36

15. int x=5;
y= x&y
( MULTIPLE CHOICE QS)
ans : c

16. Y=10;
if( Y++>9 && Y++!=10 && Y++>10)
printf("........ Y);
else printf("".... )
ans : 13

17. f=(x>y)?x:y
a) f points to max of x and y8. f=(x>y)?x:y
a) f points to max of x and y
b) f points to min of x and y
c)error
d) ........

ans : a

18.. if x is even, then

(x%2)=0
x &1 !=1
x! ( some stuff is there)

a)only two are correct
b) three are correct
c), d) ....
c), d) ....
ans : all are correct

19. which of the function operator cannot be over loaded

a) <=

b)?:
c)==
d)*

ans: b and d

20)# define TRUE 0
some code
while(TRUE){
some code
}
Ans NONE OF THE ABOVE i.e D,This won't go into the loop as TRUE is defined as 0

17).main(){
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d ",x,y);
}
Ans : 11 16

18).main(){
int a=0;
if(a=0) printf("Ramco Systems ");
printf("Ramco Systems ");
}
Ans : Ony one time "Ramco Systems" will be printed.