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

2023

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 153 students.

Show answer & explanation

Correct answer: B

The object S is created with Student S(1001); , so AdmNo = 1001 and default Class = 1 . Then S.Promoted(3) adds 3 to Class , making it 1 + 3 = 4 . Hence the output is 1001 : 4.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs