Access Millions of academic & study documents

All questions are based on C++1) In C++, arrays are passed by refe

Content type
User Generated
Showing Page:
1/8
All questions are based on C++
1) In C++, arrays are passed by reference in functions.
A. true
B. false
2) In C++, two functions with the same function signature
but different return type can be overloaded.
A. true
B. false
3) In C++, class members are public by default.
A. true
B. false
4) In C++, all operators can be overloaded for user-defined
data types.
A. true
B. false
5) A friend function of a class can access the private
member variables of that class.
A. true
B. false
6) Protected members of a public base class become
public members of the derived class.
A. true
B. false
7) The base class constructor is called after the derived
class constructor.
A. true
B. false
8) A member function of a derived class may have the
same name as a member function of the base class.
A. true
B. false
9) C++ allows you to pass an object of a derived class as
an argument to a function where the parameter is of base
class type.
A. true

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/8
B. false
10) Any mathematical operation, including multiplication
and division, may be performed on a pointer.
A. true
B. false
11) In C++, array names are constant pointers.
A. true
B. false
12) In dynamic binding, the necessary code to call a
specific function is generated by the compiler during
compile-time.
A. true
B. false
13) Here is a function definition:
void func(int& i, int k)
{
i = 1;
k = 2;
}
Suppose that a main program has two integer variables x
and y and both are given the value 0. Then the main
program calls func(x,y); What are the values of x and y
after the function func finishes?
A. Both x and y still 0.
B. x is now 1, but y is still 0.
C. x is still 0, but y is now 2.
D. x is now 1, and y is now 2.
14) Here is a function prototype and some possible
function calls:
int sumOfThreeNumbers(int, int = 20, int = 30);
// Possible function calls:
cout << sumOfThreeNumbers ();
cout << sumOfThreeNumbers (23, 15);
cout << sumOfThreeNumbers (23, , -30);
cout << sumOfThreeNumbers (23, 15, -30);
How many of the above function calls are legal?

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/8

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 8 pages?
Access Now
Unformatted Attachment Preview
All questions are based on C++ 1) In C++, arrays are passed by reference in functions. A. true B. false 2) In C++, two functions with the same function signature but different return type can be overloaded. A. true B. false 3) In C++, class members are public by default. A. true B. false 4) In C++, all operators can be overloaded for user -defined data types. A. true B. false 5) A friend function of a class can access the private member variables of that class. A. true B. false 6) Protected members of a public base class become public members of the derived class. A. true B. false 7) The base class constructor is called after the derived class constructor. A. true B. false 8) A member function of a derived class may have the same name as a member function of the base class. A. true B. false 9) C++ allows you to pass an object of a derived class as an argument to a function where the parameter is of base class type. A. true B. false 10) Any mathematical operation, including multiplication and division, may be performed on a pointer. A. true B. false 11) In C++, array names are constant pointers. A. true B. false 12) In dynamic binding, the necessary code to call a specific function is generated by the compiler during compile-time. A. true B. false 13) Here is a function definition: void func(int& i, int k) { i = 1; k = 2; } Suppose that a main program has two integer variables x and y and both are given the value 0. Then the main program calls func(x,y); What are the values ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4