0% found this document useful (0 votes)
36 views5 pages

IAT1-QB - Answer Key

This document is a question bank for an internal assessment test on Object Oriented Programming and Data Structures for the ECE department at Velammal College of Engineering and Technology. It includes various questions on topics such as class declaration, encapsulation, visibility modifiers, polymorphism, and operator overloading, along with definitions and examples. The assessment is structured into three parts, with a total of 50 marks allocated for the test.

Uploaded by

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

IAT1-QB - Answer Key

This document is a question bank for an internal assessment test on Object Oriented Programming and Data Structures for the ECE department at Velammal College of Engineering and Technology. It includes various questions on topics such as class declaration, encapsulation, visibility modifiers, polymorphism, and operator overloading, along with definitions and examples. The assessment is structured into three parts, with a total of 50 marks allocated for the test.

Uploaded by

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

VELAMMAL COLLEGE OF ENGINEERING AND TECHNOLOGY, MADURAI – 625 009

Department of Electronics and Communication Engineering


INTERNAL ASSESSMENT TEST – I –Question bank
Branch ECE Year/Sem./Sec. II / III / A&B
Course Code 21CS214 Date 21.08.2024
OBJECT ORIENTED PROGRAMMING
Course Name Max. marks 50
AND DATA STRUCTURES
Course Incharge Mr. M. Sakthivel Time 01:30 Hours
PART A (Answer All Questions) (8 X 2 = 16)
K CO Marks
Outline the class declaration in C++.
classclass name
{
Access Specifiers:
1. Member variable Declaration; 1 1 2
Member Function Declaration or Definition;
};

Outline the Encapsulation concept


The Wrapping up of data and functions into a single unit is known as 1 1 2
encapsulation. The data is kept safe from external interference and misuse
Define Object Oriented Programming
OOP is a method of implementation in which programs are organized as co-
operative collection of objects, each of which represents an instance of some 1 1 2
class and whose classes are all members of a hierarchy of classes united
through the property called Inheritance
Define the visibility modifiers in C++.
Private: Private keyword, means that no one can access the class members
declared private outside that class. If someone tries to access the private
member, they will get a compile time error.

Protected: Protected, is the last access specifier, and it is similar to private, it


makes class member inaccessible outside the class. But they can be accessed
2. 1 1 2
by any subclass of that class.

Public: Public, means all the class members declared under public will be
available to everyone. The data members and member functions declared
public can be accessed by other classes too.

What is a class?
A class is a group of objects that share common properties and behavior. For
1 1 2
example, we can consider a car as a class that has characteristics like steering wheels,
seats, brakes, etc.
State Data hiding concept.
Data hiding is a process of combining data and functions into a single unit.
private, public & protected are three types of protection/ access specifiers available within a 1 1 2
class. Usually, the data within a class is private & the functions are public. The data is hidden,
so that it will be safe from accidental manipulation
Examine the advantages of operator overloading?
Advantages:
It will act differently depending on the operands provided. Its called
extensibility.
3. It is not limited to work only with primitive Data Type. 1 1 2
By using this overloading we can easily acces the objects to perform any
operations.

It makes code much more readable


Describe the destructor?
It is used to destroy the objects that have been created by a constructor. It releases the 1 1 2
memory space for future use
State the difference between structures and class.
A structure is a grouping of variables of various data types referenced by the same name. In
1 1 2
C++, a class is defined as a collection of related variables and functions contained within a
single structure.
Describe Polymorphism in C++.
Polymorphism is an important concept of object-oriented programming. It simply
4. 1 1 2
means more than one form. That is, the same entity (function or operator) behaves
differently in different scenarios.
Give the various types of constructors.
1 1 2
1. Default constructor 2. Parameterized constructor 3. Copy constructor
Define data members and member functions.
The attributes in the objects are known as data members because they hold the
2 1 2
information. The functions that operate on these data are known as methods or
member functions.
Define constructor
A class constructor is a special member function of a class that is executed
whenever we create new objects of that class. A constructor will have exact
5. 1 1 2
same name as the class and it does not have any return type at all, not even
void

What are the characteristics of member functions?


Member functions are operators and functions that are declared as members of a class.
Member functions do not include operators and functions declared with the friend specifier. 1 1 2
These are called friends of a class. You can declare a member function as static ; this is called
a static member function.
What are the properties of a static data member?
 It is initialized to zero when the first object of its class is created.
 It is visible only within the class, but its lifetime is the entire program.
1 1 2
 Only one copy of that member is created for the entire class and it is shared by
all the objects of that class.

6. List out the operators which cannot be overloaded. 1 1 2


. (Member Access or Dot operator)
?: (Ternary or Conditional Operator )
:: (Scope Resolution Operator)
.* (Pointer-to-member Operator )
sizeof (Object size Operator)

What are the properties of a static member function?


A static member function cannot be declared with the keywords virtual , const ,
2 1 2
volatile , or const volatile . A static member function can access only the names of
static members, enumerators, and nested types of the class in which it is declared.
Define Encapsulation and Data Hiding.
The wrapping up of data and functions into a single unit is known as data
encapsulation. Here the data is not accessible to the outside world. The insulation 1 1 2
of data from direct access by the program is called data hiding or information
hiding.
State the concept of friend function?
7. A friend function is a function that is specified outside a class but has the ability to access 1 1 2
the class members' protected and private data
List out some of the benefits of OOP.
 Modularity for easier troubleshooting. When working with object-oriented programming
languages, you know exactly where to look when something goes wrong. ...
 Reuse of code through inheritance. ... 1 1 2
 Flexibility through polymorphism. ...
 Effective problem solving.

Give any four applications of OOPS


•Real-time systems.
•Simulation and modeling. 1 1 2
•Object-oriented databases.
•AI and expert systems.
Define object.
8. Objects are the basic run time entities in an object oriented system. They may 1 1 2
represent a person, a place or any item that a program has to handle.
What is a reference variable?
A reference variable is an alias, that is, another name for an already existing
1 1 2
variable. Once a reference is initialized with a variable, either the variable name
or the reference name may be used to refer to the variable
Write at least four rules for Operator overloading.
 Only the existing operators can be overloaded.
 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. 1 1 2
 Overloaded operators follow the syntax rules of the original operators.
 They cannot be overridden.

PART B (Answer All Questions) (2 X 13 = 26)


9. Describe operator overloading. Write the code for numerical operator ‘+’ overloading
Definition 3 Marks 2 1 13
Program 10 Marks
9. What is friend function? What is the use of using friend functions in c++? Explain
with a program. 2 1 13
Definition 3 marks program 10 marks
9. Explain the following concepts of object oriented programming in detail with
example
(i). Data abstraction
(ii). Inheritance 2 1 13
(iii). Polymorphism
(iv). Object
Definition 3 marks
10. List the different form of constructors with example program
2 1 13
Definition 3 marks program 10 marks
10. Explain about dynamic memory allocation with example program.
2 1 13
Definition 3 marks program 10 marks
10. Explain the concept of passing by reference and call by reference with
2 1 13
example program
PART C (Answer All Questions) (1 X 8 = 8)
11. Explain the function overloading with example programs
2 1 8
Definition 2 marks, Program 6 marks
11. Explain the basic concepts of OOPs with example.
2 1 8
Definition 8 marks
11. What is a structure and explain the members of structure with an example program. 2 1 8

Course Incharge Course Coordinator Module Coordinator HOD/ECE

You might also like