NEW
Font size
WorksheetsITPPA1
Total questions: 21
Worksheet time: 16mins
What is a correct syntax to output "Hello World" in C++?
print ("Hello World");
Console.WriteLine("Hello World");
System.out.println("Hello World");
cout << "Hello World";
How do you insert COMMENTS in C++ code?
// This is a comment
# This is a comment
/* This is a comment
Which data type is used to create a variable that should store text?
String
myString
string
Txt
How do you create a variable with the numeric value 5?
int x = 5;
x = 5;
double x = 5;
num x = 5
How do you create a variable with the floating number 2.8?
byte x = 2.8
double x = 2.8;
int x = 2.8;
x = 2.8;
Which operator is used to add together two values?
The + sign
The * sign
The & sign
The value of a string variable can be surrounded by single quotes.
TRUE
FALSE
Which header file lets us work with input and output objects?
#include <iosstring>
#include <stream>
#include <inputstr>
#include <iostream>
Which operator can be used to compare two values?
=>
<=
==
<>
How do you create a function in C++?
functionName[]
functionName()
(functionName)
functionName.
How do you call a function in C++?
functionName();
(functionName);
functionName;
functionName[];
Which operator is used to multiply numbers?
#
%
*
x
How do you start writing an if statement in C++?
if x > y:
if x > y then:
if (x > y)
How do you start writing a while loop in C++?
while x > y {
x > y while {
while (x > y)
while x > y:
Which keyword is used to return a value inside a method?
break
void
get
return
Which statement is used to stop a loop?
stop
exit
return
break
Which of the following is the correct syntax for a function declaration?
int function();
function int();
int function{};
int function[];
What is the output of the below program?
Hello
World
Hello, World!
Error
What keyword is used to declare a function that does not return a value?
int
float
void
return
In the following function declaration, how many formal parameters are there?
1
0
2
All of the Above
What is the output of the below function with default arguments?
2
5
3
Error
