Which of the following statement(s) is/are correct regarding void keyword in…

20212021

Which of the following statement(s) is/are correct regarding void keyword in C++? I. To specify the return type of a function when it is not returning any value. II. To indicate an empty argument list to a function.

  1. A.

    Only I

  2. B.

    Only II

  3. C.

    Both I and II

  4. D.

    Neither I nor II

Attempted by 156 students.

Show answer & explanation

Correct answer: C

In C++, the void keyword is used in multiple ways:

  1. To specify that a function does not return any value.
    Example:

void display()

  1. To indicate that a function has no arguments.

    Example:

int show(void)

Since both statements are correct, the correct answer is Both I and II.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs