1. UOP GSP 125 Final Exam Guide NEW
Check this A+ tutorial guideline at
http://www.assignmentcloud.com/gsp-125-
devry/gsp-125-final-exam-guide-new
For more classes visit
http://www.assignmentcloud.com/
Question 1. 1. In addition to grouping functions together,
a class also groups (Points : 3)
libraries.
math operations.
print statements.
variables.
Question 2. 2. Hiding data in a class is also called
(Points : 3)
encapsulation.
accessibility inversion.
confusion culling.
redirection.
Question 3. 3. The public members of a class (Points : 3)
can be changed after compiling, even functions.
must be accessed from an object of that class.
need a special interface to accessed from an object.
can only be accessed within member functions of
2. that class.
Question 4. 4. Constructors are called (Points : 3)
whenever an object is created.
whenever a new line of code is typed.
only after math operations.
only after a work contract is defined.
Question 5. 5. Unions are (Points : 3)
defined just like structs, though their memory
behaves differently.
a place to store multiple data types simultaneously.
a concept from the C language that is uncommon in
C++.
All of the above
Question 6. 6. When objects contain other objects, it is
called (Points : 3)
composition.
data blending.
subobjecting.
enclosures.
Question 7. 7. Using the sizeof operator, the compiler
will provide the size in bytes of a (Points : 3)
class or data type.
statically allocated array.
variable instance or object.
All of the above
3. Question 8. 8. When de-allocating arrays dynamically
allocated with new, _____ should be used to ensure
proper de-allocation. (Points : 3)
destructor.
delete.
delete [].
free().
Question 9. 9. A pointer stores a(n) (Points : 3)
address.
variable.
value.
None of the above
Question 10. 10. The most common operator used when
accessing members of an object through a pointer is this.
(Points : 3)
&
->
.
::
Question 11. 11. The following can be used to determine
the number of elements in a statically allocated array in
C or C++. (Points : 3)
sizeof(arrayname)/sizeof(arrayname[0])
elementsof<arrayname>
arrayname.length()
None of the above
4. Question 12. 12. When returning by reference, (Points :
3)
the method can be used as an l-value.
other functions cannot use the result as a parameter.
C-style code must be capitalized, as per standard
convention.
There is no such thing as returning by reference.
Question 13. 13. Overloaded methods in a class must use
(Points : 3)
the exact same argument types, but different return
types.
the exact same name.
default arguments.
None of the above
Question 14. 14. The copy constructor takes (Points : 3)
no arguments.
a single argument by reference.
a single argument by value.
any number of arguments.
Question 15. 15. A shallow copy is dangerous because
(Points : 3)
it has a knife and is very clumsy.
it may cause bad de-allocation in a properly written
destructor in a class that allocates memory.
it prevents recursive methods from being called by
using significant amounts of stack space.
None of the above
5. Question 16. 16. When using inheritance, the class that
is doing the inheriting is called a (Points : 3)
subclass.
child class.
derived class.
All of the above
Question 17. 17. A UML class diagram is commonly used
to (Points : 3)
exactly describe code before writing it.
help programmers explain design to other
programmers.
define code standards (for syntax) for programming
teams.
All of the above
Question 18. 18. Downcasting is considered safe because
(Points : 3)
the compiler is very smart about types.
it is safe to assume a parent can do everything a child
can do.
downcasting can only be done on upcasted objects.
downcasting is not considered safe.
Question 19. 19. If unsure whether to use inheritance or
composition, use (Points : 3)
inheritance, because it saves the most typing.
inheritance, because C++ supports multiple
inheritance.
6. composition, because it gives programmers the most
options.
composition, because it is more efficient than
inheritance.
Question 20. 20. Creating classes in separate .h and .cpp
files is good because (Points : 3)
moving code to separate files is good design
(separation of concerns).
separating declaration from definition allows
decoupling of dependencies.
many smaller files are easier to maintain by teams of
programmers.
All of the above
Question 21. 21. When using the virtual keyword, C++
can detect the type of an object by using (Points : 3)
Compile Time Type Information.
dynamic_cast.
a "constructor inference" pattern.
C++ does not support any kind of reflection.
Question 22. 22. Passing pointers by reference (e.g., "(int
* & arg)") is possible but limited, because (Points : 3)
NULL cannot be passed as a valid pointer by
reference.
a raw address (&variable) cannot be passed as a
valid pointer by reference.
r-values cannot be passed as pointers by reference.
All of the above
7. Question 23. 23. Stack memory is where (Points : 3)
global variables and raw machine code are stored.
local variables and execution of instructions are kept
track of.
dynamic memory is allocated to.
None of the above
Question 24. 24. A compiler will put sentinel values into
memory to (Points : 3)
help detect array out-of-bound errors.
keep track of how many times a function recurses.
stop bad functions from being executed.
prevent memory leaks.
Question 25. 25. Virtual functions have a cost when
compared to normal (statically bound) functions;
specifically, they are (Points : 3)