wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Diagnostico sobre C++ Noveno

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the default file extension for a C++ program?

a)

.c

b)

.cpp

c)

.java

d)

.py

2.

What keyword is used to define a constant in C++?

a)

define

b)

const

c)

constant

d)

let

3.

Which of the following options prints "Hello, World!" in C++?

a)

print("Hello, World!");

b)

cout << "Hello, World!";

c)

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

d)

System.out.println("Hello, World!");

4.

¿Cuál de los siguientes encabezados es necesario para usar cout y cin en C++?

a)

b)

c)

d)

5.

Which of the following options correctly defines an integer variable called numero with the value 10?

a)

int numero = 10;

b)

numero = 10;

c)

int 10 = numero;

d)

var numero = 10;

6.

What operator is used to obtain the remainder of a division in C++?

a)

/

b)

*

c)

%

d)

^

7.

What is the result of the following expression in C++? int x = 5; x++; cout << x;

a)

4

b)

5

c)

6

d)

Error

8.

Which of the following options correctly represents a conditional structure in C++?

a)

if x > 10 { cout << "Greater"; }

b)

if (x > 10) { cout << "Greater"; }

c)

if x > 10: cout << "Greater";

d)

if x > 10 then cout << "Greater";

9.

What loop is used when the number of times the block of code will be executed is not known in advance?

a)

for

b)

while

c)

switch

d)

do-while

10.

Which of the following options is correct for declaring a function in C++ that returns an integer?

a)

void myFunction();

b)

int myFunction() { return 0; }

c)

myFunction() -> int { return 0; }

d)

function int myFunction() { return 0; }