Docsity

CS215 Final Exam Study Guide: Classes, Pointers, Recursion, Sorting ACTUAL UPDATED QUESTI, Exams of Medicine

Partial preview of the text

Download CS215 Final Exam Study Guide: Classes, Pointers, Recursion, Sorting ACTUAL UPDATED QUESTI and more Exams Medicine in PDF only on Docsity!

CS215 Final Exam Study Guide: Classes, Pointers,

Recursion, Sorting ACTUAL UPDATED QUESTIONS

AND CORRECT ANSWERS

What is the date and time of the CS215 final exam? Tuesday, May 5, 2026, from 8:00am to 10:00am What percentage of the final exam consists of True or False questions?

How many coding questions are included in the final exam? 2 - 3 coding questions

What is encapsulation in object- oriented programming? Separating interface from implementation, where all access to the class goes through public member functions. What is a class in programming? A class describes a set of objects with the same behavior and is a type. What is the purpose of a constructor? To initialize an object's private data. What is the syntax for declaring a class in C++? class ClassName { public: // member functions; private: // member variables; }; What distinguishes accessors from mutators in a class? Accessors (const) do not modify the object, while mutators do. What is the default constructor? A constructor with no parameters that is called automatically when an object is created. How do you declare a pointer in C++? int *p; What does the address-of operator (&) do? It retrieves the address of a variable.

What is the significance of the 'this' is a pointer to the implicit parameter of the keyword 'this' in a member function? member function, allowing access to the object's data members. What is the syntax for implementing ReturnType a member function in C++? ClassName::FunctionName(parameters) { // implementation } What does the 'new' operator do in C++? It allocates memory for a variable or an array on the heap. What is the purpose of the 'delete' operator? To free memory that was previously allocated with 'new'. What is the role of the 'const' keyword in member functions? It indicates that the member function does not modify the object. What are the common operations performed on linked lists? Insert, remove, push front, push back, pop front, pop back. What is the main characteristic of a stack? A stack follows Last-In-First-Out (LIFO) principle, where elements are inserted and removed from the same end (the top).

What are the primary functions of a stack in C++? The primary functions are push, pop, top, and empty. What is a common application of stacks? Reversing a sequence of data or postponing data usage until a later point. What is the main characteristic of a queue? A queue follows First-In-First-Out (FIFO) principle, where elements are inserted at the back and removed from the front. What are the primary functions of a queue in C++? The primary functions are push, pop, front, and empty. What is recursion? Recursion is a function calling itself to solve a problem by breaking it down into smaller, easier versions. What is the base case in recursion? The base case is the condition under which the recursion stops, usually when the problem is simple enough to solve directly. What is the recursive formula for calculating factorial? n! = (n โˆ’ 1)! * n with the base case 0! = 1.