Recall & Review
beginner
What is
cout used for in C++?cout is used to display output on the screen, like printing messages or values.
Click to reveal answer
beginner
How do you print the text
Hello, World! using cout?Use std::cout << "Hello, World!" << std::endl; to print the text and move to a new line.
Click to reveal answer
beginner
What does
<< mean when used with cout?<< is called the insertion operator. It sends data to cout to be printed.
Click to reveal answer
beginner
How do you print multiple items with
cout?Use << to chain items, like std::cout << "Age: " << age << std::endl;.
Click to reveal answer
beginner
Why do we use
std::endl with cout?std::endl moves the cursor to the next line and flushes the output buffer, ensuring the output appears immediately.
Click to reveal answer
What does
cout do in C++?✗ Incorrect
cout is used to print output to the screen.
Which operator is used with
cout to display data?✗ Incorrect
The insertion operator << sends data to cout for output.
How do you print a new line after output using
cout?✗ Incorrect
std::endl moves to a new line and flushes the output.
What will this code print?<br>
std::cout << "Age: " << 25 << std::endl;✗ Incorrect
The code prints the text "Age: " followed by the number 25, then a new line.
Which header file must be included to use
cout?✗ Incorrect
The <iostream> header provides cout and other input/output features.
Explain how to use
cout to print a message and a number on the same line.Think about chaining multiple items with <<
You got /5 concepts.
Describe the role of
std::endl when used with cout.It helps move to the next line and ensures output shows up right away
You got /4 concepts.