TCS Anna University Solved Papers - 4 Questions-Part-3
Below are some solved questions from TCS Anna university Placements.
1) main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
a) I love U
b) I hate U
c) Both a) & b)
Answer: I hate U
2) main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
a) 12345
b) 54321
c) 15243
Answer:5 4 3 2 1
3) 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;
}
}
a) 2 2 2 2 2 4 2 3 5 5
b) 2 2 2 2 2 2 5 4 6 3
c) 2 2 2 2 2 2 3 4 6 5
Answer is 2 2 2 2 2 2 3 4 6 5
4) main()
{
extern int i;
i=20;
printf("%d",i);
}
a) compiler error
b) Linker error
c) Runtime error
Answer is compiler error

