• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 20 pages
Exam (elaborations)

c++ programming MCQS

Document preview thumbnail
Preview 3 out of 20 pages

MULTIPLE CHOICE QUESTIONS c plus plus programming

Content preview

Here Are 50 Quizzes / Multiple-Choice Questions Related To

C++
With Correct Answers



1. What is the correct syntax for including the C++ Standard Input/Output library?

a) #include <iostream>

b) #include "iostream"

c) using namespace std;

d) import iostream;



**Answer: a**



2. What is the extension for C++ source code files?

a) .cc

b) .cpp

c) .cxx

d) .h



**Answer: b**



3. In C++, which keyword is used to define a class?

a) struct

, b) class

c) type

d) def



**Answer: b**



4. What is the purpose of the "new" keyword in C++?

a) To create a new instance of a class

b) To allocate memory for a new object

c) To define a new function

d) To include a new header file



**Answer: b**



5. Which operator is used for dynamic_cast in C++?

a) >>

b) ::

c) ->

d) /



**Answer: c**

, 6. Which type of inheritance specifies that a class can have only one parent class?

a) Single Inheritance

b) Multiple Inheritance

c) Hierarchical Inheritance

d) Multilevel Inheritance



**Answer: a**



7. What does the "const" keyword indicate in C++?

a) The variable is initialized at declaration

b) The variable's value cannot be changed after initialization

c) The variable is constant and cannot be used in calculations

d) The variable is used for type casting



**Answer: b**



8. What is the output of the following code?

int x = 5;

cout << (x++) + (++x);

a) 10

b) 11

c) 12

Document information

Uploaded on
January 4, 2024
Number of pages
20
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$3.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
164
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions