Question:

Which one of the following is used with cout as an operator ?

Show Hint

A simple mnemonic for C++ streams: \(\text{cout <<}\) "points" the data outwards to the console. \(\text{cin >>} \)"points" the data inwards from the keyboard to a variable.

  • $ \ll $
  • $ \gg $
  • >
  • & Lt;
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Identify \( \texttt{cout} \) in C++.
\( \texttt{cout} \) is the standard output stream object in C++. It is used to print output to the console.

Step 2: Identify the operator used with \( \texttt{cout} \).
The stream insertion operator, \( \texttt{<<} \), is used to “insert” data into the output stream.
For example: \( \texttt{std::cout << "Hello, World!";} \)

Step 3: Analyze the other options:

  • (B) \( \texttt{>>} \): Stream extraction operator, used with \( \texttt{cin} \) to get input from the user.
  • (C) \( \texttt{>} \): Greater-than comparison operator.
  • (D) \( \texttt{<} \): Less-than comparison operator.

Conclusion: \( \texttt{<<} \) is the operator used with \( \texttt{cout} \).

Was this answer helpful?
0
0