C++ Programming Skill Assessment

Written by Coursera • Updated on

Test your C++ skills with this quick assessment. Answer 10 multiple-choice questions to get your score, then check the Scoring Guide to find your level and recommended learning path.

C++ Programming Skill Assessment

C++ Programming Quiz

1. What is the difference between new and malloc?

No difference
new calls constructors and returns exact type, malloc doesn't and returns void*
malloc is faster than new
new is for arrays only

2. What will this code output?

int x = 5;
int& y = x;
y = 7;
cout << x;
  
5
7
Error
Undefined behavior

3. What is a virtual destructor used for?

To create virtual functions
To ensure proper cleanup of derived classes through base class pointer
To optimize memory usage
To prevent inheritance

4. Which smart pointer would you use for shared ownership?

unique_ptr
shared_ptr
weak_ptr
auto_ptr

5. What is the purpose of std::move?

To move files
To convert an lvalue into an rvalue reference
To move memory blocks
To change variable scope

6. What is RAII?

A design pattern for GUI
Resource Acquisition Is Initialization - managing resources through object lifetime
A type of inheritance
A memory management technique

7. What is the difference between stack and heap allocation?

MyClass obj1;           // Stack
MyClass* obj2 = new MyClass(); // Heap
  
No difference
Stack is automatic and limited, heap is manual and larger
Heap is faster than stack
Stack is thread-safe, heap isn't

8. What is template metaprogramming?

A way to write documentation
Compile-time programming using templates
A debugging technique
Runtime polymorphism

9. What is the purpose of std::variant?

To create variables
To hold and safely manage a value that could be of several different types
To optimize memory
To handle exceptions

10. What is copy elision?

A way to prevent copying
Compiler optimization that eliminates unnecessary copying of objects
A type of inheritance
A memory leak prevention technique

Scoring Guide & Course Recommendations

0-30: Beginner Level

40-70: Intermediate Level

80-100: Advanced Level

Skills Covered by Level

Beginner Level

  • Basic syntax

  • Control structures

  • Functions

  • Basic OOP

  • Basic memory management

  • Error handling

Intermediate Level

  • Advanced OOP

  • STL containers

  • Templates

  • Smart pointers

  • Exception handling

  • Basic multithreading

Advanced Level

  • Template metaprogramming

  • Memory optimization

  • Concurrent programming

  • Design patterns

  • Performance optimization

  • Systems programming

Career Paths

  • Beginner Level: Junior C++ Developer, Software Developer Trainee, QA Engineer

  • Intermediate Level: C++ Developer, Systems Developer, Game Developer

  • Advanced Level: Senior C++ Developer, Systems Architect, Game Engine Developer

Key Technologies to Learn

  • Core C++

  • STL

  • Boost libraries

  • CMake/Make

  • Debugging tools (GDB, Visual Studio Debugger)

  • Version control (Git)

Updated on
Written by:

Coursera

Writer

Coursera is the global online learning platform that offers anyone, anywhere access to online course...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.