?
Which of the following is the insertion operator?
Answer & Solution
Correct Answer:
Option
B
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: <<.
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: <<.
Join the Discussion
Login to post a comment or share your explanation.
Login