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)
-
- compiler through b,c,d not defined error
- 6 years agoHelpfull: Yes(9) No(0)
- we should not use "," between two %d.it give error
- 6 years agoHelpfull: Yes(4) No(6)
- Error because b,c,d are never declared.
It is ok to use ', ' between two %d. Output will be comma separated. - 6 years agoHelpfull: Yes(3) No(0)
- YOU CANT USE "," IN BETWEEN "%d".
- 6 years agoHelpfull: Yes(2) No(3)
- answer is error i.e un defined b,c,d
- 6 years agoHelpfull: Yes(1) No(1)
- The variables are undeclared so
The result is error - 6 years agoHelpfull: Yes(1) No(0)
- Option 2 because a b c d =10
- 6 years agoHelpfull: Yes(1) No(3)
- error because
- 4 years agoHelpfull: Yes(1) No(0)
- It throughs error
- 4 years agoHelpfull: Yes(1) No(0)
- 10,10,10,10
- 4 years agoHelpfull: Yes(1) No(0)
- ANS:error
REASON:
b,c,d are not declared - 6 years agoHelpfull: Yes(0) No(0)
- 1
b,c,d, are undeclared - 6 years agoHelpfull: Yes(0) No(0)
- Error
Since b,c,d are undeclared variablex - 6 years agoHelpfull: Yes(0) No(1)
- Error
b,c,d are not declare here - 6 years agoHelpfull: Yes(0) No(0)
- error, because only variable a is declared.
- 6 years agoHelpfull: Yes(0) No(0)
TCS Other Question