Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

chapter 2 Input and Output Statements in C++ q3

Total questions: 5

Worksheet time: 3mins

Name
Class
Date
1.

Which object is used in C++ to display output on the screen?

a)

cin

b)

cout

c)

print

d)

display

2.

What is the correct syntax for getting user input in C++?

a)

input >> x;

b)

cin > x;

c)

cin >> x;

d)

x >> cin;

3.

What does endl do in the output statement?

a)

Ends the program

b)

Starts a new function

c)

Adds a tab space

d)

Moves to a new line

4.

Which header file must be included to use cin and cout?

a)

<cstdio>

b)

<iostream>

c)

<stdio.h>

d)

<stdlib.h>

5.

What is the correct way to output "Hello, World!" in C++?

a)

cout << Hello, World!;

b)

print("Hello, World!");

c)

cout << "Hello, World!";

d)

Console.Write("Hello, World!");