UGC NET STUDY MATERIALS

OOPs & C++

                                           C++  BOOK(B)
===============================



Question 1


 Match the following

Static binding Choose... run time Derivation abstract class compile time

Dynamic binding Choose... run time Derivation abstract class compile time

virtual member function Choose... run time Derivation abstract class compile time

Inheritance Choose... run time Derivation abstract class compile time
==============================================================
Question 2

 ---------------- allows you to create a derived class that inherits properties from more than one base class.

. a. Multilevel inheritance

b. Multiple inheritance

c. Hybrid Inheritance

d. Hierarchical Inheritance
==============================================================

Question 3

 ---------------- is a mechanism of reusing and extending existing classes without modifying them, thus producing hierarchical relationships between them.

 a. Inheritance

b. Static Binding

c. Dynamic Binding

d. Virtual class
==============================================================

Question 4

----------------- is the ability of objects belonging to different types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior.

 a. Inheritance

b. Virtuality

c. polymorphism

d. None of these.
==============================================================

Question 5

 If a function is declared virtual in its base class, you can still access it directly using the ----------------------

 a. Virtual Keyword

b. scope resolution Operator

c. Indirection Operator

d. Address Operator
==============================================================

                                                         UNIT=2
==============================================================
Question 1


Match the following

this pointer Choose... not modifiable virtual tightly coupled not transitive

non static member function Choose... not modifiable virtual tightly coupled not transitive

friend function Choose... not modifiable virtual tightly coupled not transitive

Friend class Choose... not modifiable virtual tightly coupled not transitive
==============================================================
Question 2

 ---------- pointers are not modifiable.

a. that

b. this

c. Indirection

d. Address
==============================================================
Question 3

---------------- classes are used in cases where one class is tightly coupled to another class

 a. Abstract

b. friend

c. static

d. virtual
==============================================================
Question 4

 A static member function cannot be declared with the keywords ----------------

a. virtual

b. const

c. volatile

d. all of these
==============================================================
Question 5

 The --------- and ------------------- keywords do not apply to friend functions, as the class has no control over the scope of friends.

 a. public, protected

b. Private, public

c. protected , private

d. private , protected
==============================================================
                                                              UNIT=3
==============================================================
Question 1


 match the following

godbit Choose... End of file has been reached Fatal I/O error no errors non-fatal I/O error

eofbit Choose... End of file has been reached Fatal I/O error no errors non-fatal I/O error

failbit Choose... End of file has been reached Fatal I/O error no errors non-fatal I/O error

badbit Choose... End of file has been reached Fatal I/O error no errors non-fatal I/O error
==============================================================
Question 2

 The current reading position, which is the index of the next byte that will be read from the file is called _______________________.

 a. set pointer

b. curr pointer

c. put pointer

d. get pointer
==============================================================
Question 3
 The function_______________ will return the last read character and will move the inside pointer, one with -1 char.

 a. putback()

b. flush()

c. peek()

d. getline()
==============================================================
Question 4

 which of these file open mode do you use to write into the file.

 a. ios::ate

b. ios::in

c. ios::out

d. ios::app
==============================================================
Question 5

 __________________ is an identifier that can be inserted into an output stream or extracted from an input stream in order to produce a desired effect.

a. Stream

b. Manipulator

c. this

d. Flag
==============================================================
                                                    UNIT=4
==============================================================

Question 1


 A class generated from a class template is called _____________________

a. Inherited class

b. generated class.

c. derived class

d. base class
==============================================================
Question 2

A static data member generated from a static data member template is called ______________________ static data member

 a. inherited

b. base

c. generated

d. derived
==============================================================
Question 3

To perform identical operations for each type of data compactly and conveniently, we use ___________________

 a. Inline function

b. function templates.

c. this pointer

d. friend function
==============================================================
Question 4

 When the compiler generates a class, function or static data members from a template, it is referred to as __________________

 a. template instantiation.

b. template specialization

c. partial specialization

d. function specialization
==============================================================
Question 5

________________________ are very useful when implementing generic constructs like vectors, stacks, lists, queues which can be used with any arbitrary type.

