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

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

3 / 15

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

4 / 15

Pick the correct statement about references.

5 / 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;
}

 

6 / 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;
}

 

7 / 15

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

 

8 / 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

9 / 15

Which of the following functions must use reference.

10 / 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;
} 

 

11 / 15

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

12 / 15

Why is this not a reference?

13 / 15

How many objects reference can refer to during its lifetime?

14 / 15

A reference is declared using the _____ symbol.

15 / 15

Which of the following statement is correct about the references?

Your score is

The average score is 0%

0%

Recommended Articles for you: