Vous êtes sur la page 1sur 25

Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

4202- A.C.T COLLEGE OF ENGINEERING & TECHNOLOGY


NELVOY -603107

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

QUESTION BANK

SUBJECT CODE : CS2203

SUBJECT NAME : OBJECT ORIENTED PROGRAMING

SEMESTER : III

YEAR : II

REGULATION : 2008

Prepared By

S.Venkatesan M.E

Asst.Prof/CSE. A.C.T.C.E.T

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 1


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

UNIT I

1. Define object oriented programming.

An Object oriented programming is an approach that provides a way of modularizing programs


by creating partitioned memory area for both data and functions that can be used as templates for
creating such modules on demand.

2. What is an object?

An Object is the basic run time entities in an object oriented system. They may represent a
person, a place or any data item. Objects contain data and code to manipulate data.

3. What is a class?

The entire set of data and code of an object that can be made a user defined data type with the
help of a class. A class is a collection of objects of type class.

4. What is dynamic binding?

Binding refers to the linking of a procedure call to the code to be executed in response to the call.
Dynamic binding also known as late binding means that the code associated with a given
procedure call is not known until the time of call at run time.

5. Define encapsulation.

Encapsulation is the process of combining data and functions into a single unit called class.
Using the method of encapsulation, the programmer cannot directly access the data. Data is only
accessible through the functions present inside the class. Data encapsulation led to the important
concept of data hiding.

6. Define data-hiding.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 2


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

Data members (attributes) in a class are declared as private and private members can be accessed
only by functions within the same class. This hides the data from being accessed by other
functions outside the class.

7. Define abstraction.

Abstraction is the process of hiding the inner working details. Classes provide the abstraction by
hiding the complex workings from the user and providing only the essential details.

8. What is inheritance?

Inheritance is the process by which new classes called derived classes are created from existing
classes called base classes. The derived classes have all the features of the base class and the
programmer can choose to add new features specific to the newly created derived class.

9. What is polymorphism?

Polymorphism is the ability to use an operator or function in different ways. Polymorphism gives
different meanings or functions to the operators or functions. Poly, referring too many, signifies
the many uses of these operators and functions. A single function usage or an operator
functioning in many ways can be called polymorphism. Polymorphism refers to codes,
operations or objects that behave differently in different contexts.

10. What is function overloading?

A function with the same name performing different operations is called function overloading.
To achieve function overloading, functions should be declared with the same name but different
number and type of arguments. This comes under compile time polymorphism.

11. What is operator overloading? Give example.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 3


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

The same operator performing different operations is called operator overloading. E.g. two
matrices cannot be directly overloaded. But the + operator can be overloaded to perform addition
of two matrices or other user defined data types.

12. Define a class.

Classes are data types based on which objects are created. Objects with similar properties and
methods are grouped together to form a Class. Thus a Class represents a set of individual objects.
Characteristics of an object are represented in a class as Properties. The actions that can be
performed by objects become functions of the class are referred to as Methods.

13. List out the applications of OOP.

 Real time systems


 Simulation and modeling
 Object oriented databases
 Hypertext, Hypermedia
 AI and expert systems
 Neural networks and parallel programming
 Decision support and office automation systems
 CIM/CAM/CAD systems

14. List out some of the benefits of OOP.

 Eliminate redundant code


 Saves development time and leads to higher productivity
 Helps to build secure programs
 Easy to partition work
 Small programs can be easily upgraded to large programs
 Software complexity can easily be managed

15. List out the string functions?


Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 4
Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

 String length
 String copy
 String concatenation
 String comparison
 String

16. What is the use of scope resolution operator?


A variable declared in an inner block cannot be accessed outside the block. To resolve this
problem the scope resolution operator is used. It can be used to uncover a hidden variable. This
operator allows access to the global version of the variable. It takes the form, :: variable-name

17. What is a static variable?


The static storage class allows to define a variable whose scope is restricted to either a block, a
function, or a file and extent is the life span of the program

18. Define an enumeration data type.


An enumerated data type is a user defined data type that provides a way for attaching names to
numbers thereby increasing comprehensibility of the code. The enum keyword is used which
automatically enumerates a list of words by assigning them values 0, 1, 2…
E.g. enum shape {circle, square, triangle};

19. Define token. What are the tokens used in C++?


The smallest individual units in a program are known as tokens. The various tokens in C++ are
keywords, identifiers, constants, strings and operators.

20. What is a pointer? What are the uses of a pointer?

Pointer is defined as a variable used to store memory addresses.

Uses:

 Accessing array elements.


 Passing arguments to a function when the function needs to modify the original.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 5


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

 Passing arrays and strings to functions.


 Creating data structures such as linked lists, binary tree etc.

21. What are the differences between structural and object oriented programming?

S.NO structural programming object oriented programming


1 Importance is given to data
Importance is given to functions

2 Reusability is possible through inheritance


Reusability of code is not possible

3 Provides class level and object level


Does not provide abstraction
abstraction

22. What is the use of the specifier ‘const’?


The “const” specifier before a variable makes it a constant whose value cannot be changed
during the program. Similarly if it is specified before a pointer, the address contained in the
pointer cannot be modified.

23. What does the “volatile” qualifier specify?


A variable or object declared with the volatile keyword may be modified externally from the
declaring object. Variables declared to be volatile will not be optimized by the compiler because
the compiler must assume that their values can change at any time. Note that operations on a
volatile variable in C and C++ are not guaranteed to be atomic.

24. Define static members.


Static members are not part of any object and they belong to the entire class. Static functions
cannot be referenced by objects. Static members cannot use the “this” pointer. Static data
members remember their value between function calls.
Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 6
Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

25. What are friend functions?


A friend function is used for accessing the non-public members of a class. A class can allow non-
member functions and other classes to access its own private data, by making them friends. Thus,
a friend function is an ordinary function or a member of another class.

26. What are the various access specifiers available in c++?


The various access specifiers available in C++ are
 private
 public
 protected

27. What are the operators which cannot be overloaded?

The following operators cannot be overloaded:

(i) The member access or data operator (.)

(ii) The scope resolution operator (: :)

(iii) The conditional operator (? :)

(iv) Pointer to member operator (. *)

28. List out the string functions?

 String length
 String copy
 String concatenation
 String comparison
 String conversions

29. What are the advantages of object oriented programming?


a. It is a natural way of programming.
b. It allows reusability of code through inheritance.
c. Writing even large programs is easy.
d. Testing and managing code are also made easy.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 7


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

30. What are abstract classes?


Classes containing at least one pure virtual function become abstract classes. Classes inheriting
abstract classes must redefine the pure virtual functions; otherwise the derived classes also will
become abstract. Abstract classes cannot be instantiated.

31. What is the use of default arguments?


Default arguments are used when a default value is to be supplied when the user does not
provide any values. The default values can be overridden by the values supplied by the user.

32. What is the use of scope resolution operator?


A variable declared in an inner block cannot be accessed outside the block. To resolve this
problem the scope resolution operator is used. It can be used to uncover a hidden variable. This
operator allows access to the global version of the variable. It takes the form, :: variable-name

33. Define implicit conversion.


Whenever data types are mixed in a expression, C++ performs the conversions automatically.
This process is known as implicit or automatic conversion.
e.g., m = 5 + 2.75;

34. What is call by reference?


When we pass arguments by reference, the formal arguments in the called function become the
aliases to the actual arguments in the calling function. Here the function works on the original
data rather than its copy.
e.g., void swap (int &a, int &b)
{
int t = a;
a = b;
b = t;
}

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 8


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

35. What are inline functions?


An inline function is a function that is expanded in line when it is invoked. Here, the compiler
replaces the function call with the corresponding function code. The inline function is defined as,
inline function-header
{
function body
}

36. Define function overloading.


A single function name can be used to perform different types of tasks. The same function name
can be used to handle different number and different types of arguments. This is known as
function overloading or function polymorphism.

37. List out the limitations of function overloading.


We should not overload unrelated functions and should reserve function overloading for
functions that perform closely related operations.

38. Define friend function.


An outside function can be made a friend to a class using the qualifier ‘friend’. The function
declaration should be preceded by the keyword friend. A friend function has full access rights to
the private members of a class.

39. What are the characteristics of a member function?

 Several different classes can use the same function name. The membership label
will resolve their scope.
 Member functions can access the private data of the class. A non member
function cannot do so.
 A member function can call another member function directly, without using the
dot operator.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 9


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

40. Distinguish between Procedure Oriented Programming and Object Oriented


Programming.

S.N Procedure Oriented Programming Object Oriented Programming


O
1 Emphasis is on algorithm. Emphasis is on data rather than procedure.

2 Large programs are divided into smaller Programs are divided into objects.
programs called functions.

3 Functions share global data Functions that operate on the data of an object are
tied together.

4 Data move openly around the system Data is hidden and cannot be accessed by external
from function to function. functions.

5 Employs top-down approach in program Follows bottom-up approach.


