Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
enum channel {star, sony, zee};
6.
enum symbol {hash, star};
7.
int i = 0;
8.
for (i = star; i
Options:
A .  012
B .  123
C .  compile time error
D .  runtime error
Answer: Option C

enumartion variable 'star' appears two times in main() which causes the error. An enumaration 

constant must be unique within the scope.




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers