Assignment 2: Exploring Advanced C++ ConceptsUnit Name: Advanced C++ Programming
Date: June 8, 2024
Time: 10:00 AM
Instructions:
1.
2.
3.
4.
5.
6.
7.
Answer all four questions provided below.
Each question is worth 5 marks, making a total of 20 marks.
Provide detailed explanations where applicable.
Submit your answers in a single PDF document.
Ensure your name and student ID are on the first page of your document.
Use clear and concise language. Quality of explanation will be considered in grading.
This assignment is due by [June 8, 2024]. Late submissions will incur a penalty as per the
course guidelines.
8. Submit your assignment via the course’s online portal.
Questions:
1. Explain the concept of RAII (Resource Acquisition Is Initialization) in C++.
o Define RAII and its significance in C++.
o Discuss how RAII helps in resource management.
2. What is the difference between malloc and new in C++?
o Compare and contrast malloc and new.
o Explain the advantages of using new over malloc.
3. What is a destructor in C++ and when is it called?
o Define a destructor and its purpose in C++.
o Discuss when a destructor is called and why it is important.
4. Explain the difference between private, protected, and public access specifiers in
a class.
o Define the access specifiers private, protected, and public.
o Discuss the visibility and accessibility of class members with each access
specifier.
Grading Criteria:
•
•
Clarity of Explanation (3 marks): How clearly and concisely you explain the concept.
Depth of Understanding (2 marks): Demonstration of a deep understanding of the
concept.
Good luck, and if you have any questions, please reach out during office hours or via email.