C++ quizzes

February 3, 2017 · 1 minute to read · C++

I found on reddit a very interesting post on C++ quizzes.

I did not know that such things exist, so it was an interesting discover. Now, I can test myself on this vast subject!

I start with the first one: C++ Quiz. There are three levels. The first one is basic, the second is difficult and the last one is really hard.

Answers are described in detail, with quotes from official standard and explanations.

Generally, I have found that last level is not very easy, pointing to ambiguity of standard.

A little example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <iostream> 

typedef long long ll;

void foo(unsigned ll) {
    std::cout << "1";
}

void foo(unsigned long long) {
    std::cout << "2";
}

int main() {
    foo(2ull);
}

Try for yourself!