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
  • References

C++ Programming

REFERENCES MCQs

Total Questions : 37

Page 1 of 4 pages
Question 1.


What will be the output of the following program?



#include
enum xyz
{
a, b, c
};
int main()
{
int x = a, y = b, z = c;
int &p = x, &q = y, &r = z;
p = z;
p = ++q;
q = ++p;
z = ++q + p++;
cout
  1.    2 3 6
  2.    4 4 7
  3.    4 5 8
  4.    3 4 6
 Discuss Question
Answer is Option B. -> 4 4 7

Question 2.


Which of the following statement is correct about the program given below?



#include
int main()
{
int arr[] = {1, 2 ,3, 4, 5};
int &zarr = arr;
for(int i = 0; i
  1.    The program will print the output 1 2 3 4 5.
  2.    The program will print the output 2 4 6 8 10.
  3.    The program will print the output 1 1 1 1 1.
  4.    It will result in a compile time error.
 Discuss Question
Answer is Option D. -> It will result in a compile time error.

Question 3.


Which of the following statement is correct about the program given below?



#include
enum xyz
{
a, b, c
};
int main()
{
int x = a, y = b, z = c;
int &p = x, &q = y, &r = z;
p = ++x;
q = ++y;
r = ++c;
cout
  1.    The program will print the output 1 2 3.
  2.    The program will print the output 2 3 4.
  3.    The program will print the output 0 1 2.
  4.    It will result in a compile time error.
 Discuss Question
Answer is Option D. -> It will result in a compile time error.

Question 4.


Which of the following statement is correct about the program given below?



#include
int main()
{
int m = 2, n = 6;
int &x = m++;
int &y = n++;
m = x++;
x = m++;
n = y++;
y = n++;
cout
  1.    The program will print output 3 7.
  2.    The program will print output 4 8.
  3.    The program will print output 5 9.
  4.    The program will print output 6 10.
  5.    It will result in a compile time error.
 Discuss Question
Answer is Option E. -> It will result in a compile time error.

Question 5.


Which of the following statement is correct about the program given below?



#include
int main()
{
int m = 2, n = 6;
int &x = m;
int &y = n;
m = x++;
x = m++;
n = y++;
y = n++;
cout
  1.    The program will print output 2 6.
  2.    The program will print output 3 7.
  3.    The program will print output 4 8.
  4.    The program will print output 5 9.
  5.    The program will print output 6 10.
 Discuss Question
Answer is Option C. -> The program will print output 4 8.

Question 6.

Identify the correct sentence regarding inequality between reference and pointer.


  1.    we can not create the array of reference.
  2.    we can create the Array of reference.
  3.    we can use reference to reference.
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> we can not create the array of reference.

None.

Question 7.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
void print (char * a)
4.
{
5.
cout
  1.    Hello world
  2.    Hello
  3.    world
  4.    compile time error
 Discuss Question
Answer is Option A. -> Hello world

In this program we used the concept of constant casting to cast the variable and printing it.
Output:
$ g++ ref2.cpp
$ a.out
Hello world

Question 8.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 9;
6.
int & aref = a;
7.
a++;
8.
cout
  1.    9
  2.    10
  3.    error
  4.    11
 Discuss Question
Answer is Option B. -> 10

The value is declared and it is post incremented, so it's value is 10.
$ g++ ref1.cpp
$ a.out
10

Question 9.

What does a reference provide?


  1.    Alternate name for the class
  2.    Alternate name for the variable
  3.    Alternate name for the pointer
  4.    none of the mentioned
 Discuss Question
Answer is Option B. -> Alternate name for the variable

Because we are pointing memory address using temp variable

Question 10.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
void swap(int &a, int &b);
4.
int main()
5.
{
6.
int a = 5, b = 10;
7.
swap(a, b);
8.
cout
  1.    In swap 105 In main 105
  2.    In swap 105 In main 510
  3.    In swap 510 In main 105
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> In swap 105 In main 105

As we are calling by reference the values in the address also changed. So the main and swap 

values also changed.
Output:
$ g++ ref.cpp
$ a.out
In swap 105 In main 105

  • 1
  • 2
  • 3
  • 4
  • Next →
  • 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

Recent Posts

  • Ssc Exam Guide Book
  • Is Ssc Difficult Than Upsc?
  • Sail E0 Exam Results Cancelled - Exam Will Be Rescheduled
  • Vedic Maths Faq
  • Best Ssc Exam For Girls
  • Sail E0 Results 2022
  • Quantitative Aptitude Faqs

Recent Questions

Q.   Which State/UT Launched The 'Tourist Village Network' To Pro....

Q.   Which Of The Following Transaction Can Be Used To Create T-c....

Q.   Organizing Taxonomic Information In Logical Classification I....

Q.   Rolling Friction Is Caused By ________

Q.   A Stone Is Whirled In A Vertical Circle, The Tension In The ....

Q.   In A Tropical Year, The Number Of Sidereal Days, Are

Q.   Synonym Of UNIFORMITY

Q.   Statement: It Is Estimated That About Twenty Lakh People Wi....

Q.   Which Logic Gates Output A 1 If Their Inputs Are 0 And 1?

Q.   An Action Potential Is Caused By An Influx Of _____ Ions Int....

Q.   Force Exerted By Magnetic Field In Hall Effect Transducers I....

Q.   The Factors Which Are To Be Considered While Developing A Go....

Q.   Blood Group Which Have No Antigen

Q.   Threshold Limit Value Of Copper In The Atmospheric Air Is

Q.   When Libya Gave Up Its Nuclear Program?

Q.   How Much Amount Has Been Extended By The EXIM Bank As The Li....

Q.   A Second Order System Exhibits 100% Overshoot. The Damping R....

Q.   Which Are The Special Tags Used For Image Mapping?

Q.   Indict

Q.   Two Perfectly Elastic Spheres Of Equal Mass Moving In The ....

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)
Vedic Maths
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
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
  • 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