MCQ on const in C++: Multiple Choice Questions on C++ Destructor

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

Our C++ const quiz (C++ const multiple Choice Questions ) focuses on all areas of the C++ const and its concept. We will regularly update the MCQ on the C++ const 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 const in C++:

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

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

0 votes, 0 avg

You have 30 minutes to take the MCQ On C++ const keyword

Your time has been Over.


MCQ On C++ const keyword

C++ MCQ

MCQ On C++ const keyword

1 / 7

What is the output of the following program?

#include <iostream>
using namespace std;

int main()
{
    const char* p = "12345";
    
    const char **q = &p;
    
    *q = "abcde";
    
    const char *s = ++p;
    
    p = "XYZWVU";
    
    cout << *++s;
    
    return 0;
}

 

2 / 7

What is the output of the following C Program?

#include <iostream>
using namespace std;

class Test
{
    int x, y;
public:
    Test(int i = 0, int j =0)
    {
        x = i;
        y = j;
    }
    int getX() const
    {
        return x;
    }
    int getY()
    {
        return y;
    }
};

int main()
{
    const Test t;
    cout << t.getX() << " ";
    cout << t.getY();
    return 0;
}

 

3 / 7

Output of C++ program?

#include <iostream>

int const data = 10;

int main()
{
    std::cout << data;

    return 0;
}

 

4 / 7

Output of the below C++ Code?

#include <iostream>
using namespace std;

int main()
{
    const int data = 0;

    int* p = (int*)&data;

    *p = 20;

    cout << *p << endl;

    return 0;
}

 

5 / 7

What is the output of the below C program?

#include <stdio.h>

int main()
{
    const int x;
    
    x = 20;
    
    printf("%d", x);
    
    return 0;
}

 

6 / 7

In C++, const qualifier can be applied to

7 / 7

Output of the below C++ Code?

#include <iostream>
using namespace std;

const int fun()
{
    return 20;
}

int main()
{
    const int val = fun();

    cout << val;

    return 0;
}

 

Your score is

The average score is 0%

0%

Recommended Articles for you: