Question: please provide correct answers: 1. Can two classes contain member functions with the same name? A. No. B. Yes, but only if the two classes

please provide correct answers:

1. Can two classes contain member functions with the same name?

A. No.

B. Yes, but only if the two classes have the same name.

C. Yes, but only if the main program does not declare both kinds

D. Yes, this is always allowed.

2. Here is a small function definition:

void f(int i, int &k)

{

i = 1;

k = 2;

}

Suppose that a main program has two integer variables x and y, which are given the value 0. Then the main program calls f(x,y); What are the values of x and y after the function f finishes?

A. Both x and y are 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.

3. Here is a function prototype and some possible function calls:

int day_of_week(int year, int month = 1, int day = 1);

// Possible function calls:

cout << day_of_week( );

cout << day_of_week(1995);

cout << day_of_week(1995, 10);

cout << day_of_week(1995, 10, 4);

How many of the function calls are legal?

A. None of them are legal

B. 1 of them is legal

C. 2 of them are legal

D. 3 of them are legal

E. All of them are legal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!