C++ Programming Basics and OOP Concepts Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the correct syntax to add a header file in a C++ program?

  • #include "header_file" (correct)
  • #include header_file
  • #include <header_file>
  • #include(header_file)

What is the correct syntax to add a header file in a C++ program?

  • #include <header_file>
  • #include "header_file" (correct)
  • #include(header_file)
  • #include header_file

What is the correct syntax to declare an array in C++?

  • array_name = {values};
  • array_name[size] = {values};
  • int array_name[size]; (correct)
  • array_name[size]

What is the correct syntax to declare an array in C++?

<p>int array_name[size]; (A)</p> Signup and view all the answers

What is the purpose of the rank() function in C++?

<p>To get the number of dimensions in a multi-dimensional array (B)</p> Signup and view all the answers

What is the purpose of the rank() function in C++?

<p>To get the number of dimensions in a multi-dimensional array (D)</p> Signup and view all the answers

What is the difference between references and pointers in C++?

<p>References cannot be null, while pointers can be null (D)</p> Signup and view all the answers

What is the difference between references and pointers in C++?

<p>References cannot be null, while pointers can be null (A)</p> Signup and view all the answers

What is the purpose of virtual inheritance in C++?

<p>To prevent multiple instances of a base class in a derived class hierarchy (D)</p> Signup and view all the answers

What is the purpose of virtual inheritance in C++?

<p>To prevent multiple instances of a base class in a derived class hierarchy (B)</p> Signup and view all the answers

What is the correct syntax to create a single-line comment in a C++ program?

<p>// Comment (D)</p> Signup and view all the answers

What is the correct syntax to create a single-line comment in a C++ program?

<p>// Comment (B)</p> Signup and view all the answers

What is the correct statement about formal parameters in C++?

<p>They are used to pass arguments to a function (B)</p> Signup and view all the answers

What is the correct statement about formal parameters in C++?

<p>They are used to pass arguments to a function (A)</p> Signup and view all the answers

What is the correct statement about the C++ programming language?

<p>It is a hybrid programming language that supports both procedural and object-oriented programming (B)</p> Signup and view all the answers

What is the correct statement about the C++ programming language?

<p>It is a hybrid programming language that supports both procedural and object-oriented programming (B)</p> Signup and view all the answers

Flashcards

C++ header file syntax

Includes required definitions for C++ functionalities, e.g., #include .

C++ output statement

Used to display text to console in C++, e.g., std::cout << "Hello!";

Array index (last)

Position of the last element in an array. Calculated by size minus one.

Array declaration

Syntax for creating an array ,e.g., int myArray[5];

Signup and view all the flashcards

Array element access

How to retrieve, e.g., elements from an array, using index, e.g., arr[2];

Signup and view all the flashcards

Pure Object-Oriented Language

Programming paradigm focusing on data encapsulation, inheritance, and polymorphism.

Signup and view all the flashcards

New vs. malloc

Both allocate memory dynamically, but new handles object creation in C++ with automatic resource management. malloc allocates raw memory and requires explicit deallocation.

Signup and view all the flashcards

Memory for Arrays

Arrays in C++ use contiguous memory to store elements in sequence.

Signup and view all the flashcards

Array Type

C++ arrays are homogeneous, meaning they store elements of the same data type.

Signup and view all the flashcards

One-dimensional array

An array with only one index to access elements sequentially.

Signup and view all the flashcards

Abstract Class

A class that cannot be instantiated (objects cannot be created of it).

Signup and view all the flashcards

Inheritance

Creating new classes (derived classes) based on existing ones (base classes).

Signup and view all the flashcards

Friend Function

A function outside a class allowed access to its private members.

Signup and view all the flashcards

Study Notes

C++ Multiple Choice Questions: Basics, Arrays, and OOP Concepts

MCQ Based on Basics of C++

  • Correct syntax to add the header file in the C++ program
  • Correct syntax to print the message in C++ language
  • Correct identifier in C++
  • Address operator in C++
  • Features required for a programming language to become pure object-oriented
  • Programming language ability to create new data types
  • Original creator of the C++ language
  • Correct syntax to read the single character to console in the C++ language
  • Correct statement about the formal parameters in C++
  • C++ language type
  • Features required for a programming language to become pure object-oriented
  • Correct comment syntax to create a single-line comment in the C++ program
  • C++ language type
  • Statement to insert a new line in C++ program
  • Representation of the tab

Set of MCQ Based on Arrays of the C++

  • Characteristics of an array
  • Index address of the last data item in an array
  • Correct syntax for declaring an array
  • Correct syntax for printing the address of the first element
  • Method to get the 4th element of the array
  • Output of a C++ program
  • Type of memory used by an array in C++ programming language
  • Definition of sorting in C++
  • Types of arrays in the C++ programming language
  • Purpose of rank() in C++
  • Correct definition of is_array() in C++
  • Output of a C++ program
  • Output of a C++ program
  • Name for a one-dimensional array
  • Types of arrays considered as linear arrays
  • Object of an array
  • Number of types of elements an array can store
  • Numbering of the elements of a one-dimensional array

MCQ Based on the Oops Concepts of the C++

  • Differences between new and malloc
  • Pointer object initialization of a specific class using new and malloc
  • Correct statement about virtual inheritance
  • Definition of Delete and Delete[] in C++
  • Output of a C++ program
  • Output of a C++ program
  • Syntax for declaring an array of pointers of integers that has a size of 10 in C++
  • Members that can be inherited but not accessible in any class
  • Method to create an abstract class in the C++ programming language
  • Correct statement about the class
  • Correct statement about the friend function in C++ programming language
  • Incorrect statement about C++
  • True statement about function calls in an object-oriented programming language and a procedure programming language
  • Keyword that cannot be used with virtual
  • Method for implementing late binding
  • Support for reusable code as one of the desirable features of any language
  • Correct statement about the C++ programming language
  • Type of inheritance that is not a kind of inheritance
  • Result of a C++ program if a class has no name
  • Type of approach used by the C++ language
  • Concept referring to adding new components to the program at runtime
  • Method to implement compile-time Polymorphism in the C++ programming language
  • Method to implement run-time Polymorphism in the C++ programming language
  • Offer that allows a programmer to use a specific class object into other classes
  • Type that cannot be a friend in C++ languages
  • Differences between references and pointers
  • Member of a class
  • Concept referring to wrapping data and its functionality into a single individual entity
  • Concept referring to using

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

C++ Programming Basics Quiz
10 questions

C++ Programming Basics Quiz

UnboundConnemara1219 avatar
UnboundConnemara1219
C++ Arrays
6 questions

C++ Arrays

FlashyFactorial avatar
FlashyFactorial
Arrays of Objects in C++
11 questions

Arrays of Objects in C++

AstoundedAlgorithm avatar
AstoundedAlgorithm
Use Quizgecko on...
Browser
Browser