TCS Company Programming Arrays

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

Read Solution (Total 15)

TCS Other Question

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
Predict the output of following code:
main()
{
int sum;
char ch1='a';
char ch2='b';sum=ch1+ch2; // ascii sum; sum = 97+98 = 195
printf(“%d”,sum);
}

1. Error
2. 195
3. 201
4. “ab”