CSE 240 TESTS COMPILATION BUNDLE
EXAM SCRIPT 2026 FULL QUESTIONS AND
CORRECT ANSWERS GUARANTEED PASS
GRADED A+
⩥ what is a protected class member.
Answer: can be used only by members functions of the class and the
derived classes from the original class
⩥ what is a private class member.
Answer: can be used only by member functions of the class
⩥ implementing member functions in-class.
Answer: it is often more convenient to have function implementation in
the class
⩥ implementing member functions out-class.
Answer: structurally clearer to separate implementation from definition
⩥ what is a constructor.
Answer: a function whose name is the same as the class name and is
used to automatically initialize objects
,⩥ what is a destructor.
Answer: used to de-allocate any memory you allocated on the heap form
within your class i.e. deleting variables made from heap
⩥ what is memory leakage.
Answer: if a programmer forgets to delete unused variables, the program
will eventually run out of memory
⩥ what is a dangling reference.
Answer: trying to access an object that has been deleted or go out of
scope
⩥ when is a destructor needed.
Answer: when an object created using heap memory must be deleted i.e.
an object that uses an array form
⩥ how do you define a destructor.
Answer: virtual ~Queue()
{
delete buffer;
buffer = null;
}
, ⩥ what is inheritance.
Answer: define new classes by extending existing class: support code
reuse
⩥ what is a base class.
Answer: the parent class
⩥ what is a derived class.
Answer: the children of the base class. they are extended from the base
class and have all the properties as the base class. they can have more
properties
⩥ difference between inheritance and containment.
Answer: inheritance is an "is-a" and containment is a "has-a" i.e. a
penguin "is-a" bird, a car "has-a" wheel
⩥ why declare virtual classes.
Answer: can redefine base class fields or operations for more specific
behavior
⩥ polymorphism in c++.
EXAM SCRIPT 2026 FULL QUESTIONS AND
CORRECT ANSWERS GUARANTEED PASS
GRADED A+
⩥ what is a protected class member.
Answer: can be used only by members functions of the class and the
derived classes from the original class
⩥ what is a private class member.
Answer: can be used only by member functions of the class
⩥ implementing member functions in-class.
Answer: it is often more convenient to have function implementation in
the class
⩥ implementing member functions out-class.
Answer: structurally clearer to separate implementation from definition
⩥ what is a constructor.
Answer: a function whose name is the same as the class name and is
used to automatically initialize objects
,⩥ what is a destructor.
Answer: used to de-allocate any memory you allocated on the heap form
within your class i.e. deleting variables made from heap
⩥ what is memory leakage.
Answer: if a programmer forgets to delete unused variables, the program
will eventually run out of memory
⩥ what is a dangling reference.
Answer: trying to access an object that has been deleted or go out of
scope
⩥ when is a destructor needed.
Answer: when an object created using heap memory must be deleted i.e.
an object that uses an array form
⩥ how do you define a destructor.
Answer: virtual ~Queue()
{
delete buffer;
buffer = null;
}
, ⩥ what is inheritance.
Answer: define new classes by extending existing class: support code
reuse
⩥ what is a base class.
Answer: the parent class
⩥ what is a derived class.
Answer: the children of the base class. they are extended from the base
class and have all the properties as the base class. they can have more
properties
⩥ difference between inheritance and containment.
Answer: inheritance is an "is-a" and containment is a "has-a" i.e. a
penguin "is-a" bird, a car "has-a" wheel
⩥ why declare virtual classes.
Answer: can redefine base class fields or operations for more specific
behavior
⩥ polymorphism in c++.