0% found this document useful (0 votes)
174 views

C PDF

The document contains 25 multiple choice questions about C++ concepts such as classes, objects, inheritance, polymorphism, functions, and more. Each question is followed by 4 possible answer choices with one correct answer indicated. The questions cover topics like base and derived class relationships, default arguments, constructors, destructors, arrays, static variables, and more fundamental aspects of C++.

Uploaded by

Shrimali Kanchan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
174 views

C PDF

The document contains 25 multiple choice questions about C++ concepts such as classes, objects, inheritance, polymorphism, functions, and more. Each question is followed by 4 possible answer choices with one correct answer indicated. The questions cover topics like base and derived class relationships, default arguments, constructors, destructors, arrays, static variables, and more fundamental aspects of C++.

Uploaded by

Shrimali Kanchan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

. Which of the following statements is correct?

Logo of c++

Aptitude Question answers on C++

A. Pointer to derived class cannot be created.

B. Derived class pointer cannot point to base class.

C. Base class pointer cannot point to derived class.

D. Pointer to base class cannot be created.

Answer: Option B

2. Which of the following concept of oops allows compiler to insert arguments in a function call if it is
not specified?

A. Default arguments

B. Call by reference

C. Call by value

D. Call by pointer

Answer: Option A

3. How many types of polymorphisms are supported by C++?

A. 3

B. 2

C. 1

D. 4

Answer: Option B
4. Which of the following correctly describes overloading of functions?

A. Ad-hoc polymorphism

B. Transient polymorphism

C. Virtual polymorphism

D. Pseudo polymorphism

Answer: Option A

5. How “Late binding” is implemented in C++?

A. Using C++ tables

B. Using Virtual tables

C. Using Indexed virtual tables

D. Using polymorphic tables

Answer: Option B

6. What happens when we try to compile the class definition in following code snippet?

class Birds {};

class Peacock : protected Birds {};

A. It will not compile because a class cannot be protectedly inherited from other class.

B. It will not compile because class body of Eagle is not defined.

C. It will not compile because class body of Birds is not defined.

D. It will compile successfully.


Answer: Option D

7. Which of the following also known as an instance of a class?

A. Friend Functions

B. Member Variables

C. Member Functions

D. Object

Answer: Option D

8. What does the class definitions in following code represent?

class Bike

Engine objEng;

};

class Engine

float CC;

};

A. kind of relationship

B. Inheritance

C. has a relationship

D. Both A and C

Answer: Option C
9. Which of the following means “The use of an object of one class in definition of another class”?

A. Encapsulation

B. Abstraction

C. Composition

D. Inheritance

Answer: Option C

10. Which of the following can be overloaded?

A. Object

B. Operators

C. Functions

D. Both B and C

Answer: Option D

11. Which of the following function prototype is perfectly acceptable?

A. int Function(int Tmp = Show());

B. float = Show(int, float) Function(Tmp);

C. float Function(int Tmp = Show(int, float));

D. Both A and C.

Answer: Option A

12. Which of the following function declaration is/are incorrect?


A. int Sum(int a = 0, int b, int c = 3);

B. int Sum(int a = 5, int b);

C. int Sum(int a, int b = 2, int c = 3);

D. All are correct.

E. Both A and B are incorrect.

Answer: Option E

13. Which of the following statement is correct?

A. The default value for an argument cannot be function call.

B. C++ does not allow the redefinition of a default parameter.

C. Both A and B.

D. C++ allows the redefinition of a default parameter

Answer: Option B

14. Which of the following function / types of function cannot have default parameters?

A. Member function of class

B. Member function of structure

C. main()

D. Both B and C

Answer: Option C

15. What happens when a class with parameterized constructors and having no default constructor is
used in a program and we create an object that needs a zero-argument constructor?
A. Runtime error.

B. Preprocessing error.

C. Compile-time error.

D. Runtime exception.

Answer: Option C

16. Copy constructor must receive its arguments by __________ .

A. only pass-by-reference

B. only pass-by-value

C. either pass-by-value or pass-by-reference

D. only pass by address

Answer: Option A

17. Which of the following gets called when an object goes out of scope?

A. constructor

B. virtual function

C. main

D. destructor

Answer: Option D

18. Which of the following are NOT provided by the compiler by default?

A. Zero-argument Constructor

B. Copy Destructor
C. Copy Constructor

D. Destructor

Answer: Option B

19. If the programmer does not explicitly provide a destructor, then which of the following creates an
empty destructor?

A. Preprocessor

B. main() function

C. Linker

D. Compiler

Answer: Option D

20. Which of the following implicitly creates a default constructor when the programmer does not
explicitly define at least one constructor for a class?

A. Preprocessor

B. Compiler

C. Loader

D. Linker

Answer: Option B

21. Which of the following never requires any arguments?

A. Default constructor

B. Friend function
C. Member function

D. const function

Answer: Option A

22. Which of the following statements are correct?

A. Destructor is always called explicitly.

B. Constructor is called either implicitly or explicitly, whereas destructor is always called implicitly.

C. Constructor is always called explicitly.

D. Constructor and destructor functions are not called at all as they are always inline.

Answer: Option B

23. To ensure that every object in the array receives a destructor call, always delete memory allocated
as an array with operator __________ .

A. delete[] B. Delete

C. destructor

D. kill[] E. Free[]

Answer: Option A

24. What is output ?

