C++ Programming Language

409 questions in the bank
Are you ready to take quiz?
Explore more
Logo
About the Quiz

Quiz will ask 20 randomly selected questions with allotted time of . You can take the quiz more than once. Once you submit the quiz, you can review how you have done, the correct the answers for each questions and the explanation for the correct the answer.

Quiz Topics

9 Modules

C++ Basics

5 topics
1.

Control Flow Statements (if, switch, loops)

10 questions
2.

Data Types

10 questions
3.

Operators

10 questions
4.

Syntax and Structure

10 questions
5.

Variables and Constants

10 questions

Object-Oriented Programming (OOP)

5 topics

Memory Management

4 topics

Standard Template Library (STL)

5 topics

Advanced C++ Features

5 topics

C++11 and Beyond

4 topics

Design Patterns

4 topics

Performance Optimization

5 topics

Testing and Debugging

4 topics
Sample questions

Which of the following are valid variable declarations in C++?

int 1stNumber;

float number;

char c = 'a';

double total_amount;

What is the output of the following code snippet?

#include <iostream>
using namespace std;

int main() {
    int x = 5;
    int y = 10;
    cout << (x > y ? x : y);
    return 0;
}

5

10

x

y

Which of the following statements about pointers in C++ is/are true?

Pointers can be assigned the address of a variable.

Pointers can be dereferenced using the * operator.

Pointers can point to functions.

Pointers cannot be null.

What will be the output of the following code?

#include <iostream>
using namespace std;

int main() {
    int a = 10;
    int b = 20;
    cout << (a += b) << ' ' << (b -= a) << endl;
    return 0;
}

30 -10

30 0

10 20

20 10

Which of the following are valid ways to define a function in C++?

void func(int x);

int func(int x) { return x; }

func(int x) { return x; }

float func(int x) = { return x; }

Quiz Topics

9 Modules

C++ Basics

5 topics
1.

Control Flow Statements (if, switch, loops)

10 questions
2.

Data Types

10 questions
3.

Operators

10 questions
4.

Syntax and Structure

10 questions
5.

Variables and Constants

10 questions

Object-Oriented Programming (OOP)

5 topics

Memory Management

4 topics

Standard Template Library (STL)

5 topics

Advanced C++ Features

5 topics

C++11 and Beyond

4 topics

Design Patterns

4 topics

Performance Optimization

5 topics

Testing and Debugging

4 topics