C & C++ Interview Quiz Challenge: Pointers, OOP, and Templates | C/C++ language Multi choice questions and answers | Practice for interviews and exams
Test your knowledge of **C Fundamentals, Memory Management, Object-Oriented Programming (OOP), and Advanced C++ Features**. **Pass with 80% to proceed to the next difficulty level.**
Level 1: C Fundamentals & Pointers: 0/10 (0%)
Level 2: C++ OOP & Core Features: 0/10 (0%)
Level 3: Advanced C++ & Concurrency: 0/10 (0%)
Level 1: C Fundamentals & Pointers
1.1 What is the key difference between the C dynamic memory allocation functions `malloc()` and `calloc()`?
**Correct Answer: B. `calloc()` initializes the allocated memory to zero, while `malloc()` does not.** `malloc()` allocates a block of memory and returns a pointer; `calloc()` takes the number of elements and their size, and sets memory to zero.
**End of C Fundamentals & Pointers. Click "Next Level" to continue.**
Level 2: C++ OOP & Core Features
2.1 What is the role of the **`virtual`** keyword in C++ inheritance?
**Correct Answer: C. It enables Runtime Polymorphism...**. The `virtual` keyword creates a v-table (virtual table) lookup, allowing the program to dynamically select the correct function implementation at runtime.
**End of C++ OOP & Core Features. Click "Next Level" to continue.**
Level 3: Advanced C++ & Concurrency
3.1 What is a **Template** in C++?
**Correct Answer: B. A facility for defining functions or classes...**. Templates allow you to write code once and have it work with different data types (e.g., `std::vector` or `std::vector`).
**C/C++ Mastered! Click "Finish Quiz" to see your final summary.**
Comments
Post a Comment