C++ Beginner Skill Assessment Practice Test

Welcome to the C++ Beginner Skill Assessment Practice Test! This practice test comprises 50 multiple-choice questions designed to evaluate and enhance your foundational knowledge of C++. Each question includes a detailed explanation to ensure you understand the correct answers and the concepts behind them. Covering a wide range of topics from basic syntax and data types to control structures and simple functions, this test is perfect for those new to programming or anyone looking to solidify their C++ basics.

Ready to assess your skills? Let’s start the assessment

Last Updated :
Discuss
Comments

Question 1

What is the file extension for a C++ source file?

  • .c

  • .cpp

  • .h

  • .exe

Question 2

Which among the following symbol is used to comment a single line in C++?

  • #

  • /*

  • //

  • \\

Question 3

What is the output of the following C++ code?

C++
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello, World!" << endl;
    return 0;
}
  • Hello, World

  • Hello, World!

  • Hello World!

  • Hello World

Question 4

Which among the following data types is used to store a single character in C++?

  • int

  • char

  • float

  • double

Question 5

What is the size of an int data type in C++ (on most systems)?

  • 2 bytes

  • 1 byte

  • 8 bytes

  • 4 bytes

Question 6

How do you declare a floating-point variable in C++?

  • int x = 3.14;

  • float x = 3.14;

  • char x = 3.14;

  • double x = 3.14;

Question 7

What is the default value of a global variable in C++?

  • 0

  • undefined

  • garbage value

  • null

Question 8

Which of the following is true about static variables?

  • They are reinitialized every time the function is called.

  • They retain their value between function calls.

  • They can only be declared within a function.

  • They cannot be initialized.

Question 9

Where can a local variable be accessed in C++?

  • Only within the block it is declared

  • Throughout the entire program

  • Within the file it is declared

  • Within the function it is declared

Question 10

How do you access a global variable named x when there is a local variable with the same name?

  • global::x

  • ::x

  • x

  • global_x

There are 50 questions to complete.

Take a part in the ongoing discussion