TCS
Company
Programming
Program
o/p of the program
#include
int main()
{
enum status { pass, fail, atkt};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = atkt;
stud3 = fail;
printf("%d, %d, %dn", stud1, stud2, stud3);
return 0;
}
Read Solution (Total 11)
-
- ans 0,2,1
because the value for pass =0
fail=1
atkt=2 - 10 years agoHelpfull: Yes(27) No(0)
- output 0,2,1 because enumereted datatypes always gives output integers that are 0,1,2,3 this type only
- 10 years agoHelpfull: Yes(6) No(0)
- frnds enum takes values as 0,1,2,3 ,.....
=>pass=0
=>fail=1
=>atkt=2
so on executing the printf statement it displays 0,2,1n - 9 years agoHelpfull: Yes(1) No(0)
- stud1=pass,stud2=atkt,stud3=fail
- 9 years agoHelpfull: Yes(0) No(0)
- stud1 = 0 , stud2 =2 , stud3 = 1
hence , 0,2 ,1 is answer - 9 years agoHelpfull: Yes(0) No(0)
- compile time error
- 9 years agoHelpfull: Yes(0) No(0)
- in this C program we used printf without include "file-name"or thats gives compile error
but when we include its gives 0, 2, 1n as output . - 9 years agoHelpfull: Yes(0) No(0)
- we will get compile time errors.like too many type declarations.
- 7 years agoHelpfull: Yes(0) No(0)
- The output will be 0, 2, 1n if you observe printf function properly
- 6 years agoHelpfull: Yes(0) No(0)
- 1st the question has a mistake , the library function should be written.
then the out will be =0,2,1.
because enum is datatype that assign the values as 0,1,2,3 and so on.
so the the value assigned in pass is 0,fail is 1,atkt is 2.
the their values are copied in stud1,stud2,stud3. - 5 years agoHelpfull: Yes(0) No(0)
- Output- 0,2,1n
- 5 years agoHelpfull: Yes(0) No(0)
TCS Other Question