If all required header files are already included, identify the output of the…

2022

If all required header files are already included, identify the output of the following C++ code from the given options:

  1. A.

    1001 : 1

  2. B.

    1001 : 4

  3. C.

    1001 : 3

  4. D.

    1001 : 2

Attempted by 160 students.

Show answer & explanation

Correct answer: B

Student S(1001); → Constructor is called with AN = 1001 and default C = 1 → AdmNo = 1001, Class = 1 S.Promoted(3); → Class += 3 → Class = 1 + 3 = 4 S.Display(); prints → 1001 : 4

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs