Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
enum colour {
4.
green, red, blue, white, yellow, pink
5.
};
6.
int main()
7.
{
8.
cout
Options:
A .  012345
B .  123456
C .  compile time error
D .  runtime error
Answer: Option A

The enumerator values start from zero if it is unassigned.
Output:
$ g++ enum3.cpp
$ a.out
012345



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers