Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Functions True or False? ( a - g ) a. A function has exactly one return stat

ID: 3642244 • Letter: C

Question

C++ Functions

True or False?
( a - g )

a. A function has exactly one return statement. (true/false)

b. A function has at least one return statement. (true/false)

c. A function has at most one return statement. (true/false)

d. A function with return value void never has a return statement. (true/false)

e. When executing a return statement, the function exits immediately. (true/false)

f. A function with a return value void must print a result. (true/false)

g. A function without arguments always returns the same value. (true/false)

Explanation / Answer

a. A function has exactly one return statement - True b. A function has at least one return statement - False c. A function has at most one return statement - True (Remarks for A, B and C - A function will execute only one return statement though it can have if loop and more return statement can be written inside it, but when it encounters a single return statement, it will exit the function.) d. A function with return value void never has a return statement - True e. When executing a return statement, the function exits immediately - True f. A function with a return value void must print a result - False (Remarks - it may not print any result) g. A function without arguments always returns the same value - False (Remarks - The function may use Instance/Global variables)