WorksheetsC++ Quiz 05/05/2023
Total questions: 20
Worksheet time: 10mins
Which of the following is an example of a function in C++?
if statement
for loop
switch case
cout statement
Which of the following is used to define a function in C++?
def
fun
void
int
Which of the following is used to switch between different cases in C++?
for loop
while loop
do while loop
switch case
Which of the following loops will execute at least once in C++?
for loop
while loop
do while loop
switch case
Which of the following is used to comment a single line of code in C++?
//comment
/*comment
*/comment
#comment
Which of the following is used to comment multiple lines of code in C++?
//comment
/*comment*/
*/comment*/
#comment
Which of the following is used to declare a variable in C++?
var
val
const
int
What is a function in C++?
A block of code that can be executed repeatedly
A variable that stores a value
A keyword that marks the end of a statement
A structure used for storing data
What is the syntax for declaring a function in C++?
function_name {arguments}
function_name (arguments)
function_name [arguments]
function_name <arguments>
Which logic gate returns true only if both inputs are true?
AND gate
OR gate
NOT gate
XOR gate
What are arrays in C++?
A set of statements that perform logical operations
A type of loop
A way of storing multiple values of the same data type
A pointer
What is the continue statement in C++?
A statement that jumps to a specific line of code
A statement that ends a loop early
A statement that continues a loop with the next iteration
A statement that defines a function
What is a ternary operator in C++?
A loop
A conditional operator that takes three operands
A pointer
A switch case statement
What are data types in C++?
A set of statements that perform logical operations
A set of statements that perform mathematical operations
A set of rules for writing C++ code
A way of classifying variables according to the type of data they store
Which of the following is used to return a value from a function in C++?
def
fun
void
return
Which of the following is used to initialize an array in C++?
=
:
;
{
Which of the following is used to access an element in an array in C++?
( )
{ }
[ ]
/
Which of the following is used to iterate through an array in C++?
if statement
for loop
while loop
switch case
What is the purpose of a multi-dimensional array in C++?
To store multiple values of different types
To create a loop
To perform a specific task
To store multiple values in a table format
Are constants values changeable?
True
False