a. Templates

b. constructor

c. destructor

d. status Flag
==============================================================
                                                   UNIT=5
==============================================================
Question 1


 What are the two basic models in the exception handling theory.

 a. caught and uncaught

b. termination and resumption

c. try and block

d. none of these
==============================================================
Question 2

which of these is/are the exception classes derived from logic_error i) domain_error ii) out_of_range iii) bad_cast iv) bad_alloc

 a. i),ii),iii) only

b. iv) only

c. i) and iv) only

d. iii) only

==============================================================
Question 3

Which of these is/are true about exception specification i) the exception specification is like function specification ii) it tells the use to write exception handling code and what exception to handle. iii) It tells the compiler the exception that may come out of this function.

 a. i) only

b. i) and ii) only

c. i),ii) and iii)

d. i) and iii) only
==============================================================
Question 4

______________ is the exception class derived from runtime_error.

 a. range_error

b. lengh_error

c. bad_typeid

d. met_error
==============================================================
                                                      UNIT=6
==============================================================
Question 1


Match the following

Stack Choose... FIFO LIFO associative container sequence container

Queue Choose... FIFO LIFO associative container sequence container

Vector Choose... FIFO LIFO associative container sequence container

multimap Choose... FIFO LIFO associative container sequence container
==============================================================
Question 2

 Stack is an example for ___________________ structure.

a. LIFO

b. FIFO

c. SISO

d. LILO
==============================================================
Question 3

The standard sequence containers include __________________ i) vector ii) deque iii)list iv) stack

a. i) and ii) only

b. i),ii) and iii)

c. iii) and iv) only

d. i),ii),iii) and iv)

==============================================================
Question 4

Which of this is standard associative containers ?

 a. vector

b. set

c. deque

d. list
==============================================================
                                                 1 MARKS QUIZ            ==============================================================
Question 1


 Which of these file open mode you use to delete all previous content in the file.

 a. ios:: ate

b. ios::in

c. ios:: app

d. ios::trunc
==============================================================
Question 2

Create the required classes by plugging in the actual type for the type parameters, this process is commonly known as _________________

a. Instantiating a class.

b. encapsulation of class

c. booting of class

d. none of these
==============================================================
Question 3

 __________________ is an abstraction that represents a device on which input and output operations are performed.

 a. Flag

b. Template

c. Stream

d. page
==============================================================
Question 4

 Which of these manipulator is used to insert null character in a string.

 a. endl

b. ends

c. unitbuf

d. setfill
==============================================================
Question 5

____________________ is very useful when templates of template come into usage.

. a. friend function

b. static function

c. typedef

d. inheritance
==============================================================
Question 6

 Each catch clause (exception handler) is like a little function that takes a ___________________ argument/s of one particular type.

 a. many

b. two

c. single

d. either A)or B)
==============================================================
Question 7

 Using the keyword_______________a class can grant access to non member functions or to another class.

 a. this

b. auto

c. static

d. friend

==============================================================
Question 8

 In UML classes are divided into ___________________ sections

 a. four

b. two

c. five

d. three
==============================================================
Question 9

_______________ are bound dynamically at run time.

 a. static class

b. virtual function

c. friend function

d. inline function
==============================================================
Question 10

 ___________________ is a base class that appears directly as a base specifier in the declaration of its derived class.

 a. direct base class

b. static base class

c. indirect base class

d. none of these.
==============================================================
Question 11

 The virtual keyword can be used to declare____________________

a. virtual friend function

b. virtual inline function

c. virtual base class

d. all of these
==============================================================
Question 12

 ________________ can be accessed without instantiation of the class in C++.

 a. Static data types

b. keywords

c. variables

d. friend functions
==============================================================
Question 13

 Use case diagrams are helpful in which of these areas.

 a. determining failure

b. communicating with clients

c. generating test cases

d. all of these
==============================================================
Question 14

 A class generated from a class template is called ____________________

 a. Inherited class

b. generated class.

c. derived class

d. base class
==============================================================
Question 15

STL stands for _________________

 a. standard template library

b. standard template link

c. stack template link

d. single temporary list

