Which file extension is commonly used for a C++ source file?

Options

  • A. .h
  • B. .cpp
  • C. .html
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. .cpp

Detailed Explanation

Correct Answer: Option B — .cpp

Explanation: The .cpp extension is widely used for C++ source files containing implementation code. Other extensions, such as .cc and .cxx, are also used.