design.

UNIT II

41. Define Constructor.


A constructor is a special member function whose task is to initialize the objects of its class. It
has the same name as the class. It gets invoked whenever an object is created to that class. It is
called so since it constructs the values of data members of the class.

42. List some of the special characteristics of constructor.


 Constructors should be declared in the public section.
 They are invoked automatically when the objects are created.
 They do not have return types

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 10


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

 They cannot be inherited

43 what are the types of a constructor?

 Default constructor
 Parameterized constructor
 Copy constructor

44. State dynamic initialization of objects.


Class objects can be initialized dynamically. The initial values of an object may be provided
during run time. The advantage of dynamic initialization is that various initialization formats can
be used. It provides flexibility of using different data formats

45. Define destructor.

A destructor as the name implies is used to destroy the objects that have been created by a
constructor. Like a constructor the destructor is a member function whose name is the same as
the class name but is preceded by a tilde symbol.

46. What is static member function?


A member function that is declared as static has the following properties
 A static function can have access to only other static member declared in the same class
 A static member function can be called using the class name as follows

47. Define local classes.


Classes can be defined and used inside a function or a block. Such classes are called local
classes. It can use global variables and static variables declared inside the function but cannot use
automatic local variables.
Eg;
void test(int a)
{
…….
}
class student

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 11


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

{
………
};
student s1(a);
}
48. Define copy constructor.
A copy constructor is used to declare and initialize an object from another object. It takes a
reference to an object of the same class as an argument.
E.g.: integer i2 (i1);
Would define the object i2 at the same time initialize it to the values of i1. Another form of this
statement is
E.g.: integer i2=i1;
The process of initializing through a copy constructor is known as copy initialization.

49. Define const object.


We can create constant object by using const keyword before object declaration.
E.g.: Const matrix x (m,n);

50. Write some special characteristics of constructor.


 They should be declared in the public section
 They are invoked automatically when the objects are created
 They do not have return types, not even void and therefore, and they cannot return values
 They cannot be inherited, though a derived class can call the base class
 They can have default arguments
 Constructors cannot be virtual function

51. What is operator overloading?


C++ has the ability to provide the operators with a special meaning for a data type. This
mechanism of giving such special meanings to an operator is known as Operator overloading. It
provides a flexible option for the creation of new definitions for C++ operators.

52. Write at least four rules for Operator overloading.


 Only the existing operators can be overloaded.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 12


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

 The overloaded operator must have at least one operand that is of user defined data type.
 The basic meaning of the operator should not be changed.
 Overloaded operators follow the syntax rules of the original operators. They cannot be
overridden.

53. How will you overload Unary & Binary operator using member functions?
When unary operators are overloaded using member functions it takes no explicit arguments and
return no explicit values. When binary operators are overloaded using member functions, it takes
one explicit argument. Also the left hand side operand must be an object of the relevant class.

54. Define Garbage collection.


The technique used to handle the deal location automatically. When no references to an object
exists, that object is assumed to be no longer needed,& the memory occupied by the object can
be reclaimed. Garbage collection occurs sporadically during the execution of your program

55. How will you overload Unary & Binary operator using member functions?
When unary operators are overloaded using member functions it takes no explicit arguments and
return no explicit values. When binary operators are overloaded using member functions, it takes
one explicit argument. Also the left hand side operand must be an object of the relevant class.

56. What is the use of delete operator?

Delete operator is used to return the memory allocated by the new operator back to the memory
pool. Memory thus released will be reused by other parts of the program.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 13


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

UNIT III

55. What is an exception?


Exception refers to unexpected condition in a program. The unusual conditions could be faults,
causing an error which in turn causes the program to fail. The error handling mechanism of C++
is generally referred to as exception handling.

56. What are the types of exception?

They are classified into synchronous and asynchronous exceptions.

 Synchronous exception:
 Asynchronous exception:

57. What is a synchronous exception?

The exception which occur during program execution , due to some fault in the input data or
technique that is not suitable to handle the current class of data, within the program are known as
synchronous exception. For instance errors such as out-of-range, overflow, underflow and so on.

The technique that is not suitable to handle the current class of data, within the program is known
as synchronous exception

58. What is an Asynchronous exception?

The exceptions caused by events or faults unrelated to the program and beyond the
control of the program are called asynchronous exception. For instance, errors such as keyboard
interrupts, hardware malfunctions, disk failure, and so on.

The exceptions caused by events or faults unrelated to the program and beyond the control of
program are called asynchronous exceptions

59. What is a template?

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 14


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

Templates support generic programming, which allows developing reusable software


components such as functions, classes etc., and supporting different data types in a single
framework.

60. What is function template?

The templates declared for functions are called function templates. They perform appropriate
operations depending on the data type of the parameters passed to them.

61. What is a class template?

The templates declared for classes are called function templates. They perform appropriate
operations depending on the data type of the parameters passed to them.

62. Define runtime exceptions.

Runtime exceptions are automatically defined for the programs that we write and include
things such as division by zero and invalid array indexing.

63. What is Stack unwinding?

The process of calling destructor for automatic objects constructed on the path from a try-
block to a thrown expression is called stack unwinding

64. Define ‘this’ pointer.


A ‘this’ pointer refers to an object that currently invokes a member function. For e.g., the
function call a. show () will set the pointer ‘this’ to the address of the object ‘a’.

65. What are the two types of errors or bugs?

1. Logical errors-errors occur due to poor understanding of the problem and solution procedure
2. Syntax errors-errors that arise due to poor understanding of the language itself.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 15


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

66. What are the types of polymorphism?


The two types of polymorphism are
 Compile time polymorphism – The compiler selects the appropriate function for
a particular call at the compile time itself. It can be achieved by function
overloading and operator overloading.

 Run time Polymorphism - The compiler selects the appropriate function for a
particular call at the run time only. It can be achieved using virtual functions.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 16


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

Unit IV

66. Define inheritance.

Inheritance is the process of creating new classes from the existing classes. The new classes are
called derived classes. The existing classes are called base classes. The derived classes inherit all
the properties of the base class plus its own properties. The property of inheritance does not
affect the base classes.

67. What are the types of inheritance?

Single inheritance

 Multiple inheritance
 Hierarchical inheritance
 Multilevel inheritance.
 Hybrid inheritance
 Multipath inheritance

68. What are the advantages of using a derived class?

New classes can be derived by the user from the existing classes without any modification.

 It saves time and money.


 It reduces program coding time.
 It increases the reliability of the program.

69. Define abstract class.

A class is said to be an abstract class if it satisfies the following conditions:

 It should act as a base class


 It should not be used to create any objects

70. What is virtual function?

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 17


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

A member function whose definition can be changed during run time is called virtual function.
The class which contains virtual function is called polymorphic class and it should be a base
class. Different versions for the virtual function should be present in different derived classes
with same name as virtual function name.

71. Define pure virtual function.

A function qualified by the ‘virtual’ keyword is called virtual function. When a virtual function
is called through a pointer, class of the object pointed to determine which function definition will
be used.

Pure virtual function is a virtual function with no body. The general form is:

Virtual void member-function-name ( ) = 0;

72. What are the properties of pure virtual function?

 It has no definition in the base class.


 We cannot create object for the class containing pure virtual function.
 Pure virtual function can be called through derived class objects.
 It acts as an empty bucket which has to be filled by its derived classes.

73. What are the rules for virtual functions?

 Virtual functions must be members of some class.


 They cannot be static members.
 They are accessed by using object pointers.
 A virtual function can be a friend of another class.
 We can have virtual destructors, but we cannot have virtual constructors.
 A virtual function in a base class must be defined even though it may not be used.
 A pointer to a derived class cannot point an object of base type.
 When a pointer points to a derived class, incrementing or decrementing will not make it
point to the next object of the derived class.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 18


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

74. What is polymorphism?

Polymorphism is the ability to take more than one form. An operation may exhibit different
behaviors in different. The behavior depends upon the type of data used.

75. What is RTTI?

Run-time type information (RTTI) is a mechanism that allows the type of an object to be
determined during program execution

76. Write the purpose of typeid operator.

The typeid operator provides a program with the ability to retrieve the actual derived type of the
object referred to by a pointer or a reference. This operator is used along with the dynamic cast
operator

77. What is dynamic casting?

Dynamic cast allows us to downcast a data type from one to a more specific one in the same
hierarchy

78. Define down casting.

Downcasting is used to cast a pointer or reference to a base class to a derived class. Downcasting
is the opposite of the basic object-oriented rule, which states objects of a derived class, can
always be assigned to variables of a base class. Since base class variables can only sometimes be
assigned to variables of a derived class downcasting doesn’t always work

79. Write some of the basic rules for virtual functions.

• Virtual functions must be member of some class.


• They cannot be static members and they are accessed by using object pointers
• Virtual f unction in a base class must be defined.
• Prototypes of base class version of a virtual function and all the derived class versions must be

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 19


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

identical.
• If a virtual function is defined in the base class, it need not be redefined in the derived class.

80. Define Upcasting.

Upcasting means classes can easily converge to a general class

81. Define Compile time polymorphism:

The compiler while compiling the program resolves the function call or the operator call. This is
known as compile time polymorphism:

82. Define Runtime polymorphism.

During multiple inheritances if the appropriate member function could be selected while the
program is running is known as Runtime polymorphism

83. Define Run time type information:

It is a very powerful tool in c++ for finding out the type of an object at runtime. Because
of runtime functioning, RTTI also impacts the performance of the system to a notable extent.

84. What is a Stream?

Stream is a series of bytes, which act either as a source from which input data can be extracted or
as a destination to which the output can be sent. The source stream provides data to the program
called the input stream and the destination stream that receives data from the program is called
the output stream.

85. What is meant by Abstract base class?

A class that serves only as a base class from which derived classes is derived. No objects of an
abstract base class are created. A base class that contains pure virtual function is an abstract base
class.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 20


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

86. How do you classify ios class?

Istream – input stream does formatted input.

Ostream – output stream does formatted output.

Iostream – input / output stream does formatted input and output.

87. What are manipulators?

Manipulators are special functions that are specifically designed to modify the working of a
stream. They can be embedded in the I/O statements to modify the form parameters of a
stream.

88. What are the steps involved in manipulating a file?

 Name the file on the disk


 Open the file to get the file pointer.
 Process the file. (Read / Write )
 Check for errors while processing.
 Close the file after its complete usage.

89. What functions are used for manipulation of file pointers?

 seekg ( ) – Moves get file pointer to a specific location.


 seekp ( ) - Moves put file pointer to a specific location.
 tellg ( ) – Returns the current position of the get pointer
 tellp ( ) - Returns the current position of the put pointer

90. What do you mean by sequential access?

A sequential file has to be accessed sequentially; to access the particular data in the file all the
preceding data items have to be read and discarded. For example a file on a tape must be
accessed sequentially.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 21


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

91. What do you mean by random access?

A random file allows access to the specific data without the need for accessing its preceding data
items. However, it can be accessed sequentially. For example, a file on a hard disk or floppy disk
can be accessed either sequentially or randomly.

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 22


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

UNIT V

92. What are streams?

A Stream is a sequence of bytes. It can either as a source from which the input data can
be obtained or as a destination to which the output data can be sent

The stream source that provides data to the program is called the input stream and the
destination stream that receives output from the program is called output stream

93. What are the stream classes for console operations?

a)ios

b)istrean

c)ostream

d)iostream

e)streambuf

94. List out some of the formatted I/O operations

C++ supports a number of features that could be used for formatting the output. These features
include

a) ios stream class member functions and flags

b) Standard manipulators

c) User –defined manipulators

95. What is meant by namespace?

ANSI C++ Standard has added a new keyword namespace to define a scope that could
hold global identifiers. The best example of namespace scope is the C++ Standard Library. All
classes, functions and templates are declared within the namespace named std.

Using namespace std;

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 23


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

The using namespace statement specifies that the members defined in std namespace will be
used frequently throughout the program

96. What is unnamed namespaces?

An unnamed namespace is one that does not have a name. Unnamed namespace members
occupy global scope and are accessible in all scopes following the declaration in the file

97. What is container?

A container is an object that actually stores data. It is a way data is organized in memory.
The STL containers are implemented by template classes and therefore can be easily customized
to hold different types of data

98. What is an iterator?

An iterator is an object that points to an element in a container. We can use iterators to


move through the contents of containers. Iterators are handled just like pointers

99. What are the three types of containers?

The STL contains three types of containers

1) Sequence containers

2) Associative containers

3) Derived containers

100. What is meant by sequence containers?

Sequence containers store elements in a linear sequence, like a line. Each element is related to
other elements by its position along the line. They all expand themselves to allow insertion of
elements and all of them support a number of operations on them

101. What is meant by Derived Containers?

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 24


Question Bank –CS2203 OBJECT ORIENTED PROGRAMMING

The derived containers do not support iterators and therefore we cannot use them for data
manipulation. They support two member functions pop () and push () for implementing deleting
and inserting operations.

102. What is meant by vector?

The vector stores elements in contiguous memory locations and enables direct access to any
element using the subscript operator [].A vector can change its size dynamically and therefore
allocates memory as needed at run time

Dept. of CSE -A.C.T College of Engineering & Technology, Nelvoy Page 25

Vous aimerez peut-être aussi