Skip to content
main-logo
  • +91 637-050-2482
  • santuitreturns@gmail.com
Menu
Menu
  • Home
  • Income Tax
    • Income From Salary
    • Profit or gain from Business/Profession.
    • Capital Gain
    • Income From Other Sources
    • 80C to 80U
    • TDS & TCS
    • ITR FORMS
  • International Taxation
    • Transfer Pricing
    • Non-Resident Taxation
    • Foreign Tax Credit (FTC)
    • Model Tax Convention
    • Base Erosion and Profit Shifting (BEPS)
  • GST
  • Accounting
  • MCQs
    • NEET
    • NEET QUIZ TEST
    • NEET PG MCQ’s
    • NEET PG QUIZ TEST
    • Civil Engineering
    • Mechanical Engineering MCQs
    • CHSL EXAM
      • Logical Reasoning
  • Others
    • Job Tips
  • CA Courses
    • CA Inter/IPCC

10+ TOP C++ MCQs on Dereferencing

Posted on September 24, 2023

1. Which is used to tell the computer that where a pointer is pointing to?

A. dereference
B. reference
C. heap operations
D. binary operations

View Answer

Answer: A

Explanation: 

 dereference is used to tell the computer where a pointer is pointing to it.

2. Which is used to do the dereferencing?

A. pointer without asterix
B. value without asterix
C. pointer with asterix
D. value with asterix

View Answer

Answer: C

Explanation:

 Dereferencing is using a pointer with asterix. For example, *(abC..

3. Pick out the correct option.

A. References automatically dereference without needing an extra character
B. References automatically dereference with an extra character
C. Reference will not dereference
D. Reference automatically dereference with extra space and character

View Answer

Answer: A

Explanation:

 References automatically dereference without needing an extra character.

4. What will be the output of the following C++ code?

    #include 
    using namespace std;
    int main()
    {
        int a, b;
        int* c;
        c = &a;
        a = 200;
        b = 200;
        *c = 100;
        b = *c;
        cout << *c << " " << b;
        return 0;
    }

A. 100 200
B. 100 0
C. 200 200
D. 100 100

View Answer

Answer: D

Explanation:

 In this program, We are making the assignments and invoking the both b and c values as 100 by dereference operator.

5. What will be the output of the following C++ code?

    #include 
    using namespace std;
    int main()
    {
        int x;
        int *p;
        x = 5;
        p = &x;
        cout << *p;
        return 0;
    }

A. 5
B. 10
C. memory address
D. 15

View Answer

Answer: A

Explanation:

 In this program, we are copying the memory location of x into p and then printing the value in the address.

6. What will be the output of the following C++ code?

    #include 
    using namespace std;
    int main ()
    {
        int a;
        int * ptr_b;
        int ** ptr_c;
        a = 1;
        ptr_b = &a;
        ptr_c = &ptr_b;
        cout << a << "\n";
        cout << *ptr_b << "\n";
        cout << *ptr_c << "\n";
        cout << **ptr_c << "\n";
        return 0;
    }


A.

1
1
0xbffc9924
1

B.

1
1
1
0xbffc9924

C.

1
0xbffc9924
1
&1

D. 0xbffc9924

View Answer

Answer: A

Explanation:

In this program, We are printing the values and memory address by using the pointer and dereference operator.

7. What will be the output of the following C++ code?

    #include 
    using namespace std;
    int main() 
    {
        int x = 9;
        int* p = &x;
        cout << sizeof(p);
        return 0;
    }

A. 4
B. 2
C. Depends on compiler
D. 8

View Answer

Answer: C

Explanation:

The size of a data type mainly depends on compiler only.

8. What will be the output of the following C++ code?

    #include  
    using namespace std;
    int main()
    {
        double arr[] = {5.0, 6.0, 7.0, 8.0};
        double *p = (arr+2);
        cout << *p << endl;   
        cout << arr << endl;  
        cout << *(arr+3) << endl;
        cout << *(arr) << endl;  
        cout << *arr+9 << endl;  
        return 0;
    }

A.

7
0xbf99fc98
8
5
14


B.

7
8
0xbf99fc98
5
14

C. 0xbf99fc98

D. 14

View Answer

Answer: A

Explanation:

 In this program, We are printing the values that are pointed by pointer and also the dereference operator.

9. What does the dereference operator will return?

A. rvalue equivalent to the value at the pointer address
B. lvalue equivalent to the value at the pointer address
C. it will return nothing
D. it will return boolean values

View Answer

Answer: B

Explanation:

 It operates on a pointer variable, and returns an l-value equivalent to the value at the pointer address.

10. Pick out the correct statement.

A. the null pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to null
B. the null pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to the memory address
C. rvalue equivalent to the value at the pointer address
D. null pointer will not return anything

View Answer

Answer: A

Explanation:

 The null pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to null.

    You May Also Like...

  • 10+ TOP C++ MCQs on OOPs Concept – 3
  • 10+ TOP C++ MCQs on OOPs Concept – 4
  • 10+ TOP MCQs on C++ vs C
  • 10+ TOP C++ MCQs on Floating Point Types
  • 10+ TOP C++ MCQs on Sizes
  • 10+ TOP C++ MCQs on Void
  • 10+ TOP C++ MCQs on References – 2
  • 10+ TOP C++ MCQs on References – 3

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Quick Links

  • Home
  • About Us
  • Privacy Policy
  • Terms of Use
  • Disclaimer
  • Contact Us

Categories

  • Income Tax
  • International Taxation
  • GST
  • MCQs
  • Others
  • CA Courses

Latest Posts

  • Five changes in ITR forms of FY 2024-25 (AY 2025-26)
  • Form 10-IEA: Option to Choose Old Tax Regime
  • What is Section 54EC of the Income Tax Act?
  • What is Section 54F of the Income Tax Act?
©2025 Online Solves. All rights Reserved | Developed by AlgoPage IT Solutions Pvt. Ltd.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT