Oct 22, 2016 at 5:17am UTC
Do you think this is a good C++ interview question (for beginners)?
What is true regarding the following code snippet?
1 2 3 4 5 6
if (ComplicatedFunctionCall() || AnotherComplicatedFunctionCall())
{
// do stuff
}
Assume that the operator || is not overloaded
Answers:
1. The function AnotherComplicatedFunctionCall() will be executed even if the function ComplicatedFunctionCall() will return true
2. The function AnotherComplicatedFunctionCall() will be executed only if the function ComplicatedFunctionCall() will return false
3. The function ComplicatedFunctionCall() will be executed only if the function AnotherComplicatedFunctionCall() will return true
Do you have better questions? we're trying to gather the best C++ questions.
Appreciate your help!
Uri
Last edited on Oct 22, 2016 at 5:21am UTC
Oct 22, 2016 at 5:41am UTC
Its a good question I would say.
You might also add the "whats wrong with this snippet of code" type of questions to your list. This is, of course, where you provide a snippet of code that contains a (sometimes hard to spot) grave error and ask what the error is.
Last edited on Oct 22, 2016 at 5:43am UTC