Int main(){

Int i=10;
Static int x=i;

If(x==i)

Printf(“Equal”);

Else if(x>i)

Printf(“Greater than”);

Else

Printf(“Less than”);

Return 0;

A. Equal

B. Compiler error

C. Less than

D. Greater than

Answer: Option B

25. What will be output if you will compile and execute the following c code?

#include
Int main(){

Int a=1,2;

Int b=(1,2);

Printf(“%d %d”,a,b);

Return 0;

A. 1,1

B. 2,2

C. 2,1

D. 1,2

Answer: Option D

Toggle navigation

1000+ C++ Questions and Answers Pdf – 1

Home Computer-Quiz Cpp-Quiz8

Question: 1

The library function exit( ) causes an exit from


(A) The program in which it occurs

(B) The function in which it occurs

(C) The block in which it occurs

(D) The loop in which it occurs

Ans: A

The program in which it occurs

Question: 2

The dot operator connects which of the following two entities?

(A) Class object and member of that class

(B) Class and member of that class

(C) Class object and a class

(D) Class member and class object

Ans: A
Class object and member of that class

Question: 3

A static function

(A) Should be called when an object is destroyed

(B) Can be called using the class name and function

(C) Is closely connected with an individual object of a class

(D) Is used when a dummy object must be created

Ans: B

Can be called using the class name and function

Question: 4

The function bad( ) is declared in the header file

(A) <iostream.h>
(B) <stdio.h>

(C) <math.h>

(D) <stdlib.h>

Ans: C

<math.h>

Question: 5

In C++, a function contained within a class is called

(A) A method

(B) A class function

(C) Member function

(D) None of these

Ans: C

Toggle navigation
1000+ C++ Questions and Answers Pdf – 2

Home Computer-Quiz Cpp-Quiz8

Question: 6

A function argument is a

(A) Value sent to function by the calling program

(B) Value returned by the function to the calling program

(C) Variable in the function that receives a value from the calling program

(D) Way that functions resist accepting the calling program’s values

Ans: A

Value sent to function by the calling program

Question: 7

The break statement causes an exit

(A) From the innermost loop or switch

(B) Only from the innermost switch


(C) Only from the innermost loop

(D) From all loops and switches

Ans: D

From all loops and switches

Question: 8

Element double array [7] is which element of the array?

(A) Sixth

(B) Seventh

(C) Eighth

(D) Impossible

Ans: C

Eighth
Question: 9

In C++, a structure brings together a group of

(A) Items of the same data type

(B) Integers with user-defined names

(C) Related data items, variables

(D) All of these

Ans: C

Related data items, variables

Question: 10

In C++, which of the following can legitimately be passed to a function?

(A) A constant

(B) A variable

(C) A structure

(D) All of these


Ans: D

All of these

Prev123

Exercise

Cpp Quiz

Cpp Quiz1

Cpp Quiz2

Cpp Quiz3

Cpp Quiz4

Cpp Quiz5

Cpp Quiz6

Cpp Quiz7

Cpp Quiz8

Cpp Quiz9

Cpp Quiz10

More Categories

Basic Statements

Operating System

Windows Explorer

Abbreviation

Ms Excel
C Langauges Mcq

Database

Windows Explorer

Operating System

Number System

Compiler Design

Web Design

Star Office

Spreadsheet

Computer Information

Related Questions

Top 150+ C++ Quiz Questions And Answers 2020-2021

C++ MCQ Questions And Answers

C++ Multiple Choice Questions And Answers

C++ Objective Questions And Answers Pdf

C++ Online Test | Questions And Answers For Gate 2020-2021

C++ Programming Objective Questions And Answers Pdf

Top 150+ C++ Programming Quiz Questions And Answers

C++ Programming MCQ Questions With Answers

1000+ C++ Questions And Answers Pdf

C++ Programming Questions With Solutions

Top 1,000+ C++ Language Quiz Questions & Answers

C++-Multiple-Choice-Questions-Answers.Pdf

C++-Objective-Questions-And-Answers.Pdf

C++-Questions-And-Answers.Pdf

C++-Quiz-Questions-Answers.Pdf

Recent Articles
Top 1000+ Preposition Questions for SSC Exams More

June-19-2021 | Meritnotes

Preposition Quiz Questions and Answers for Bank Exams More

June-18-2021 | Meritnotes

Computer Awareness Questions Asked in IBPS RRB PO Mains 2021-2022 More

June-17-2021 | Meritnotes

IBPS Computer Awareness Online Test More

June-16-2021 | Meritnotes

1000+ Computer Awareness Questions with Answers for Bank Exams More

June-15-2021 | Meritnotes

Object Oriented Programming in C++ MCQ with Answers Pdf More

June-14-2021 | Meritnotes

Trending Posts

Computer Science Quiz Questions with Answers Multiple Choice 2019-2020 More

August-28-2019 | Meritnotes

World History MCQ for Competitive Exams Pdf More

December-10-2019 | Meritnotes

Top 10+ Newtons Law of Motion MCQs Quiz, Gk Questions and Answers More

August-28-2019 | Meritnotes

Computer Science Online Test | Question Paper 2020-2021 More

August-28-2019 | Meritnotes

MS Access Questions and Answers for Competitive Exams More

August-28-2019 | Meritnotes

Solar System Multiple Choice Questions and Answers More

August-28-2019 | Meritnotes

REGISTER TO GET FREE UPDATES

Email address

Enter email
Home

Terms & Conditions

Contact

2021 © MeritNotes

In a linked list

(A) Each link contains data or a pointer to data

(B) Links are stored in an array

(C) A array of pointers point to the link

(D) Each link contains a pointer to the next link

You might also like