wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ITPPA1

Total questions: 21

Worksheet time: 16mins

Name
Class
Date
1.

What is a correct syntax to output "Hello World" in C++?

a)

print ("Hello World");

b)

Console.WriteLine("Hello World");

c)

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

d)

cout << "Hello World";

2.

How do you insert COMMENTS in C++ code?

a)

// This is a comment

b)

# This is a comment

c)

/* This is a comment

3.

Which data type is used to create a variable that should store text?

a)

String

b)

myString

c)

string

d)

Txt

4.

How do you create a variable with the numeric value 5?

a)

int x = 5;

b)

x = 5;

c)

double x = 5;

d)

num x = 5

5.

How do you create a variable with the floating number 2.8?

a)

byte x = 2.8

b)

double x = 2.8;

c)

int x = 2.8;

d)

x = 2.8;

6.

Which operator is used to add together two values?

a)

The + sign

b)

The * sign

c)

The & sign

7.

The value of a string variable can be surrounded by single quotes.

a)

TRUE

b)

FALSE

8.

Which header file lets us work with input and output objects?

a)

#include <iosstring>

b)

#include <stream>

c)

#include <inputstr>

d)

#include <iostream>

9.

Which operator can be used to compare two values?


a)

=>

b)

<=

c)

==

d)

<>

10.

How do you create a function in C++?

a)

functionName[]

b)

functionName()

c)

(functionName)

d)

functionName.

11.

How do you call a function in C++?

a)

functionName();

b)

(functionName);

c)

functionName;

d)

functionName[];

12.

Which operator is used to multiply numbers?

a)

#

b)

%

c)

*

d)

x

13.

How do you start writing an if statement in C++?

a)

if x > y:

b)

if x > y then:

c)

if (x > y)

14.

How do you start writing a while loop in C++?

a)

while x > y {

b)

x > y while {

c)

while (x > y)

d)

while x > y:

15.

Which keyword is used to return a value inside a method?

a)

break

b)

void

c)

get

d)

return

16.

Which statement is used to stop a loop?

a)

stop

b)

exit

c)

return

d)

break

17.

Which of the following is the correct syntax for a function declaration?

a)
  • int function();

b)
  • function int();

c)

int function{};

d)
  • int function[];

18.

What is the output of the below program?

a)
  • Hello

b)
  • World

c)
  • Hello, World!

d)
  • Error

19.

What keyword is used to declare a function that does not return a value?

a)
  • int

b)
  • float

c)
  • void

d)

return

20.

In the following function declaration, how many formal parameters are there?

a)

1

b)

0

c)

2

d)

All of the Above

21.

What is the output of the below function with default arguments?

a)

2

b)

5

c)

3

d)

Error