==============================================================
Question 16

 ________________ is a mechanism of reusing and extending existing classes without modifying them, thus producing hierarchical relationships between them.

 a. Inheritance

b. Static Binding

c. Dynamic Binding

d. Virtual class
==============================================================

Question 17

The function__________________ will return the last read character and will move the inside pointer, one with -1 char.

 a. putback()

b. flush()

c. peek()

d. getline()

==============================================================
Question 18

 Iterators which can move freely any number of steps in one operation are called ____________

 a. input iterators

b. forward iterators

c. random access iterators

d. output iterators
==============================================================
Question 19

Which of these is/are the exception classes derived from logic_error i) domain_error ii) out_of_range iii) bad_cast iv) bad_alloc

 a. i),ii),iii) only

b. iv) only

c. i) and iv) only

d. iii) only
==============================================================
Question 20

When the compiler generates a class, function or static data members from a template, it is referred to as ___________________

 a. template instantiation.

b. template specialization

c. partial specialization

d. function specialization

==============================================================
Question 21

 ____________ allows you to create a derived class that inherits properties from more than one base class.

a. Multilevel inheritance

b. Multiple inheritance

c. Hybrid Inheritance

d. Hierarchical Inheritance
==============================================================
Question 22

 ___________________ is an identifier that can be inserted into an output stream or extracted from an input stream in order to produce a desired effect.

 a. Stream

b. Manipulator

c. this

d. Flag
==============================================================
Question 23

 There are ________________ types of sequence containers in the STL.

 a. two

b. four

c. eight

d. three
==============================================================
Question 24

__________________ pointers are not modifiable.

 a. that

b. this

c. Indirection

d. Address
==============================================================
Question 25
The special function __________________ is called when you throw something other than what appears in the exception specification.

a. unexpected()

b. terminate()

c. set_terminate()

d. expected()
==============================================================
Question 26

Which of these link is used to avoid repetition of scenarios in multiple use cases.

 a. Include

b. Generalization

c. Extends

d. None of these
==============================================================
Question 27

Stack is an example for ____________________ structure.

 a. LIFO

b. FIFO

c. SISO

d. LILO
==============================================================
Question 28

 _________________ diagram shows the change of an object through time.

a. Activity

b. State

c. Collaboration

d. Use case
==============================================================
Question 29

 Identify the modulators from the following list. i. endl ii. hex iii. auto iv. Default

 a. i only

b. ii only

c. both i and ii

d. all of these
==============================================================
Question 30

A class that declares or inherits a virtual function is called ___________________

 a. Encapsulation class

b. inherited class

c. polymorphic class

d. static class
==============================================================
Question 31

 What are the two basic models in the exception handling theory.

. a. caught and uncaught

b. termination and resumption

c. try and block

d. none of these

==============================================================
Question 32

_______________ classes are used in cases where one class is tightly coupled to another class

a. Abstract

b. friend

c. static

d. virtual
==============================================================
Question 33

 The exception specification is like a____________________, It tells the user to write exception handling code and what exceptions to handle.

 a. library file

b. function prototype

c. header file

d. built-in function
==============================================================
Question 34

 The standard sequence containers include _______________________ i) vector ii) deque iii)list iv) stack

 a. i) and ii) only

b. i),ii) and iii)

c. iii) and iv) only

d. i),ii),iii) and iv)
==============================================================
Question 35

 Which of these c++ feature allow you to create classes that are dynamic in terms of the types of data they can handle.

 a. Inheritance

b. Templates

c. Polymorphism

d. information hiding
==============================================================
Question 36

 To destroy element at the end of vector which of these vector access function is used.

 a. pop_back()

b. push_back()

c. insert()

d. destroy()
==============================================================
Question 37

 Which of these exception reports a failure to allocate storage.

 a. bad_cast

b. bad_typeid

c. length_error

d. none of these
==============================================================
Question 38

 Models in UML consist of _______________ that interact by sending each other, messages.

a. Actor

b. objects

c. use case

d. none of these
==============================================================
Question 39

 ______________ do not break encapsulation, but rather enhance a class interface.

 a. Static functions

b. Friend functions

c. Dynamic functions

d. none of these
==============================================================
Question 40

The ___________________ keyword/s do not apply to friend functions, as the class has no control over the scope of friends.

a. public

b. protected

c. private

d. both A)and B)
==============================================================
                                        2 MARKS QUIZ
==============================================================
Question 1


Which of these function returns the ASCII code of the char, but not the char itself

 a. peek()

b. asc()

c. tellg()

d. seekp()
==============================================================
Question 2

 _________________ is the exception class derived from runtime_error.

 a. range_error

b. lengh_error

c. bad_typeid

d. met_error
==============================================================
Question 3

 The operator [] allows you to access a single character in a string, but without any bounds checking , if you want bounds checking which of these function do you use .

 a. at()

b. ioc()

c. st()

d. ooc()
==============================================================
Question 4

 The current reading position, which is the index of the next byte that will be read from the file is called _______________________

 a. set pointer

b. curr pointer

c. put pointer

d. get pointer
==============================================================
Question 5

 When you wish to show the sequence of events on a broader scale , use _______________________

 a. activity diagram

b. state diagram

c. both A) and B)

d. either A)or B)
==============================================================
Question 6

State true or false i. C++ provides syntax to allow you to politely tell the user what exceptions this function throws, so the user may handle them. ii. To use set_unexpected(), you must include the header file .
 a. true , false

b. false, false

c. true, true

d. false, true
==============================================================

Question 7

 A static member function cannot be declared with the keywords ________________________

a. virtual

b. const

c. volatile

d. all of these
==============================================================

Question 8

 If a function is declared virtual in its base class, you can still access it directly using the ______________________________

 a. Virtual Keyword

b. scope resolution Operator

c. Indirection Operator

d. Address Operator
==============================================================
Question 9

__________________ is the ability of objects belonging to different types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior.

a. Inheritance

b. Virtuality

c. polymorphism

d. None of these.
==============================================================
Question 10

 A static data member generated from a static data member template is called ______________________ static data member

 a. inherited

b. base

c. generated

d. derived
==============================================================
Question 11

 From the following list identify iterator adaptors ?

a. reverse iterator

b. insert iterator

c. raw storage iterator

d. all of these
==============================================================

Question 12

 State true or false i. You can partially specialize class templates for certain types. ii. You cannot overload function templates.

a. true, false

b. false, true

c. true, true

d. false, false
==============================================================
Question 13

 State true or false 1. Polymorphic functions are functions that cannot be applied to objects of more than one type. 2. Overloaded functions are statically bound at run time.

a. false, true

b. false, false

c. true , true

d. true, false
==============================================================
Question 14

The ______________________ and ______________________ keywords do not apply to friend functions, as the class has no control over the scope of friends.

a. public, protected

b. Private, public

c. protected , private

d. private , protected
==============================================================
Question 15

 State true or false 1. Inheritance is implemented in C++ through the mechanism of derivation. 2. Multiple inheritance allows you to create a derived class that inherits properties from more than one base class.

 a. true, true

b. true, false

c. false , true

d. false , false
==============================================================
Question 16

Which of these file open mode do you use to write into the file.

 a. ios ::ate

b. ios::in

c. ios::out

d. ios::app

==============================================================
Question 17

 To perform identical operations for each type of data compactly and conveniently, we use _____________________

a. Inline function

b. function templates.

c. this pointer

d. friend function
==============================================================
Question 18
Sate true or false i) Attributes that are static only exist once for all instances of the class. ii) If an attribute is declared final, its value can be changed.

a. true ,false

b. true , true

c. false , false

d. false, true
==============================================================
Question 19

 Which of this is standard associative containers ?

 a. vector

b. set

c. deque

d. list
==============================================================
Question 20

 Exceptions should not be used for_______________________

 a. asynchronous events

b. ordinary error condition

c. flow of control

d. all of the above
==============================================================
                                                     4 Marks Question
==============================================================
Question 2

 match the following

godbit Choose... non-fatal I/O error no errors End of file has been reached Fatal I/O error

eofbit Choose... non-fatal I/O error no errors End of file has been reached Fatal I/O error

