• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 40 pages
Exam (elaborations)

COS2614 Exam Questions & Answers 2026 (1–100) | Programming: Contemporary Concepts | C++, Qt & Object-Oriented Programming | UNISA

Document preview thumbnail
Preview 4 out of 40 pages

Comprehensive COS2614 exam preparation resource for UNISA Computer Science students. The module focuses on object-oriented programming principles and techniques, including encapsulation, inheritance, abstraction, polymorphism, and the design and implementation of software systems. UNISA’s official software repository identifies Qt Creator as the development environment associated with COS2614. The practice assessment provides 100 questions with answers and detailed explanations to help reinforce programming concepts, problem-solving, and exam readiness.

Content preview

COS2614 Exam Questions & Answers (1–100) |
C++, Qt Framework & Data Structures Practice
Assessment


1. Which C++ feature allows a derived class to provide a specific implementation of a
method that is already defined in its base class?

A) Method Overloading

B) Method Overriding

C) Encapsulation

D) Data Abstraction

Rationale: Method overriding occurs when a subclass provides its own definition of a virtual
function inherited from a base class with the same signature.

2. What happens if a class contains at least one pure virtual function (virtual void
func() = 0;)?

A) The class becomes a final class.

B) The class becomes an abstract class and cannot be instantiated.

C) The program will throw a runtime error upon compilation.

D) The function must be executed in the main routine automatically.

,Rationale: Declaring a function as pure virtual makes the class abstract, meaning objects of
this class type cannot be created directly.

3. Which pointer in C++ points to the object that invoked the current member
function?

A) super

B) base

C) this

D) self

Rationale: The this pointer is an implicit parameter passed to all non-static member
functions, pointing to the invoking object.

4. When implementing a deep copy in a C++ class containing raw pointer data
members, what must be explicitly defined?

A) A default constructor only

B) A copy constructor and copy assignment operator (operator=)

C) A static member function

D) A template parameter list

Rationale: A shallow copy copies pointer addresses (causing double-free errors), while a
deep copy requires custom copy constructors and copy assignment operators to duplicate
the actual heap memory.

,5. What is the main advantage of using C++ templates for data structures like stacks
or linked lists?

A) Faster runtime execution compared to concrete types

B) Automatic memory management and garbage collection

C) Code reusability for different data types without code duplication

D) Prevention of memory leaks automatically

Rationale: C++ templates enable generic programming, allowing a single data structure or
algorithm implementation to work with arbitrary data types.

6. In object-oriented software design, what does the principle of Encapsulation
encourage?

A) Making all class attributes public for easy accessibility

B) Combining data and the methods that operate on that data into a single unit while
restricting direct access to internal components

C) Inheriting attributes from multiple base classes simultaneously

D) Overloading every operator in the class

Rationale: Encapsulation bundles data and functions while hiding implementation details
behind private/protected access modifiers to safeguard data integrity.

7. Which operator must be overloaded to permit custom object printing directly via
std::cout << obj;?

, A) operator+

B) operator[]

C) operator<<

D) operator->

Rationale: Overloading the stream insertion operator (<<) as a non-member friend function
allows custom class instances to be streamed directly to std::ostream objects like std::cout.

8. What is the time complexity of searching for an element in a balanced Binary
Search Tree (BST) containing $N$ nodes in the worst case?

A) $\mathcal{O}(1)$

B) $\mathcal{O}(\log N)$

C) $\mathcal{O}(N)$

D) $\mathcal{O}(N^2)$

Rationale: In a balanced BST, the height of the tree is logarithmic relative to the number of
nodes, making both search and insertion $\mathcal{O}(\log N)$.

9. Why is a virtual destructor necessary when deleting a derived class object through
a base class pointer?

A) It prevents syntax errors during compilation.

B) It ensures the derived class destructor is called, preventing resource leaks.

C) It automatically resets all pointers to nullptr.

Document information

Uploaded on
September 1, 2026
Number of pages
40
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$21.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
4
Followers
1
Items
225
Last sold
1 week ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions