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 2 fuera de 7 páginas
Examen

COP 3330 Myers Test 1 Exam with complete solutions latest version.

Document preview thumbnail
Vista previa 2 fuera de 7 páginas

COP 3330 Myers Test 1 Exam with complete solutions latest version.

Vista previa del contenido

BRAINSCAPE1




COP 3330 Myers Test 1 Exam with
complete solutions latest version




Which of the following statements is NOT TRUE regarding classes and objects?

A. Member data of a class is in scope for all the member functions of the class
B. Member functions are called by using the format: object.function()
C. The public section of a class must be listed before the private section
D. Member data of a class can be public or private - CORRECT ANSWER-The public
section of a class must be listed before the private section

For a class called Yadda, which of the following is a default constructor?

A. Yadda (int a = 10);
B. Yadda Yadda();
C. Yadda(int a, int b, = 20);
D. void Yadda(); - CORRECT ANSWER-Yadda (int a = 10);

Which of the following would result in a compile stage error?

A. Having two definitions of a function, each one in a separate code file
B. Doing the division (x/y), where x and y are integers and y is 0
C. Passing an int argument to a function that expects a parameter of type double
D. Calling a function before it is declared - CORRECT ANSWER-Calling a function
before it is declared

In a class, the purpose of a destructor member function is... - CORRECT ANSWER-to
do any final clean-up tasks on an object before it is deallocated

Which of the following statements about operator overloading is TRUE?

A. Operator overloading can set a new precedence level for an operator
B. Operator overloading cannot be used to create new operator symbols
C. A binary operator overload cannot use a built-in type as an operand
BRAINSCAPE1

, BRAINSCAPE1




D. All C++ operators can be overloaded - CORRECT ANSWER-Operator overloading
cannot be used to create new operator symbols

Which of the following describes an implementation of the composition ('has-a')
relationship?

A. Class Tree calls the Grow() function of class Leaf
B. An object of type Rock is declared as member data of class Quarry
C. An object type Cube is declared as member data of class Cube
D. Class Chair is defined inside class Room - CORRECT ANSWER-An object of type
Rock is declared as member data of class Quarry

If Cat is a class with a default constructor and a constructor with two int parameters,
which of the following is a valid declaration of an array of objects of type Cat?

A. Cat list[4] = {Cat(), Cat(4,8), Cat(1,6)};
B. Cat list[] = {Cat(5), Cat(15), Cat()};
C. Cat* list = {Cat1, Cat2, Cat3(1,2)};
D. Cat list[]; - CORRECT ANSWER-Cat list[4] = {Cat(), Cat(4,8), Cat(1,6)};

Which of the following is not a valid operator overload prototype?

A. bool operator< (Box x, Box y);
B. Box operator* (const Box& x, int y);
C. Box operator+ (double x, double y);
D. Box operator== (const Box& ) const; - CORRECT ANSWER-Box operator+ (double
x, double y);

If w1 and w2 are objects of type Weight, which of the following expressions contains a
call to an operator that cannot be overloaded as a member function of class Weight?

A. w1 - w2
B. w1 < 5
C. w1++
D. 10 + w2 - CORRECT ANSWER-10 + w2

Which of the following is a correct way to declare a member function of a class so that it
will be allowed to change the member data of the calling object?

A. int Modify(double& x) const;
B. const int Modify(const double& x);
C. int Modify(const double& x) const;
D. friend int Modify(double& x); - CORRECT ANSWER-const int Modify(const double&
x);

T/F

BRAINSCAPE1

Información del documento

Subido en
11 de noviembre de 2025
Número de páginas
7
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$14.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.
BRAINSCAPE1
4.4
(20)
Vendido
141
Seguidores
15
Artículos
11139
Última venta
1 semana 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