C++ Basics

This quiz tests your knowledge of basic C++ programming concepts such as how to create a program, features of C++, etc. It consists of 10 MCQs.

Last Updated :
Discuss
Comments

Question 1

Which header file must be included to use std::cin and std::cout?

  • <math.h>

  • <input> 

    <output>

  • <iostream>

  • <program>

Question 2

Which type of memory retains data even when the power is turned off?

  • Cache Memory

  • RAM

  • Both (A) and (B)

  • Hard Disk

Question 3

___________________ translates the entire source code in a single run. It consumes less time i.e., it is faster than ________________.

  • Compiler, Linker

  • Interpreter, Compiler

  • Linker, Compiler

  • Compiler, Interpreter

Question 4

Multi-line comments in C++ are defined as

  • //

  • //**//

  • /**/

  • Both (A) and (B)

Question 5

Why is C++ faster than Java?

  • Because C++ takes fewer lines of code as compared to Java.

  • C++ is a compiled language whereas Java is an interpreted language.

  • C++ is closer to the hardware.

  • Both (B) and (C)

Question 6

Which of the following describes object-oriented programming in C++?

  • Dividing code into multiple files

  • Using objects to represent real-world entities

  • Writing programs using only functions

  • Creating software without data

Question 7

Which of the following is a better practice than using using namespace std; in C++?

  • Using global variables

  • Writing custom namespaces

  • Using std:: explicitly before standard library objects

  • Removing all namespaces

Question 8

Why are comments used in C++?

  • To make the code beautiful.

  • Improve readability

  • Provide documentation

  • Both (b) and (c)

Question 9

Predefined words in a programming language that have a special meaning and cannot be used as a variable name or function name are called

  • data types

  • keywords

  • predefined words

  • literals

Question 10

C++ is which type of language?

  • High-level language

  • Low-level language

  • Middle-level language

  • None of these

Tags:

There are 20 questions to complete.

Take a part in the ongoing discussion