Mark the following statements as true or false. By default, when an object is assigned to another, each member of one object is copied to
Mark the following statements as true or false.
By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object. *
1 point
True
False
A function can return a value of type class. *
1 point
True
False
A class can have more than one constructor. *
1 point
True
False
Constructors guarantee that the member variables are initialized when an object is declared. *
1 point
True
False
A class member is accessed using the class variable name, followed by the scope resolution operator (::), followed by the member name. *
1 point
True
False
Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true. *
1 point
True
False
The member functions of a class must be public. *
1 point
True
False
The member variables of a class must be of the same type. *
1 point
True
False
For each static variable of a class, C++ allocates only one memory space. All objects of the class refer to the same memory space. *
1 point
True
False
While creating the array of objects, we are passing the constructor with values as array arguments and the variables a, b will be initialized with the corresponding values. *
1 point
True
False
A public static member, function or variable, of a class can be accessed using the class name and the scope resolution operator. *
1 point
True
False
A constant member function of a class can modifies the member variables of the class. *
1 point
True
False
Both constructors and destructors can have parameters. *
1 point
True
False
A class can have more than one destructor. *
1 point
True
False
A member function of a class that modifies the value(s) of the member variable(s) is called a mutator function *
1 point
True
False
Encapsulation means Binding data members and member functions in a single unit. *
1 point
True
False
Friend function declared and defined outside the class. *
1 point
True
False
‘this’ pointer can point to another class. *
1 point
True
False
A member function of a class that accesses and modify the value(s) of the member variable(s) is called an accessor function. *
1 point
True
False
When we have a requirement to access the internal implementation of a class (private member) without exposing the details by making the public, we go for friend functions. *
1 point
True
False
Multiple Choice Questions
We can modify the data members of constant object by keyword ____. *
1 point
a. modify
b. const
c. mutable
d. mutator
Which of the following characters appears before a destructor’s name? *
1 point
a. #
b. !
c. ~
d. $
Which variable(s) is/are accessible in main() function? *
1 point
Captionless Image
x
y
Option 3
y and z
Assume that Honda is an instance of the Car class, and that Car class has a member function named run. Which of the following is a correct call to the run function? *
1 point
a. Honda->run;
b. Honda.run();
c. run()
d. Honda()
Write statement to print value of operand? *
1 point
Captionless Image
a. cout<<var;
b. cout<<::var;
c. Cannot access var inside class member function.
d. Both a and b
Where a class member function can be declared? *
1 point
a. Inside the class definition
b. Outside of the class definition
c. Both 1 and 2
d. None
It allows the copy field, which is done by field from one object to another. *
1 point
a. Shallow copy
b. Deep copy
c. Both a & b
d. None
Descriptive Questions
Design a class memberType. *
4 points
Captionless Image
Step by Step Solution
3.37 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
Solution are u...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