Good C++ Interview Question

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
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
Topic archived. No new replies allowed.