Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 24 pages
Exam (elaborations)

COP 3330 EXAM 2 MOCK TEST WITH ANSWER RATIONALES 2026

Document preview thumbnail
Preview 3 out of 24 pages

COP 3330 EXAM 2 MOCK TEST WITH ANSWER RATIONALES 2026

Content preview

COP 3330 EXAM 2 MOCK TEST WITH
ANSWER RATIONALES 2026


◉ If there is no initialization, what is being used?
Answer: The default constructor


◉ Are you allowed to call constructors in the bounds ( {} ) of an
Array?
Answer: True


Example:
Fraction nums[3] = { Fraction(2,3), Fraction(6), Fraction() };


◉ Can an Array be member data of a class?
Answer: True


◉ What should you use if an array isn't always full?
Answer: Use a tracking variable to track how many slots are being
used


◉ What are the benefits of having array member data?

,Answer: It is good for using types that use arrays, but it also adds in
safeties, like boundary checking, in member functions


◉ What are the two categories of Memory Allocation?
Answer: Static and Dynamic memory


◉ What happens with Static Memory allocation?
Answer: Static -- compile time. size and types known in advance
You set a specific size that cannot be changed after compiling stage


◉ What happens with Dynamic Memory allocation?
Answer: Dynamic -- run time. sizes and amounts can be set while
program running
Size and amounts are unknown before runtime, but can be changed
to fit the accurate size


◉ How do you create dynamic space?
Answer: You can create dynamic space with the "new" operator


Always use the TYPE after the word "new" (Ex: new INT)


◉ What does the new operator do past creating dynamic space?

, Answer: It returns the address of the allocated space, which can
(and should) use a pointer to store the address


◉ What can be dynamically allocated?
Answer: basic variables, objects, and arrays


Examples:
double* dptr = new double; int * list = new int[size]; Fraction* fptr1
= new Fraction; // uses default constructor Fraction* fptr2 = new
Fraction(1,2); // constructor with params Date* birthdayList = new
Date[20]; // array of Date objects


◉ Can you pass in a dynamically allocated object as a parameter in a
constructor?
Answer: True


◉ How do you deallocate dynamic memory?
Answer: use the "delete" operator


If you use a pointer, apply "delete" to the pointer, and it de-allocates
the target (Ex: delete pointer;)


If you use a dynamic array, use "delete [ ] pointername"

Document information

Uploaded on
August 4, 2026
Number of pages
24
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

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

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
EddieJessup
3.0
(1)
Sold
16
Followers
1
Items
7349
Last sold
2 days 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