Vidyalelo
Computer Science · Q104

Object Oriented Programming Using C++

Engineering and GATE · Computer Science · question 104

Q104

Which of the following is the insertion operator?

A.
>>
B.
<<
Answer
C.
//
D.
/*
E.
both (a) and (b)

Answer: Option B

Solution

Answer: Option B
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: <<.