MCQ On References in C++: Multiple Choice Questions and Answers On C++ References

MCQ on references in C++ with answers and explanations for placement tests and job interviews. This C++ MCQ on references is useful for the campus placement for all freshers including Engineering Students, MCA students, Computer and IT Engineers, etc.

Our C++ references quiz (C++ references multiple Choice Questions ) focuses on all areas of C++ references and its concept. We will regularly update the Quiz on the C++ references and most interesting thing is that questions come in a random sequence. So every time you will feel new questions.

You may have come across several C++ courses during your search for learning the C++ language. Our team of experts has carefully analyzed some C++ courses for you. You can check the courses, Trial of some courses is free.

 

Guideline of MCQ on references in C++:

This MCQ on references in C++ is intended for checking your knowledge of C++ references. It takes 30 minutes to pass the C++ quiz on reference. If you don’t finish the C++ reference quiz within the mentioned time, all the unanswered questions will count as wrong. Every unanswered question will count as wrong. Quiz on reference in C++ has randomization features that give you a new question set at every attempt.

In this MCQ on references in C++, we have also implemented a feature that not allowed the user to see the next question or finish the quiz without attempting the current C++ references quiz.

2 votes, 5 avg

You have 30 minutes to take the MCQs on Reference in C++

Your time has been Over.


MCQ On C++ References

C++ MCQ

MCQ On C++ References

1 / 15

Pick the correct statement about references in C++.

2 / 15

Pick the correct statement about references.

3 / 15

Predict the output of following C++ program.

#include<iostream>
using namespace std;
 
int &fun()
{
    static int x = 10;
    return x;
}
int main()
{
    fun() = 30;
    cout << fun();
    return 0;
}

 

4 / 15

Why is this not a reference?

5 / 15

What is the return value of f(p, p) if the value of p is initialized to 5 before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value.

int f(int &x, int c) {
   c  = c - 1;
   if (c == 0) return 1;
   x = x + 1;
   return f(x, c) * x;
} 

 

6 / 15

Which of the following is FALSE about references in C++

7 / 15

Output of following C++ program?

#include<iostream>
using namespace std;
 
int main()
{
  int x = 10;
  int& ref = x;
  ref = 20;
  cout << "x = " << x << endl ;
  x = 30;
  cout << "ref = " << ref << endl;
  return 0;
}

 

1. 

x = 20
ref = 30

2. 

x = 20
ref = 20

3.

x = 10
ref = 30

4. 

x = 30
ref = 30

8 / 15

A reference is declared using the _____ symbol.

9 / 15

Which of the following functions must use reference.

10 / 15

Which of the following statement is correct about the references?

11 / 15

#include<iostream>
using namespace std;
 
int &fun()
{
    int x = 10;
    return x;
}
int main()
{
    fun() = 30;
    cout << fun();
    return 0;
}

 

12 / 15

Can you reseat a reference to make it refer to a different object in C++?

13 / 15

How many objects reference can refer to during its lifetime?

14 / 15

What is the output?

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main()
{
    int a = 5;
    int *p = &a;
    int &q = p;
    cout<<p;
    return 0;
}

 

15 / 15

If a function receives a reference to a variable, can it modify the value of the variable?

Your score is

The average score is 0%

0%

Recommended Articles for you: