Question
75. What will be the output of the following code snippet? map scores; scores[Diana] = 86; scores[Mark] = 80; if (scores[Fred] < 0) { cout
75. What will be the output of the following code snippet?
mapscores; scores["Diana"] = 86; scores["Mark"] = 80; if (scores["Fred"] < 0) { cout << "Error "; } for (auto it = scores.begin(); it != scores.end(); it++) { cout << " " << it->first << ":" << it->second; }
Group of answer choices
Error Diana:86 Fred:0 Mark:80
Error Diana:86 Mark:80
Diana:86 Mark:80
Diana:86 Fred:0 Mark:80
81. What is the output of the following program?
#includeusing namespace std; class Car { public: double get_speed() const; Car(); Car(double dspeed); private: double speed; }; Car::Car() { speed = 0; } Car::Car(double dspeed) { speed = dspeed; } double Car::get_speed() const { return speed; } int main() { Car c1; Car c2(5); double sum_speed = 0; sum_speed = c1.get_speed() + c2.get_speed(); cout << sum_speed << endl; return 0; }
Group of answer choices
5
The answer cannot be determined because the speed of c1 has not been initialized.
0
Nothing is printed because the program doesn't compile.
84. Examine the following code snippet.
class Product { public: Product(); Product(double price); Product(string d_description); Product(string d_description, double price); void set_price(double price); void set_description(string d_description); string get_description() const; void display_product() const; private: string description; double product_price; }; class SalesOrder { public: SalesOrder(string customer_name, string d_description, double price); void display_sales_order() const; private: Product prdt; string customer; }; class RetailShop { public: RetailShop(); void set_sales_order(SalesOrder new_SalesOrder); SalesOrder get_sales_order(); private: SalesOrder sales_order; };
Which of the following statements is correct?
Group of answer choices
The Product class aggregates the SalesOrder class.
The Product class aggregates the RetailShop class.
The SalesOrder class aggregates the RetailShop class.
The SalesOrder class aggregates the Product class.
85. Your text says the first two steps for implementing a class are
I. Get an informal list of the responsibilities of the object
II. Specify the public interface
III. Document the public interface
IV. Determine data members
Group of answer choices
III, IV
I, II
II, III
II, III
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started