TCS Company Programming Technical

Predict the output of following code:
main()
{
printf(“FACE”+2); ​ // valid skip specified number of
//characters from start
}
1. FACE
2. FA
3. CE
4. Garbage value

Read Solution (Total 10)

TCS Other Question

Which of the following expressions results in 45.37?

(int)(45.378 * 100) / 100
2.5
(int)(45.378 * 100) / 100.0
(int)(45.378 * 100 / 100)
(int)(45.378) * 100 / 100.0
(int)(45.378) * 100f / 100.0
Predict the output of following code:
main()
{
int a=2000;
printf(“%2d”,a); ​ //format specification
}
1.2000
2. 20
3. 4000
4. Garbage value