Question: 1. Which of the following is a function declaration for a function Sum having two timehm parameters ( time1 and time2 ) and returning a
1.
Which of the following is a function declaration for a function Sum having two timehm parameters (time1 and time2) and returning a timehm parameter?
Select one:
a. timehm Sum(timehm time1, timehm time2);
b. timehm Sum(time1 timehm, time2 timehm);
c. void Sum(timehm time1, timehm time2, timehm& time3);
d. Not possible. Functions cannot have structs as parameters or return types.
2.
Which of the following describes this code?
string str = Center me!;
cout << setw(20) << left << right << str;
Select one:
a. Center-aligned over 20 spaces.
b. Left-aligned over 20 spaces.
c. Right-aligned over 20 spaces.
d. None of the above.
3.
What is the output of the following code?
class Person {
public:
Person() { name = "John"; }
void SetName(string n) { name = n; }
void PrintName() const
{ cout << name << ; }
private:
string name;
};
int main() {
Person p1;
p1.PrintName();
p1.SetName("Travis");
p1.PrintName();
return 0;
}
Select one:
a. Travis
b. John John
c. Travis Travis
d. John Travis
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
