Object Oriented Concepts Through CPP MCQ | Savitribai Public University Object Oriented Concepts Through CPP MCQ | SPPU Object Oriented Concepts Through CPP MCQ

Object Oriented Concepts Through CPP   

Object Oriented Concepts Through CPP

Object Oriented Concepts Through CPP  MCQ form Nirali Prakashan Book

 

Chapter 1 : Introduction to C++

 

1. The Word “Oriented” means showing________

A) Ambiguity

B) Functionality

C) Methodology

D) None

Answer: B) Functionality

 

2. OOP decompose the problem into smaller unit known as ______

A) Object

B) Class

C) Function

D) None

Answer: A) Object

 

3. Object-Oriented Programming Language gives emphasis on_______

A) Flowchart

B) Algorithm

C) Data

D) None

Answer: C) Data

 

4. Object-Oriented Programming Language follows the _____ approach.

A) top-down

B) bottom-up

C) top-bottom

D) none

Answer: B) bottom-up

 

5. The function that operate on the data of an object are tied together in the data strucute, this concept is known as__________

A) Polymorphism

B) Inheritance

C) Encapsulation

D) None

Answer: C) Encapsulation

 

6. _____ allows creation of new classes form old one.

A) Polymorphism

B) Inheritance

C) Class

D) None

Answer: B) Inheritance

 

7. ______ are basic run- time entities.

A) Data

B) Class

C) Object

D) None

Answer: C) Object

 

8. The object with the attributes and methods are grouped together to form a __________

A) Data

B) Class

C) Object

D) None

Answer: B) Class

 

9. An object is an________ of a class.

A) Abstraction

B) Operation

C) Instance

D) None

Answer: C) Instance

 

10. The code redundancy can be eliminated through__________

A) Polymorphism

B) Inheritance

C) Class

D) None

Answer: B) Inheritance

 

11. C++ was developed by _______

A) Stroustrup

B) Denis Richie

C) Pascal

D) None

Answer: A) Stroustrup

 

12. The statement which starts with the symbol// is treated as ______comment.

A) One(Single) line

B) Multi-line

C) Mini-line

D) None

Answer: A) One(Single) line

 

Chapter 2 : Beginning with C++

 

1. Which of the following is legal declaration of a reference?

A) int &a=10;

B) int &a=m;

C) int &a =sqr(m);

D) int *a=&15;

Answer: B) int &a=m;

 

2. Which of the following statements is illegal?

A) int *p = new int (15);

B) int *p = new int;

C) int *p = new int(10);

D) delete p();

Answer: D) delete p();

 

3. Which of the following is not keyword?

A) Bool

B) Abstract

C) Protected

D) Mutable

Answer: B) Abstract

 

4. Which of the following keywords is used to control access to a class member?

A) default

B) break

C) protected

D) goto

Answer: C) protected

 

5. Which of the following statements is true in c++?

A) Classes cannot have data as public members.

B) Structures cannot have functions as members.

C) Class members are public by default.

D) None of these

Answer: D) None of these

 

6. The _____ operator extracts the value of a variable form cin object.

A) extraction

B) insertion

C) instance

D) none

Answer: B) insertion

 

7. The words which has predefined meaning and cannot be changed by the users are knows as ____

A) constants

B) identifiers

C) keywords

D) none

Answer: C) keywords

 

8. The maximum number of characters used in identifiers are________

A) 356

B) 31

C) 8

D) none

Answer: B) 31

 

9. The dynamic memory allocation can be done through ______ operator.

A) new

B) delete

C) pointer

D) none

Answer: A) new

 

10. Following which keyword is used to declare a constant?

A) const keyword

B) #define preprocessor

C) both(a) and (b)

D) none of these

Answer: C) both(a) and (b)

 

11. What is?: called?

A) ternary operators

B) binary operators

C) arithmetic operator

D) none of these

Answer: A) ternary operators

 

12. Which keyword is used to access to variable in namespace?

A) static

B) using

C) const

D) dynamic

Answer: B) using

 

Chapter 3 : Classes and Objects

 

1. An array of class type is known as _______

A) array of objects

B) pointer to array

C) array of pointers

D) both a & b

Answer: B) pointer to array

 

2. By default members of structures are _______

A) protected

B) private

C) public

D) all of above

Answer: C) public

 

3. Which of the following keywords is used to control access to a class member?

A) default

B) break

C) protected

D) goto

Answer: C) protected

 

4. ______ keyword used for declared an structure in c++.

A) class

B) struct

C) private

D) protected

Answer: B) struct

 

5. Identify correct access specifies in following.

A) public, private, friend

B) public, protected, this

C) public, private, protected

D) none of above

Answer: C) public, private, protected

 

6. Objects are instances of class.

A) True

B) False

Answer: A) True

 

7. A member function can call another member function directly without using dot operator.

A) True

B) False

Answer: A) True

 

Chapter 4 : Constructors and Destructors

 

1. Constructors are used to _________ the object.

A) increment

B) initialize

C) destroy

D) both (a) & (b)

Answer: B) initialize

 

2. Destructors are used to _______ the object.

A) increment

B) initialize

C) destroy

D) modify

Answer: C) destroy

 

3. The name of the construction is similar to the name of the ______

A) object

B) class

C) data

D) none of these

Answer: B) class

 

4. Name of constructor is same as the ______

A) class

B) object

C) member function

D) both (a) and (b)

Answer: A) class

 

5. The memory is allocated to the data members of class, when _____ of the class is declared.

A) constructor

B)  destructor

C) both(a) and (b)

D) object

Answer: D) object

 

6. Constructors, like other member functions, can be declared anywhere in the class.

A) True

B) False

Answer: A) True

 

7. constructors do not return any value.

A) True

B) False

Answer: A) True

 

8.  A constructor that accepts no parameters is known as the default constructor.

A) True

B) False

Answer: A) True

 

9. A class should have at least one constructor.

A) True

B) False

Answer: B) False

 

10. Destructor takes arguments.

A) True

B) False

Answer: B) False

 

Chapter 5 : Inheritance


1. The process of creating new classes form an existing class is called as___________

A) polymorphism

B) poly-inheritance

C) inheritance

D) hone

Answer: C) inheritance

 

2. If a base class is privately inherited by a derived class become _____ member to derived class.

A) public

B) private

C) visible

D) none

Answer: B) private

 

3. A class which is used only to derive other classes is known as ______class.

A) abstract

B) virtual

C) derived

D) none.

Answer: A) abstract

 

4. Hybrid inheritance is_________.

A) Multiple inheritance

B) multilevel inheritance

C) multipath inheritance

D) both a & b

Answer: D) both a & b

 

5. A class is inherited known as _____

A) base class

B) hybrid

C) derived class

D) both a and b

Answer: A) base class

 

6. Following ____ operator is used for resolve ambiguity.

A)  +

B) -

C) ::

D) none of these

Answer: B) -

 

7. Inheritance helps in marking a general class into a more specific class.

A) True

B) False

Answer: B) False

 

8. Inheritance facilitates the creation of class libraries.

A) True

B) False

Answer: A) True

 

9. Defining a derived class requires some changes in the base class.

A) True

B) False

Answer: B) False

 

10. A base class is never used to create objects.

A) True

B) False

Answer: B) False

 

Chapter 6 : Polymorphism

 

1. In operator overloading _____ in the basic meaning of operator is not allowed.

A) increment

B) addition

C) change

D) none

Answer: C) change

 

2. If we overload only prefix ++ operator, the postfix ++ operator_____

A) does not work

B) works naturally

C) works arbitrarily

D) works as if prefix ++operator

Answer: D) works as if prefix ++operator

 

3. When the compiler decides binding as overload member, it is called ______ binding.

A) local

B) static

C) dynamic

D) safe

Answer: B) static

 

4. Following which operator cannot be overloaded?

A)  +

B)  *

C) ::

D) both a and b

Answer: C) ::

 

5.Operator in C++ can be overloaded by _____

A) string function

B) member function

C) operator function

D) both a and b

Answer: C) operator function

 

6. Which of the following is true about this pointer?

A) It is passed as a hidden argument to all function calls

B) It is passed as a hidden argument to all non-static function calls

C) It is passed as a hidden argument to all static functions

D) None of the above

Answer: B) It is passed as a hidden argument to all non-static function calls

 

7. Polymorphism means ______

A) Many forms

B) only one form

C) hiding data

D) none of them

Answer: A) Many forms

 

Chapter 7 : Managing console I/O operations


1. The stream that supplies data to a program is called ____ stream.

A) Input

B) Output

C) I/O

D) none

Answer: A) Input

 

2. The stream that receives data form the program is called ______ stream.

A) Input

B) Output

C) I/O

D) none

Answer: B) Output

 

3. The read() and write() functions handle data in _____form.

A) text

B) binary

C) character

D) none

Answer: B) binary

 

4. The ios::ate mode allows us to write data anywhere in the file.

A) True

B) False

Answer: B) False

 

5. The functions write() and get () are similar.

A) True

B) False

Answer: B) False

 

6. The output pointer is called put pointer.

A) True

B) False

Answer: A) True

 

7. The programmer must create cin, cout, cerr, clog object explicitly.

A) True

B) False

Answer: B) False

 

Chapter 8 : Working with Files

 

1. The stream that supplies data to a program is called ____ stream.

A) input

B) output

C) I/O

D) none of these

Answer: A) input

 

2. The stream that receives data form the program is called _____ stream.

A) Input

B) Output

C) I/O

D) none of these

Answer: B) Output

 

3. Open() function is used to open ____ files which use the same stream objects.

A) multiple

B) console

C) print

D) none of these

Answer: A) multiple

 

4. _____ function is used to reached end of file.

A) exit()

B) close()

C) eof()

D) both a and b

Answer: C) eof()

 

5. The _____ function close all the opened stream files.

A) exit()

B) close()

C) eof()

D) both a and b

Answer: B) close()

 

6. A stream may be connected to more than one file at a time.

A) True

B) False

Answer: A) True

 

7. The ios::ate mode allows us to write data anywhere in the file.

A) True

B) False

Answer: A) True

 

Chapter 9 : Templates

 

1. Class template can have_____ parameters.

A) any type

B) class type

C) both

D) none

Answer: C) both

 

2. The actual source code form implementing a template function is created when ______

A) the function is actually executed

B) the declaration of the function appears

C) the definition of the function appears

D) the function is invoked.

Answer: D) the function is invoked.

 

3. The template argument is preceded by the keyword _________

A) class

B) T

C) data type

D) all

Answer: A) class

 

4. What is the correct syntax of defining function template/template functions?

A) Template <class T> void(T a){cout<<a;}

B) Template <class T> void(T a){cout<<a;}

C) Template<T> void(T a){cout<<a;}

D) Template<T> void(T a){cout<<a;}

Answer: A) Template <class T> void(T a){cout<<a;}

 

5. In how many ways templates concept can be used?

A) 1

B) 2

C) 3

D) 4

Answer: B) 2

 

6. Function templates require more memory space than normal function.

A) True

B) False

Answer: B) False

 

7. Templates are processed by the compiler

A) True

B) False

Answer: A) True

 

8. Template classes can work with different data types.

A) True

B) False

Answer: A) True

Object Oriented Concepts Through CPP MCQ | Savitribai Public University Object Oriented Concepts Through CPP MCQ | SPPU Object Oriented Concepts Through CPP MCQ Object Oriented Concepts Through CPP  MCQ | Savitribai Public University Object Oriented Concepts Through CPP  MCQ  | SPPU Object Oriented Concepts Through CPP  MCQ Reviewed by technical_saurabh on June 26, 2021 Rating: 5

No comments:

Powered by Blogger.