C++ Basics

    Last Updated :
    Discuss
    Comments

    Question 1

    Which type of memory is used for dynamic memory allocation in C++?

    • Stack

    • Heap

    • Cache

    • ROM

    Question 2

    ___________________ 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 3

    Multi-line comments in C++ are defined as

    • //

    • //* *//

    • /* */

    • Both (A) and (B)

    Question 4

    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 5

    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 6

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

    • Using global variables

    • Writing custom namespaces

    • Using std:: explicitly before standard library objects

    • Removing all namespaces

    Question 7

    Why are comments used in C++?

    • To make the code beautiful.

    • Improve readability

    • Provide documentation

    • Both (b) and (c)

    Question 8

    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 9

    Which of the following best describes C++ as a programming language?

    • High-level language Only

    • Low-level language

    • Middle-level language

    • None of these

    Question 10

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

    • <math.h>

    • <input> 

      <output>

    • <iostream>

    • <program>

    Tags:

    There are 20 questions to complete.

    Take a part in the ongoing discussion