Question: 1)What is wrong with the declaration? char &m; Answers: a. The address of a variable cannot be found when its declared. b. The variable is
1)What is wrong with the declaration? char &m;
Answers:
a. The address of a variable cannot be found when its declared.
b. The variable is a pointer and a pointer is declared using a *.
c. It is not initialized
2) Assume the following:
class test { private: int x, y;
public: int sum(); void print();
test(); test(int, int);
};
//returns the sum of the private data members //prints the values of the private data members:
// the x value followed by the y value
//initializes the private data members to 0 //initializes the private data members to the passed in values:
// x = value of the first argument // y = value of the second argument
int main() { test t1 = test(); test t2 = test( 240, 360 ); }
Which of the following lines of code will create an object with the value 465 for y and 0 for x?
Answers:
a. test t3 = test( 0, 465 );
b. test t3 = test( 465 );
c. test t3 = test( 465, 0 );
d. test t3 = test( , 465 );
3)
Assume the following:
0 out of 1 points
class test { private: int x, y;
public: int sum(); void print();
test(); test(int, int);
};
//returns the sum of the private data members //prints the values of the private data members:
// the x value followed by the y value
//initializes the private data members to 0 //initializes the private data members to the passed in values:
// x = value of the first argument // y = value of the second argument
int main() { test t1 = test(); test t2 = test( 240, 360 );
}
What output will be produced by the following code? cout << The sum is << t2.sum();
Answers:
a. The sum is
b. The sum is ZZZ, where ZZZ is a garbage values because no values were passed in when the sum method was called.
c. The sum is 0 d. The sum is 600
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
