Test Your C++ Knowledge

Think you know C++ well? Take this quiz to test your knowledge on C++ programming language.

published on June 28
1/10

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

Increment a variable by 1
Decrement a variable by 1
Multiply a variable by 2
Assign a value to a variable
2/10

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

Which keyword is used to define a class in C++?
class
struct
define
new
3/10

What is the correct way to declare a pointer in C++?

What is the correct way to declare a pointer in C++?
int *ptr;
ptr int;
int ptr;
ptr *int;
4/10

Which of the following is not a fundamental data type in C++?

Which of the following is not a fundamental data type in C++?
String
int
float
char
5/10

How do you include the 'iostream' library in a C++ program?

How do you include the 'iostream' library in a C++ program?
#include <iostream>
#include "iostream"
#include <iostream.h>
#import <iostream>
6/10

Which operator is used for logical AND in C++?

Which operator is used for logical AND in C++?
&&
&
||
~
7/10

What is the output of '5 + 8 * 3' in C++?

29
39
23
56
8/10

Which of the following is a valid C++ identifier?

Which of the following is a valid C++ identifier?
_myVar
123var
my var
var.my
9/10

What does 'cin' do in C++?

What does 'cin' do in C++?
Reads input from the standard input stream
Prints output to the console
Flushes the output stream
Opens a file for reading
10/10

How do you comment a single line in C++?

// This is a comment
<!-- This is a comment -->
/* This is a comment */
# This is a comment