failbit Choose... non-fatal I/O error no errors End of file has been reached Fatal I/O error

badbit Choose... non-fatal I/O error no errors End of file has been reached Fatal I/O error
==============================================================
Question 3

state true or false a. The class diagrams describes the types of objects in the system and the static relationship between them. b. If the attribute is declared final its value can be changed. c. The composition association is represented by the hollow diamond.

 a. true ,true, false

b. true, false, false

c. false, false, false

d. false , true, true
==============================================================
 Match the following

Stack Choose... LIFO associative container FIFO sequence container

Queue Choose... LIFO associative container FIFO sequence container

Vector Choose... LIFO associative container FIFO sequence container

multimap Choose... LIFO associative container FIFO sequence container
==============================================================
Question 5

 State true or false 1. A static member function cannot be declared with the keywords virtual, const, volatile, or const volatile. 2. A static member function can have access to the 'this' pointer of the class. 3. Friend classes are used in cases where one class is tightly coupled to another class. 4. Static data types can be accessed without instantiation of the class in C++.

a. true, true, false, false

b. true, true, true, false

c. true, false, true, true

d. false, true, true, true
==============================================================
Question 6

Match the following

Static binding Choose... compile time run time Derivation abstract class

Dynamic binding Choose... compile time run time Derivation abstract class

virtual member function Choose... compile time run time Derivation abstract class

Inheritance Choose... compile time run time Derivation abstract class
==============================================================
Question 7

 State true or false i. range_error is the exception class derived from logic_error Exception. ii. bad_cast is the exception class derived from logic_error Exception. iii. bad_alloc is the exception class derived from runtime_error Exception.

 a. true, false, true

b. false, true, true

c. true, true, false

d. true, true, true
==============================================================
Question 8

 Match the following

Link Choose... roles Include scenarios stereotypes

Actor Choose... roles Include scenarios stereotypes

extensibility mechanism Choose... roles Include scenarios stereotypes

use case Choose... roles Include scenarios stereotypes
==============================================================

Question 9

 State true or false i. STL algorithms are dependent of containers, which significantly reduces the complexity of the library. ii. Associative containers are not used to store objects that we want to be able to retrieve using a key. iii. Iterators are a generalized abstraction of pointers, designed to allow programmers to access different container types in a consistent way.

 a. false, false , true

b. true, false, false

c. true, true, false

d. true, true, true
==============================================================
Question 10

 Match the following

this pointer Choose... virtual tightly coupled not modifiable not transitive

non static member function Choose... virtual tightly coupled not modifiable not transitive

friend function Choose... virtual tightly coupled not modifiable not transitive

Friend class Choose... virtual tightly coupled not modifiable not transitive
==============================================================
Question 12

State true or false 1. A base class containing one or more pure virtual member function is called an abstract class. 2. Friend function can be declared anywhere within the class declaration. 3. The public and protected keywords do not apply to friend functions.

 a. true, true , true

b. false, true, false

c. true, false , false

d. false, false, false
==============================================================
Question 13

 Which of these is/are true about exception specification i) the exception specification is like function specification ii) it tells the use to write exception handling code and what exception to handle. iii)It tells the compiler the exception that may come out of this function.

 a. i) only

b. i) and ii) only

c. i),ii) and iii)

d. i) and iii) only
==============================================================

Question 14

 ___________________ are very useful when implementing generic constructs like vectors, stacks, lists, queues which can be used with any arbitrary type.

 a. Templates

b. constructor

c. destructor

d. status Flag
==============================================================
Question 15

 State true or false i. When you are reading a file, if you want to ignore certain amount of characters use flush() function . ii. Manipulators are global functions designed to be used in conjunction with insertion (<<) and extraction (>>) operators. iii. The essential characteristic of stream processing is that data elements must be sent to or received from a stream one at a time, i.e. in serial fashion. iv. The Input/Output system in C++ holds information about the result of every I/O operation.

Choose one answer. a. true, true, true, true

b. false, true, true, false

c. false, true, true, true

d. false, true, false, true
==============================================================

Popular Posts

Recent Posts