Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++' 2025 - Free C++ Practice Questions and Study Guide

Image Description

Question: 1 / 565

For pointers and references, what does marking an argument 'const' guarantee to the caller?

The function is more efficient

The object pointed or referred to will not be modified

When an argument is marked 'const' in a function, it guarantees that the object being pointed or referred to will not be modified. This means that the function will not change the value of the object and any modifications made to the object within the function will be discarded once the function ends. This is not the case for the other options. Option A suggests that marking an argument 'const' will make the function more efficient, which is not necessarily true. Option C states that the function returns a constant value, which is unrelated to marking an argument 'const'. Option D mentions that the function does not throw exceptions, which is also unrelated to marking an argument 'const'.

Get further explanation with Examzify DeepDiveBeta

The function returns a constant value

The function does not throw exceptions

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy