Chapter 1: MCQs on Introduction to C++ | C++ Programming

Learn C++ with 30 MCQs | Master the Basics and Set Up Your C++ Environment

C++ is a powerful and versatile programming language. This collection of 30 MCQs will guide you through its history, features, setting up the environment, and compiling your first program.


MCQs

1-6: What is C++?

  1. C++ is a:
    • A) High-level language
    • B) Low-level language
    • C) Assembly language
    • D) Markup language
  2. Who is the creator of C++?
    • A) James Gosling
    • B) Dennis Ritchie
    • C) Bjarne Stroustrup
    • D) Ken Thompson
  3. What does C++ add to the C programming language?
    • A) Object-oriented features
    • B) Assembly programming
    • C) Network programming
    • D) HTML features
  4. C++ is primarily used for:
    • A) Web development
    • B) System programming
    • C) Database programming
    • D) Artificial Intelligence
  5. The symbol used to denote the C++ programming language is:
    • A) C
    • B) C+
    • C) ++
    • D) C++
  6. Which of the following is NOT a characteristic of C++?
    • A) Object-oriented
    • B) High-level language
    • C) Platform independent
    • D) Machine-dependent

7-12: History of C++

  1. When was C++ first developed?
    • A) 1972
    • B) 1983
    • C) 1991
    • D) 2000
  2. C++ is an extension of which programming language?
    • A) Java
    • B) Pascal
    • C) C
    • D) Fortran
  3. In which year did C++ get its first formal release?
    • A) 1985
    • B) 1990
    • C) 1995
    • D) 2000
  4. The original version of C++ was known as:
    • A) C with Classes
    • B) C++
    • C) Turbo C
    • D) Object-Oriented C
  5. Which company developed the first commercial version of C++?
    • A) Microsoft
    • B) Sun Microsystems
    • C) Borland
    • D) AT&T Bell Labs
  6. What major programming paradigm was introduced with C++?
    • A) Functional programming
    • B) Object-oriented programming
    • C) Logic programming
    • D) Declarative programming

13-18: Features of C++

  1. Which feature of C++ allows the use of classes and objects?
    • A) Encapsulation
    • B) Inheritance
    • C) Polymorphism
    • D) Object-oriented programming
  2. What does the “++” symbol in C++ signify?
    • A) Assignment operator
    • B) Increment operator
    • C) Decrement operator
    • D) Function call operator
  3. C++ supports which of the following memory management techniques?
    • A) Garbage collection
    • B) Manual memory allocation and deallocation
    • C) Automatic memory management
    • D) Stack memory only
  4. Which of the following is a feature of C++ that helps in code reuse?
    • A) Modularity
    • B) Inheritance
    • C) Multi-threading
    • D) Portability
  5. C++ supports which type of programming?
    • A) Object-oriented
    • B) Procedural
    • C) Both Object-oriented and Procedural
    • D) None of the above
  6. Which feature of C++ allows a function to be called with different argument types?
    • A) Overloading
    • B) Overriding
    • C) Virtual functions
    • D) Friend functions

19-24: Setting up the C++ environment (IDE, Compiler)

  1. Which IDE is most commonly used for C++ development?
    • A) Eclipse
    • B) Visual Studio
    • C) IntelliJ IDEA
    • D) PyCharm
  2. The C++ compiler for Windows is commonly known as:
    • A) GCC
    • B) MinGW
    • C) Clang
    • D) Turbo C
  3. Which C++ compiler is primarily used on Linux systems?
    • A) GCC
    • B) MinGW
    • C) Visual C++
    • D) Turbo C
  4. The “g++” command is used to compile which type of programs?
    • A) Java programs
    • B) Python programs
    • C) C++ programs
    • D) HTML files
  5. Which of the following is a free, open-source IDE for C++ development?
    • A) Code::Blocks
    • B) Eclipse
    • C) NetBeans
    • D) Microsoft Visual Studio
  6. Which operating system does not typically support C++ development out of the box?
    • A) Windows
    • B) Linux
    • C) macOS
    • D) Android

25-30: Writing and compiling a simple C++ program

  1. What is the output of the following C++ code snippet?cppCopy code#include <iostream> int main() { std::cout << "Hello, World!"; return 0; }
    • A) Compile-time error
    • B) Hello World
    • C) Hello, World!
    • D) Undefined output
  2. The “return 0;” statement in a C++ program signifies:
    • A) A successful execution of the program
    • B) The beginning of the program
    • C) A compile-time error
    • D) An infinite loop
  3. What is the correct syntax to include the iostream library in a C++ program?
    • A) #include <stdio.h>
    • B) #include <iostream>
    • C) #include “iostream”
    • D) #include “stdio.h”
  4. Which function is the entry point for a C++ program?
    • A) start()
    • B) main()
    • C) execute()
    • D) program()
  5. Which keyword is used to define a constant value in C++?
    • A) constant
    • B) var
    • C) const
    • D) static
  6. What happens if there is a syntax error in a C++ program?
    • A) The program runs with errors
    • B) The program compiles but produces incorrect output
    • C) The program does not compile
    • D) The program runs as expected

Answer Key

QnoAnswer
1A) High-level language
2C) Bjarne Stroustrup
3A) Object-oriented features
4B) System programming
5C) ++
6C) Platform independent
7B) 1983
8C) C
9A) 1985
10A) C with Classes
11D) AT&T Bell Labs
12B) Object-oriented programming
13D) Object-oriented programming
14B) Increment operator
15B) Manual memory allocation and deallocation
16B) Inheritance
17C) Both Object-oriented and Procedural
18A) Overloading
19B) Visual Studio
20B) MinGW
21A) GCC
22C) C++ programs
23A) Code::Blocks
24D) Android
25C) Hello, World!
26A) A successful execution of the program
27B) #include <iostream>
28B) main()
29C) const
30C) The program does not compile

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top