C++ Quiz (2)

C++ Quiz (2)

Test your knowledge of the C++ programming language with this quiz. See if you can answer all 12 questions correctly

published on February 111 response 0
Next »
1/12

What is the correct syntax to declare a variable in C++?

What is the correct syntax to declare a variable in C++?
int x;
variable x;
x = int;
x = variable;
2/12

Which keyword is used to define a function in C++?

Which keyword is used to define a function in C++?
func
def
void
function
3/12

How do you print 'Hello, World!' using C++?

How do you print 'Hello, World!' using C++?
console.log('Hello, World!');
cout << 'Hello, World!' << endl;
System.out.println('Hello, World!');
print('Hello, World!');
4/12

Which data type is used for storing a single character in C++?

Which data type is used for storing a single character in C++?
boolean
int
char
string
5/12

What is the output of the following code?

int x = 5;
cout << x++ << endl;

What is the output of the following code?  int x = 5; cout << x++ << endl;
5
6
Compiler Error
6/12

Which operator is used for memory allocation in C++?

Which operator is used for memory allocation in C++?
new
memalloc
malloc
both new and malloc
7/12

Which loop is guaranteed to run at least once?

Which loop is guaranteed to run at least once?
do-while
for
while
if
8/12

What is the size of 'int' data type in C++?

What is the size of 'int' data type in C++?
4 bytes
platform-dependent
8 bytes
2 bytes
9/12

Which keyword is used to inherit a class in C++?

Which keyword is used to inherit a class in C++?
extends
inherits
implements
class
10/12

What does the '++' operator do in C++?

What does the '++' operator do in C++?
Subtraction
Multiplication
Increment
Assignment
11/12

Which header file is needed to use input/output functions in C++?

Which header file is needed to use input/output functions in C++?
<iostream>
<stdio.h>
<stdlib.h>
<fstream>
12/12

Which operator is used for accessing the member of a class in C++?

Which operator is used for accessing the member of a class in C++?
->
::
.
>>