Which of the following is user-defined header file extension used in C++?

2023

Which of the following is user-defined header file extension used in C++?

Answer: C. hIn C++, user-defined header files typically use the '.h' extension. This extension is standard for declaring functions, classes, and variables that are meant…

  1. A.

    hg

  2. B.

    cpp

  3. C.

    h

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 458 students.

Show answer & explanation

Correct answer: C

In C++, user-defined header files typically use the '.h' extension. This extension is standard for declaring functions, classes, and variables that are meant to be included in multiple source files. The '.hg' extension is used by the Mercurial version control system and is not related to C++ files. The '.cpp' extension is used for C++ source files, not header files. Therefore, only the '.h' extension is correct for user-defined header files in C++.

Explore the full course: Bpsc

Loading lesson…