Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 3 fuera de 24 páginas
Examen

COP 3330 EXAM 2 MOCK TEST WITH ANSWER RATIONALES 2026

Document preview thumbnail
Vista previa 3 fuera de 24 páginas

COP 3330 EXAM 2 MOCK TEST WITH ANSWER RATIONALES 2026

Vista previa del contenido

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"

Información del documento

Subido en
4 de agosto de 2026
Número de páginas
24
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$13.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
EddieJessup
3.0
(1)
Vendido
16
Seguidores
1
Artículos
7349
Última venta
2 días hace


Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes