Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The usual purpose of a constructor is to initialize the member variables of a class. Select one: a. FALSE b. TRUE Question 2 Not yet

The usual purpose of a constructor is to initialize the member variables of a class. Select one: a. FALSE b. TRUE Question 2 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In C++, programmers can use a class to create a large number of variables of that type. Select one: a. FALSE b. TRUE Question 3 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Every object stores its own individual copy of all the member variable's defined by its class. Select one: a. TRUE b. FALSE Question 4 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Lacking a public or private declaration, members or methods in a class will be treated as if they were marked public. Select one: a. FALSE b. TRUE Question 5 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In this course, we compared a class many times to the everyday things we interact with. In this way, we compared a class method to Select one: a. the brand (supplier) who made it b. the driver (consumer) who used it c. the data (properties) things have d. the actions (verbs) things do Question 6 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In this course, we compared a class many times to the everyday things we interact with. In this way, we compared int main() code which interacts with a class and its methods to Select one: a. the data (properties) things have b. the brand (supplier) who made it c. the actions (verbs) things do d. the driver (consumer) who used it Question 7 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In this course, we compared a class many times to the everyday things we interact with. In this way, a class and an object are similar to Select one: a. a fishtank and a particular fish inside a fishtank b. a student in a particular course and the teacher of that course c. the blueprints for a house (which can be used to create many different similar houses) and a house d. an integer variable and a double variable Question 8 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the statements below is correct about std? Select one: a. std is an Object b. std is a Namespace c. std is a Method of an Object d. std is a Class Question 9 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text A class' constructors are all defined to return void. Select one: a. FALSE b. TRUE Question 10 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text For every class, C++ will supply a single, no-argument constructor whose implementation will be empty. Select one: a. FALSE b. TRUE Question 11 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text The mutator ("setter") methods of a class can never be marked with the const modifier. Select one: a. TRUE b. FALSE Question 12 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Within a single class definition (.h file), the public and private access modifiers can be listed only one time. Select one: a. FALSE b. TRUE Question 13 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text The accessor ("getter") methods of a class are typically marked with the const modifier. Select one: a. TRUE b. FALSE Information Not flaggedFlag question Information text The next few questions deal with the class definition (.h file) shown below. The class Blockbuster represents a popular Hollywood movie. #include using namespace std; namespace cs52 { class Blockbuster{ public: Blockbuster( int length, string title, string star ); friend bool equal( const Blockbuster & b1, const Blockbuster & b2 ); int getLength(); string getTitle(); string getPlace(); void setTitle( string title ); void setPlace( string place ); void setLength( int length ); private: int my_Length; // feature length in minutes string my_Title; // feature title string my_Star; // leading actor or actress }; } Question 14 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the following parts of your program have access to the member variable my_Title directly without calling a method? Select one: a. Methods within classes other than Blockbuster b. Driver code like void main() {...} c. All of the above choices have access to the variable my_Title directly without calling a method d. Only methods within the class Blockbuster itself Question 15 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Based on the Blockbuster class shown above, can the friend function equal() be marked const? Select one: a. Not enough information has been provided to answer this question b. Yes c. No d. It depends on exactly what the method equal does Question 16 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Suppose you decide to overload the << operator in the class Blockbuster. What is the valid function declaration for the operator << that belongs in the class definition (.cpp) file above? Select one: a. void ostream& operator <<(ostream& outs, const Blockbuster & b) b. ostream& operator <<(ostream& outs, const Blockbuster & b) c. ostream& Blockbuster::operator <<(ostream& outs, const Blockbuster & b) d. ostream operator <<(const Blockbuster & b) Question 17 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Suppose you decide to overload the == operator in the class Blockbuster. What is the valid function declaration for the operator == that belongs in the class implementation (.cpp) file shown above? Select one: a. bool operator Blockbuster::==(const Blockbuster & b1, const Blockbuster & b2) b. bool operator ==(const Blockbuster & b1, const Blockbuster & b2) c. operator ==(const Blockbuster & b1, const Blockbuster & b2) d. bool operator ==(const Blockbuster & b1 ) Information Not flaggedFlag question Information text The next few questions deal with the class definition (.h file) shown below. The class SummerVacation represents a trip taken somewhere. #include using namespace std; class SummerVacation { void pack(); public: int getLength(); double getCost(); string getPlace(); SummerVacation( int length, string place, double cost ); private: void relax(); int my_Length;//days traveled string my_Place; //place traveled to double my_Cost; //how much was spent }; Question 18 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In the class SummerVacation, how many constructors does it define? Select one: a. 1 b. 0 c. 2 d. 4 Question 19 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In the class SummerVacation, how many private member variables does it define? Select one: a. 4 b. 0 c. 5 d. 3 Question 20 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In the class SummerVacation, how many public member variables does it define? Select one: a. 3 b. 2 c. 0 d. 1 Question 21 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the statements below is true about the method getCost? Select one: a. It is an accessor method of the class SummerVacation. b. It is a method which cannot be called from driver code. c. It is a method that requires an argument be passed by the calling code. d. None of the above is correct about the method getCost. e. It is a mutator method of the class SummerVacation. Question 22 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the statements below is true about the constructor of the class SummerVacation? Select one: a. The constructor for the class SummerVacation requires exactly one argument b. None of the above is correct about the constructor of the class SummerVacation c. There is only one public constructor for the class SummerVacation d. The class SummerVacation provides multiple, overloaded constructor methods Question 23 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the statements below is true about the method pack? Select one: a. It is a private method of the class SummerVacation. b. It is a public method of the class SummerVacation. c. It is a method which can be called from driver code. d. It is a method that requires an argument be passed by the calling code. e. None of the above is correct about the method pack. Question 24 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text In the class SummerVacation, how many private methods variables does it define? Select one: a. 1 b. 3 c. 2 d. 4 Question 25 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the statements below is correct about cin? Select one: a. cin is a Namespace b. cin is an Object c. cin is a Method of an Object d. cin is a Class Question 26 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the statements below is correct about cout? Select one: a. cout is a Method of an Object b. cout is an Object c. cout is a Class d. cout is a Namespace Question 27 Not yet answered Marked out of 2.00 Not flaggedFlag question Question text Which of the following are correct in describing the statement: #include "SodaCan.h" and what it does? Select one: a. All of the choices above are correct b. this statement is used by any file that wants to work with the classes declared inside that SodaCan.h file c. this is a preprocessor command that is found at the top of other C++ files d. this statement performs textual substitution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

Explain methods of metal extraction with examples.

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago