Object Oriented Programming Using C Plus Plus - Study Mode

[#331] The two statements that can be used to change the flow of control are
Correct Answer

(A) if and switch

[#332] If p and q are assigned the values 2 and 3 respectively then the statement p = q++
Correct Answer

(C) assigns a value 3 to p

[#333] Which of the following is the insertion operator?
Correct Answer

(B) <<

Explanation

Solution: The insertion operator in C++ is used to insert data into an output stream, such as cout . Option A: >> - This is the extraction operator, used to extract data from an input stream, such as cin . Option B: << - This is the insertion operator, used to insert data into an output stream, such as cout . Option C: // - This denotes a single-line comment in C++. Option D: / - This denotes the beginning of a multi-line comment in C++, which ends with / . Option E: both (a) and (b) - This is incorrect because only Option B: << is the insertion operator. Therefore, the correct answer is Option B: << .

[#334] If you want only one memory location to be reserved for a class variable, no matter how many objects are instantiated, you should declare the variable as
Correct Answer

(A) static

[#335] To use a template class member function, use the ________ with the instantiation
Correct Answer

(B) dot operator