Question
1. Which of the options below is equivalent to this->y? A. &(this.y) / B. *(this.y) / C. (&this).y / D. (*this).y --------------------------------------------- 2. Suppose a
1. Which of the options below is equivalent to this->y?
A. &(this.y) / B. *(this.y) / C. (&this).y / D. (*this).y
---------------------------------------------
2. Suppose a program has a Printer class:
class Printer
{
private:
int amount_of_ink;
};
Which of the options below is considered a dangerous reference return?
(A) Printer* set_amount_of_ink(int);
(B) Printer& set_amount_of_ink(int);
(C) int& set_amount_of_ink(int);
(D) int* set_amount_of_ink(int);
--------------------------------------------------
3.
class Car
{
Public:
Car(const string &ma, const string &mo, int ye)
{ make = ma; model = mo; year = ye;
cout< } ~Car() { cout< private: string make; string model; int year; }; class Person { Person(const string &n, int a, const Car&c) { name = n; age = ag; car= c; cout< } ~Person() { cout< string name; int age; Car car; }; int main() { Car c(Toyota, Corolla, 2017); Person p(James Bond, 45, c); } What is the output of this program? (A) CAR CON CAR CON PERSON CON PERSON DES CAR DES (B) CAR CON PERSON CON PERSON DES CAR DES (C) CAR CON CAR CON PERSON CON PERSON DES CAR DES CAR DES (D) CAR CON PERSON CON PERSON DES CAR DES CAR DES ------------------------------------------ 4. Which access specifier applies to friend functions? (A) public (B) private (C) protected (D) none of them ------------------------------------------- 5. << True and False>> A) A destructor receives no parameters. B) A destructor does not return a value.
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