LakshyaEducation.in

VEDIC MATHS Video Series
  • Home
  • Video Series
    • Vedic Maths Videos
    • Quantitative Aptitude Videos
    • Class 8 Maths Videos
    • Class 9 Maths Videos
    • Class 10 Maths Videos
  • Quiz & Solutions
  • Blog
  • Store
  • Login
  • Contact Us
  • Home
  • Topic
  • C++ Programming
  • Enumerations

C++ Programming

ENUMERATIONS MCQs

Total Questions : 10

Question 1.


What is output of the this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int i;
6.
enum month {
7.
JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
8.
};
9.
for (i = MAR; i
  1.    01234567891011
  2.    123456789101112
  3.    34567891011
  4.    123456789
 Discuss Question
Answer is Option C. -> 34567891011

we are getting the values from march to november and printing its concern number.

Question 2.


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
  1.    012345
  2.    123456
  3.    compile time error
  4.    runtime error
 Discuss Question
Answer is Option A. -> 012345

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

Question 3.


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
  1.    012
  2.    123
  3.    compile time error
  4.    runtime error
 Discuss Question
Answer is Option C. -> compile time error

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

constant must be unique within the scope.

Question 4.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
enum test {
4.
A = 32, B, C
5.
};
6.
int main()
7.
{
8.
cout
  1.    323334
  2.    323232
  3.    323130
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> 323334

If we not assigned any value to enum variable means, then the next number to initialized number will 

be allocated to the variable.
Output:
$ g++ enum2.cpp
$ a.out
323334

Question 5.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
enum cat {
4.
temp = 7
5.
};
6.
int main()
7.
{
8.
int age = 14;
9.
age /= temp;
10.
cout
  1.    If you were cat, you would be 5
  2.    If you were cat, you would be 2
  3.    If you were cat, you would be 7
  4.    none of the mentioned
 Discuss Question
Answer is Option B. -> If you were cat, you would be 2

The age will be divided by using compound assignment operator and so it will return the age of the 

cat according to your age.
$ g++ enum1.cpp
$ a.out
If you were cat, you would be 2

Question 6.

Which variable does equals in size with enum variable?


  1.    int variable
  2.    float variable
  3.    string variable
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> int variable

The enum variable are converted to integer and stored by compiler. So both are equal in size.

Question 7.

What will happen when defining the enumerated type?


  1.    it will not allocate memory
  2.    it will allocate memory
  3.    it will not allocate memory to its variables
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> it will not allocate memory

Enumerator will allocate the memory when its variables are defined.

Question 8.

To which of these enumerators can be assigned?


  1.    integer
  2.    negative
  3.    enumerator
  4.    all of the mentioned
 Discuss Question
Answer is Option D. -> all of the mentioned

Since enumerators evaluate to integers, and integers can be assigned to enumerators, enumerators

 can be assigned to other enumerators.

Question 9.

In which type does the enumerators are stored by the compiler?


  1.    string
  2.    integer
  3.    float
  4.    none of the mentioned
 Discuss Question
Answer is Option B. -> integer

None.

Question 10.

Identify the incorrect option.


  1.    enumerators are constants
  2.    enumerators are user defined types
  3.    enumerators are same as macros
  4.    enumerator values start from 0 by default
 Discuss Question
Answer is Option C. -> enumerators are same as macros

enumerators are used in order to create our own types whereas macros are textual substitutions.

  • Share on Facebook!
  • Share on Pinterest!

Sub Topics

  • Abstract Classes
  • Access Control
  • Argument Passing
  • Arrays
  • Booleans
  • C++ Concepts
  • Catching Exceptions
  • Character Types
  • Class Hierarchies And Abstract Classes
  • Class Hierarchies Introduction
  • Classes
  • Comments And Indentation
  • Complex Number Type
  • Constants
  • Constructors And Destructors
  • Container Design
  • Conversion Operators
  • Declaration
  • Default Arguments
  • Dereferencing
  • Derivation And Templates
  • Derived Classes
  • Design Of Class Hierarchies
  • Enumerations
  • Error Handling
  • Error Handling Alternatives
  • Essential Operators
  • Exception Specifications
  • Exceptions
  • Exceptions And Efficiency
  • Exceptions That Are Not Errors
  • Floating Point Types
  • Free Store
  • Friends
  • Function Call
  • Function Declarations
  • Function Templates
  • Functions
  • Grouping Of Exceptions
  • Header Files Usage
  • Increment And Decrement
  • Integer Types
  • Large Objects
  • Linkage
  • Macros
  • Modularization And Interfaces
  • Multiple Inheritance
  • Namespaces
  • Objects
  • Objects And Classes
  • Oops Concepts
  • Operator Functions
  • Operators
  • Overloaded Function Names
  • Pointer To Function
  • Pointer To Void
  • Pointers
  • Pointers Into Arrays
  • Pointers To Members
  • References
  • Resource Management
  • Run Time Type Information
  • Sequence Adapters
  • Sequences
  • Simple String Template
  • Sizes
  • Specialization
  • Standard Exceptions
  • Standard Library Design
  • Statements
  • String Class
  • Structures
  • Subscripting
  • Template Arguments To Specify Policy Usage
  • Types
  • Uncaught Exceptions
  • Unspecified Number Of Arguments
  • User Defined Types
  • Value Return
  • Vector
  • Void

Topics

  • Computer Aptitude
  • SAIL Junior Officer (E-0)
  • 10th Grade
  • 11th Grade
  • 12th Grade
  • 4th Grade
  • 5th Grade
  • 6th Grade
  • 7th Grade
  • 8th Grade
  • 9th Grade
  • NCERT
  • Cat
  • Commerce
  • Computer Science
  • Engineering
  • English
  • General Knowledge
  • Ias
  • Management
  • Quantitative Aptitude
  • Reasoning Aptitude
  • General Studies (Finance And Economics)
  • Analytical Instrumentation
  • Biochemistry
  • Bioinformatics
  • Biology
  • Biotechnology
  • Bitsat
  • Business Statistics
  • C Programming
  • C++ Programming
  • Cell Biology
  • Chemistry
  • Cost Accounting
  • Drug And Pharmaceutical Biotechnology
  • Electrical Measurement And Instrumentation
  • Environment Management
  • Environmental Biotechnology
  • Enzyme Technology
  • Financial Management And Financial Markets
  • Gate
  • General Science
  • Geography
  • Heat Transfer
  • History And National Movements
  • Human Anatomy And Physiology
  • Human And Cultural Diversity
  • Human Resource Management
  • Indian Economy
  • Indian Geography
  • Indian History
  • Indian Polity
  • Instrumentation Transducers
  • International Relations
  • Life Sciences
  • Marketing And Marketing Management
  • Mass Transfer
  • Mechanics Of Materials
  • Microbiology
  • Neet
  • Professional Communication
  • Renewable Energy
  • Sociology
  • Surveying
  • Total Quality Management
  • Uidai Aadhaar Supervisor Certification
  • Virology

Recent Questions

Q.   DIVA:OPERA

Q.   All Computers Must Have __________

Q.   Which Of The Following Statements Are Correct With Regard To....

Q.   (solve As Per The Direction Given Above)

Q.   Deficiency Of 'Thiamine' Causes

Q.   In Each Question Below A Sentence Broken Into Four Or Five P....

Q.   IRS 1A And 1B Satellites Can Carry Which Of The Following Se....

Q.   ....

Q.   For A Dc Machine Shunt Resistance And Armature Resistance Va....

Q.   ....

Q.   Who Among The Following Was The First English Man To Visit W....

Q.   Find The Correctly Spelt Word

Q.   The Color Of Fluorine Is

Q.   Rashi Went  toy Shopping With Her Mother And Saw A Toy ....

Q.   The Process Partially Responsible For The Life On Earth Is

Q.   What Is The Place Of The Indian Men's Cricket Team In The La....

Q.   ....

Q.   Match The Following: 1. Nishka (i) Later Vedic Coi....

Q.   Which Fertiliser Is Made (using Coke Oven Gas) In By Product....

Q.   ....

LakshyaEducation.in
Lakshya Education
Bhilai,Chattisgarh,India
Email: admin@lakshyaeducation.in Phone: 07893519977 (WhatsApp)

Quick Links

  • Vedic Maths
  • Quantitative Aptitude
  • Class – IX Maths
  • Class – X Maths
  • YouTube Channel
  • Maths Fast Trick
  • Blog

Our Services

  • About us
  • Privacy
  • TOS
  • Refund / Cancellation
  • Contact
  • Affiliate Program
  • Copyright © 2022 All Right Reserved | Lakshya Education     ( )
    Login / Register

    Your Account will be created automatically when you click the below Google or Facebook Login Button.
    •   Login With Facebook
    •  Login With Google
     Login With Email/Password