TCS Company Programming Output

Guess the output:
main()
{printf(“%d”,​ sizeof('a'));
}
//same as → sizeof(97)
1. 2 or 4
2. 1 or 3
3. Garbage value
4. ASCII value of a

Read Solution (Total 4)

TCS Other Question

Predict the output of following code:
main()
{
int a=2;
switch(a)
{
case 1: printf(“one”);
case 2: printf(“Two”);
// Executable code ; No break statement
case 3: printf(“Three”);
default:printf(“Invalid option”);
}
}

1. onetwothree
2. Invalid option
3. one two
4. None of these
Predict the output of following code:
main()
{
int a=b=c=d=10;
//​ error: ‘b’ , ‘c’, ‘d’ undeclared
printf(“%d,%d,%d,%d”,a,b,c,d);
}
1. Error
2. 10,10,10,10
3. GV,GV,GV,10
4. GV,GV,GV,GV