HomeTriviaTech & GamesC++ programming language
concept🎮 Tech & Games

C++ programming language Trivia Questions

How much do you really know about C++ programming language? Below are 8 true or false statements. Click each one to reveal the answer and explanation.

1.

You cannot use 'auto' as a variable name in C++ because it’s a reserved keyword.

Click to reveal answer ›

Easy
✓ TRUE

'auto' is a keyword in C++ since C++11, used for type deduction, so it cannot be used as an identifier for variables or functions.

2.

The '++' operator in C++ is used to increment a variable by one, but the name also hints at being one step beyond C.

Click to reveal answer ›

Easy
✓ TRUE

The name C++ is a pun on the increment operator, suggesting the language is an improved version of C, as in 'C plus one.'

3.

C++ fully supports garbage collection like Java, automatically reclaiming unused memory.

Click to reveal answer ›

Medium
✗ FALSE

C++ does not have built-in garbage collection; memory management is manual via new/delete or smart pointers in modern C++.

4.

C++ was originally called 'C with Classes' before being renamed in 1983.

Click to reveal answer ›

Medium
✓ TRUE

Bjarne Stroustrup started developing 'C with Classes' in 1979, and the language was officially renamed C++ in 1983 to emphasize its evolutionary nature.

5.

The 'friend' keyword in C++ allows a class to grant access to its private members to a specific function or another class.

Click to reveal answer ›

Medium
✓ TRUE

Friend functions or classes can access private and protected members of the class that declares them as friends, breaking encapsulation selectively.

6.

The 'volatile' keyword in C++ prevents the compiler from optimizing reads/writes to a variable, often used for memory-mapped I/O.

Click to reveal answer ›

Hard
✓ TRUE

'volatile' tells the compiler that the variable’s value may change unpredictably, disabling certain optimizations, commonly in embedded systems.

7.

C++ templates are evaluated at runtime, similar to Java generics.

Click to reveal answer ›

Hard
✗ FALSE

C++ templates are compile-time constructs, generating separate code for each type, unlike Java generics which rely on erasure at runtime.

8.

C++ allows you to overload the '?:' conditional operator for custom types.

Click to reveal answer ›

Hard
✗ FALSE

The ternary conditional operator '?:' cannot be overloaded in C++, though most other operators like +, -, and [] can be.

More in Tech & Games

MinecraftTrivia Questions →ChessTrivia Questions →TetrisTrivia Questions →Super MarioTrivia Questions →The Legend of ZeldaTrivia Questions →
View all Tech & Games topics →

Want to test yourself in real time?

Swipe right for True, left for False. New questions every day on PopBluff.

Play PopBluff Free →