C++ Certified Associate Programmer (CPA-21-02) — Question 6

Which of the following statements are true? (Choose two.)

Answer options

Correct answer: C, D

Explanation

Option C is correct because a typed function can have multiple return statements that can return different values. Option D is also correct as a void function is designed not to return a value, hence it cannot have a return expression. Options A and B are incorrect because a void function cannot return a value and while a function can be defined inside another function, it's not universally applicable in all programming languages.