6 Definition and Terminology
6 Definition and Terminology
(Autonomous)
Dundigal, Hyderabad - 500 043
COURSE OBJECTIVES:
The students will try to learn:
COURSE OUTCOMES:
After successful completion of the course, students should be able to:
Page 2
In the top-down approach, an overview of the system is formulated
without going into detail for any part of it. Each part of it then refined
into more details, defining it in yet more details until the entire
specification is detailed enough to validate the model. .
9 Define bottom-up approach.
CO 1
In the bottom-up approach, individual parts of the system are specified in
detail. The parts are linked to form larger components, which are in turn
linked until a complete system is formed.
10 Define debugging.
CO 1
Debugging is the routine process of locating and removing bugs, errors or
abnormalities from programs.
11 Define testing.
CO 1
Object-Oriented testing is a software testing process that is conducted to
test the software using object-oriented paradigms like, encapsulation,
inheritance, polymorphism, etc.
12 Define inheritance.
CO 1
Inheritance can be defined as the process where one (parent/super) class
acquires the properties (methods and fields) of another (child/sub). With
the use of inheritance, the information is made manageable in a
hierarchical order.
13 Define polymorphism.
CO 1
Polymorphism is the ability of an object to perform different actions (or,
exhibit different behaviors) based on the context.
14 Define encapsulation.
CO 1
Encapsulation in Java is a mechanism for wrapping the data (variables)
and code acting on the data (methods) together as a single unit.
15 Define data hiding.
CO 1
Data hiding guarantees the restricted access of data from unwanted
sources and maintains data integrity by preventing unintended or
intended changes.
16 Define abstraction.
CO 1
Abstraction is a process of hiding the implementation details from the
user, only the functionality will be provided to the user. In other words,
the user will have the information on what the object does instead of how
it does.
17 Define entity abstraction.
CO 1
An object that represents a useful model of a problem domain or solution
domain entity.
Page 3
18 Define action abstraction.
CO 1
An object that provides a generalized set of operations, all of which
perform the same kind of function.
19 Define virtual machine abstraction.
CO 1
An object that groups operations that are all used by some superior level
of control, or operations that all use some junior-level set of operations.
20 Define coincidental abstraction.
CO 1
An object that packages a set of operations that have no relation to each
other.
21 Define protocol.
CO 1
A protocol denotes the ways in which an object may act and react and
thus constitutes the entire static and dynamic outside view of the
abstraction.
22 What is reusability?
CO 1
Code reusability is the capacity to repurpose pre-existing code when
developing new software applications.
23 What is platform independent?
CO 1
Platform independent refers to software that runs on a variety of
operating systems or hardware platforms
24 Define pass by value.
CO 1
The method parameter values are copied to another variable and then the
copied object is passed to the method.
25 Define pass by reference.
CO 1
Passing by reference refers to a method of passing the address of an
argument in the calling function to a corresponding parameter in the
called function.
26 What is function parameter?
CO 1
A function parameter is a variable declared in the prototype or
declaration of a function.
27 What is an argument?
CO 1
An argument is the value that is passed to the function in place of a
parameter.
28 What is a default argument?
CO 1
Page 4
The function assigns a default value to the parameter which does not have
a matching argument in the function call. They are useful in situations
where some arguments.
29 Define dynamic binding.
CO 1
Dynamic binding means that the code associated with a given procedure
call is not known until the time of the call at run-time.
30 Define Imperative Programming Paradigm.
CO 1
Imperative programming focuses on HOW to execute program logic and
defines control flow as statements that change a program state.
31 Define Declarative Programming Paradigm.
CO 1
Declarative programming focuses on WHAT to execute and defines
program logic, but not a detailed control flow.
32 Define Logical Programming Paradigm.
CO 1
Logical programming paradigm is based on formal logic, which refers to a
set of sentences expressing facts and rules about how to solve a problem.
33 Define Functional Programming Paradigm.
CO 1
Functional programming is a programming paradigm where programs are
constructed by applying and composing functions.
34 Define Database Programming Paradigm.
CO 1
Database programming model is used to manage data and information
structured as fields, records, and files.
35 What is meant by Structured Programming?
CO 1
Structured Programming refers to the method of programming which
consists of a completely structured control flow. Here structure refers to a
block, which contains a set of rules, and has a definitive control flow, such
as (if/then/else), (while and for), block structures, and subroutines.
36 What is the need for OOPs?
CO 1
With OOPs, the readability, understandability, and maintainability of the
code increase multifold.
37 Define data binding.
CO 1
Encapsulation is the process of binding the data members and the
methods together as a whole, as a class.
38 Define syntax in computer programming.
CO 1
Syntax in computer programming as the concept of giving specific word
sets in specific orders to computers so that they do what we want them to
do. Every programming language uses different word sets in different
orders, which means that each programming language uses its own syntax.
Page 5
39 What is an inline function?
CO 1
An inline function is a technique used by the compilers and instructs to
insert complete body of the function wherever that function is used in the
program source code.
40 What are tokens?
CO 1
A compiler recognizes a token, and it cannot be broken down into
component elements. Keywords, identifiers, constants, string literals, and
operators are examples of tokens.
MODULE II
CLASSES AND OBJECTS
1 Define object.
CO 2
Object is the basic unit of object-oriented programming. That is both
data and functions that operate on data are bundled as a unit called an
object.
2 Define class.
CO 2
In object-oriented programming, a class is a template definition of the
methods and variables in a particular kind of object. Thus, an object is a
specific instance of a class; it contains real values instead of variables.
3 Define object data.
CO 2
An object can be defined as a data field that has unique attributes and
behavior.
4 Define object behavior.
CO 2
Behaviors are the tasks that an object performs.
5 Define attribute.
CO 2
Attributes are data members inside a class or an object that represent the
different features of the class.
6 Define methods.
CO 2
A method is a programmed procedure that is defined as part of a class
and is available to any object instantiated from that class.
7 Define messages.
CO 2
Message passing is a method of transferring communications among items
or threads, is an essential idea in distributed systems and parallel
programming.
8 Define interface.
CO 2
Page 6
An interface is a collection of an abstract method. If the class implements
an interface, it thereby inherits all the abstract methods of an interface.
9 Define IS-A relationships.
CO 2
In object-oriented programming, the concept of IS-A is a totally based on
Inheritance, which can be of two types Class Inheritance or Interface
Inheritance.
10 Define composition.
CO 2
Composition is the design technique in object-oriented programming to
implement has-a relationship between objects.
11 Define HAS-A relationships.
CO 2
Composition(HAS-A) mean the use of instance variables that are
references to other objects.
12 Define access modifiers.
CO 2
The access modifiers specifies the accessibility or scope of a field, method,
constructor, or class.
13 Define public access modifier.
CO 2
Public - members are accessible from outside the class .
14 Define protected access modifier.
CO 2
protected - members cannot be accessed from outside the class, however,
they can be accessed in inherited classes.
15 Define private access modifier.
CO 2
private - members cannot be accessed (or viewed) from outside the class
16 Define return type.
CO 2
The return type specifies the data type of the value that the function will
return.
17 What is a member function?
CO2
Functions that are declared within the class definition are referred as
member function
18 Define abstract class.
CO 2
An abstract class is a class that is designed to be specifically used as a
base class. An abstract class contains at least one pure virtual function.
19 Define final class.
CO 2
The final class is a class that is declared with the final keyword.
20 Define template class.
CO 2
Page 7
Template class is an instance of a class template.
21 What is nested class?
CO 2
A nested class is a member of its enclosing class.
22 What is the purpose of ‘this’ keyword?
CO 2
To refer to the current object of a class, this keyword is used. It is used as
a pointer that differentiates between the global object and the current
object by referring to the current one.
23 What is the scope of object?
CO 2
The region where an object is visible is referred to as its scope.
24 What is static access modifier?
CO 2
This modifier is used to check that a member is a class member or
instance member. If you declare a class as static, this class will be
executed first.
25 What is the purpose of ’abstract’ keyword?
CO 2
Abstract is a keyword that is used with a class or a method. An abstract
class or abstract method is used for further modification. If a class is
declared as ‘abstract’, the class cannot be instantiated.
26 Which is the default access modifier?
CO 2
‘Internal’ is the default access modifier if no access modifier is mentioned
with a class or its members. Internal is a keyword that is used for
declaration.
27 What is the default access modifier for Interface?
CO 2
The public is the default access modifier for the interface. No other access
modifier is allowed for them.
28 What is access modifier for enumeration?
CO 2
Enumeration members are always public. No other access modifiers are
allowed.
29 What is visibility control?
CO 2
Visibility control allows you to control where class members can be
accessed from, for instance, to prevent a certain variable from being
modified from outside the class.
30 Define modularity.
CO 2
Modularity refers to an organizing structure in which different components
of a software system are divided into separate functional units.
31 What is memory allocation?
CO 2
Page 8
Memory allocation is a process by which computer programs and services
are assigned with physical or virtual memory space.
32 What is memory deallocation?
CO 2
Memory deallocation is necessary to free up the memory occupied by the
object once the object is no longer needed.
33 Define dynamic memory allocation.
CO 2
Allocation of memory at the time of execution (run time) is known as
dynamic memory allocation. .
34 Define heap allocation.
CO 2
The memory is allocated during the execution of instructions written by
programmers. Note that the name heap has nothing to do with the heap
data structure. It is called a heap because it is a pile of memory space
available to programmers to allocate and de-allocate.
35 What is the purpose of ’delete’ operator?
CO 2
The delete operator is used to deallocate i.e., it releases the memory
which was allocated by the new operator through its pointer.
36 What is the purpose of ’new’ operator?
CO 2
The ‘new’ operator is used to dynamically allocate the memory for
objects which returns 4 pointer to it.
37 What is the purpose of ’static’ keyword?
CO2
The static keyword is used for a constant variable or a method that is the
same for every instance of a class.
38 What is a non static member function?
CO 2
A non-static member function is a function that is declared in a member
specification of a class without a static or friend specifier.
39 Define static member.
CO 2
When a data member is declared as static , only one copy of the data is
maintained for all objects of the class.
40 Define static methods.
CO 2
A static method is a method that belongs to a class rather than an
instance of a class. This means you can call a static method without
creating an object of the class.
Page 9
MODULE III
SPECIAL MEMBER FUNCTIONS AND OVERLOADING
1 Define constructor.
CO 3
A constructor is a method used to initialize the state of an object, and it
gets invoked at the time of object creation.
2 Define destructor.
CO 3
A destructor is a method which is automatically called when the object is
made of scope or destroyed.
3 Define copy constructor.
CO 3
A copy constructor is used to declare and initialize an object from
another object.
4 Define dynamic constructor.
CO 3
When allocation of memory is done dynamically using dynamic memory
allocator new in a constructor, it is known as dynamic constructor.
5 Define parameterized constructors.
CO 3
A constructor is called Parameterized Constructor when it accepts a
specific number of parameters. To initialize data members of a class with
distinct values.
6 Define function overloading.
CO 3
Function overloading is a feature of object-oriented programming where
two or more functions can have the same name but different parameters.
7 Define constructor overloading.
CO 3
Constructor overloading can be defined as having multiple constructors
with different parameters so that every constructor can perform a
different task.
8 Define operator overloading.
CO 3
Operator overloading is a technique by which operators used in a
programming language are implemented in user-defined types with
customized logic that is based on the types of arguments passed.
9 Define method overriding.
CO 3
Method Overriding means that the code comprises of two or more
methods with the same name but each of them has a special task and
that to differ from each other.
10 Name three operators that can not be overloaded.
CO 3
Page 10
Scope resolution operator, Pointer to member operator and dot or
Member access operator.
11 What are the 3 types of constructor? CO 3
Default, Parameterized and Copy constructors.
12 What is constructor rule of 3?
CO 3
The Rule of Three suggests that if you need to define any of a copy
constructor, copy assignment operator or destructor then you would
usually need to define “all three”.
13 What is the rule of 5 default constructor?
CO 3
The rule of 5 states that if a class has a user-declared destructor, copy
constructor, copy assignment constructor, move constructor, or move
assignment constructor, then it must have the other 4.
14 What is rule of zero constructor?
CO 3
This rule is also known as “the rule of zero“. That means, that you can
avoid writing any custom constructor, copy/move constructors,
assignment operators, or destructors by using types that support the
appropriate copy/move semantics.
15 Which keyword is not allowed for constructor?
CO 3
The static , final and abstract keywords are not meaningful for a
constructor because: static members belong to a class, but the
constructor is needed to create an object.
16 Why is constructor not overridden?
CO 3
If you try to write a super class’s constructor in the sub class compiler
treats it as a method and expects a return type and generates a compile
time error.
17 What are the modifiers applicable to constructors?
CO 3
The only applicable modifiers in java for the constructors are public,
default, private, protected.
18 What is the purpose of destructors?
CO 3
The main purpose of destructor is to free all the resources (opened files,
opened sockets, database connections, resource locks etc.) which are
allocated during your object’s life time.
19 What is the use of a constructor?
CO 3
Constructor is used to initialize the instance variables of an object while
creating it. Constructor is also used to create virtual tables for virtual
functions.
20 What is the order of constructor execution?
CO 3
Page 11
First base class constructor is executed and then derived class constructor,
so execution happens from top to bottom in the inheritance tree.
21 What is the order of destructor execution?
CO 3
Generally derived class destructor, and then base class destructor. Except
in case we are taking a derived class object into a base-class pointer (or
reference variable), and we forget to give a virtual keyword for base class
destructor.
22 What is the purpose of virtual destructor?
CO 3
This is to make sure that the correct class destructor is called at run time.
Specifically when we use base class pointer or reference to hold the
derived class object. If we don’t have virtual destructor, then it will end
up in calling only base class destructor.
23 What is method signature? What are the things it consist of ?
CO 3
Method signature is used by the compiler to differentiate the methods.
Method signature consists of three things. A) Method name, B) Number
of arguments, C) Types of arguments.
24 How do compiler differentiate overloaded methods from
duplicate methods? CO 3
Page 12
Binding of overridden methods happen at runtime is known as dynamic
binding.
30 What are generic types?
CO 3
Generic types are a way of creating classes or methods that can work with
multiple data types.
31 What is autoboxing?
CO 3
Autoboxing is the automatic conversion of a primitive data type into its
corresponding object wrapper class.
32 What are variable arguments?
CO 3
Variable arguments allow a method to accept an arbitrary number of
arguments.
33 What is covariant return type?
CO 3
A covariant return type is a return type that is allowed to vary in type
from the original method declaration.
34 What is the rule for unary operator overloading?
CO 3
If unary operators are overloaded by a member function, then they take
no explicit arguments. But if they are overloaded through a friend
function, then take one argument.
35 What is the rule for binary operator overloading?
CO 3
If binary operators are overloaded by a member function, then they take
one explicit argument. But, if they are overloaded through a friend
function, then take two arguments.
36 How does the operator function differ from the normal
function? CO 3
Page 13
40 How many types of friend functions are there?
CO 3
A friend can be a function, function template, member function, or a class
or class template, in which case the entire class and all of its members are
friends.
MODULE IV
INHERITANCE AND POLYMORPHISM
1 Define subclass.
CO 4
A class that is derived from another class is called a subclass (also a
derived class, extended class, or child class).
2 Define superclass.
CO 4
The class from which the subclass is derived is called a superclass (also a
base class or a parent class).
3 Define generalization.
CO 4
Generalization process starts with the number of entity sets and it creates
high-level entity with the help of some common features.
4 Define specialization.
CO 4
Specialization process starts from a single entity set and it creates a
different entity set by using some different features.
5 Define base class.
CO 4
A base class is an existing class from which the other classes are
determined and properties are inherited.
6 Define derived class.
CO 4
A class that is created from an existing class. The derived class inherits
all members and member functions of a base class.
7 Define final keyword.
CO 4
The final keyword is a non-access modifier used for classes, attributes and
methods, which makes them non-changeable (impossible to inherit or
override).
8 Define super keyword.
CO 4
The super keyword keyword is used to forward a constructor’s call to a
constructor in the superclass. It invokes the overridden method that
allows access to these methods and the superclass’s hidden members.
9 Define compile time polymorphism.
CO 4
Compile-time polymorphism is a polymorphism that is resolved during
the compilation process.
Page 14
10 Define runtime polymorphism.
CO 4
Whenever an object is bound with the functionality at run time, this is
known as runtime polymorphism.
11 Define virtual function.
CO 4
The functions that help achieve runtime polymorphism are a part of
functions present in the parent class and overridden by a subclass.
12 Define pure virtual function.
CO 4
A pure virtual member function is a member function that the base class
forces derived classes to provide. Any class containing any pure virtual
function cannot be used to create object of its own type.
13 Define static polymorphism.
CO 4
Static Polymorphism is the linking of a function with an object during
compile time is called static.
14 Define dynamic polymorphism.
CO 4
Dynamic polymorphism is a process or mechanism in which a call to an
overridden method is to resolve at runtime rather than compile-time.
15 Define single inheritance.
CO 4
The inheritance in which a single derived class is inherited from a single
base class is known as the Single Inheritance.
16 Define multiple inheritance.
CO 4
Multiple inheritance means that a subclass can inherit from two or more
superclasses.
17 Define multilevel inheritance.
CO 4
In the Multilevel inheritance, a derived class will inherit a base class and
as well as the derived class also act as the base class to other class.
18 Define multipath inheritance.
CO 4
In this inheritance, a derived class is created from other derived classes
and the same base class of other derived classes.
19 Define hierarchical inheritance.
CO 4
If more than one class is inherited from the base class, it’s known as
hierarchical inheritance.
20 Define hybrid inheritance.
CO 4
the hybrid inheritance is the composition of two or more types of
inheritance.
21 What is an abstract function?
CO 4
Page 15
An abstract function is a function declared only in the base class. It is
redefined in the subclass as it does not contain any definition in the base
class.
22 What is the purpose of hybrid inheritance?
CO 4
The main advantages of Hybrid Inheritance are the ”Reusability” and
”Modularity” of the code.
23 Why do we need multilevel inheritance?
CO 4
We use multilevel inheritance in Java to create a hierarchy of classes
where a child class inherits from another child class, enabling code reuse
and organizing classes in a structured way.
24 What is the problem with multilevel inheritance?
CO 4
The issue with multilevel inheritance is that it may cause difficulties in
understanding and debugging, affecting code readability and reliability.
25 What is access modifiers in inheritance?
CO 4
Access modifiers affect inheritance by determining which members of the
superclass can be inherited by the subclass.
26 What is the role of access specifiers in inheritance?
CO 4
The access specifiers only affect whether outsiders and derived classes can
access those members. Second, when derived classes inherit members,
those members may change access specifiers in the derived class.
27 Define child class.
CO 4
The class that inherits the characteristics of another class is known as the
child class.
28 Define parent class.
CO 4
The class from which the child class inherits its properties is called the
parent class.
29 What is public inheritance?
CO 4
The public members of the base class remain public even in the derived
class; the same applies to the protected members.
30 What is private inheritance?
CO 4
This makes public members and protected members from the base class to
be protected in the derived class. The derived class has no access to the
base class’s private members.
31 What is protected inheritance?
CO 4
Protected Inheritance protects the Public and protected members from
the derived class’s base class.
Page 16
32 Define public visibility mode.
CO 4
The derived class can access the Public and protected members of the base
class but not the private members if the visibility mode is set to Public.
33 Define private visibility mode.
CO 4
If the visibility mode is set to private, the derived class can secretly access
the Public and protected members of a base class.
34 Define protected visibility mode.
CO 4
The derived class can access the protected and public members of the
base class protectively when the visibility mode is protected.
35 How is inheritance useful to achieve polymorphism?
CO 4
Inheritance represents the parent-child relationship between two classes
and polymorphism take the advantage of that relationship to add
dynamic behavior in the code.
36 How to achieve or implement static polymorphism?
CO 4
Static polymorphism can be achieved by method overloading.
37 What is the limit for polymorphism?
CO 4
Parent class, Final methods, and static methods can not be overridden.
MODULE V
CONSOLE I/O AND WORKING WITH FILES
1 What are streams in programming?
CO 5
Stream refers to the data that is transmitted when the content is
consumed.
2 Define file in OOP.
CO 5
A File is a collection of data stored in the secondary memory.
3 What is a directory file?
CO 5
A directory is a unique type of file that contains only the information
needed to access files or other directories.
4 What is a device file?
CO 5
A device file is a reserved keyword used in PC DOS, TOS, OS/2, and
Windows systems to allow access to certain ports and devices.
5 Define record in programming.
CO 5
A record is a data structure that consists of a fixed number of variables,
called fields
6 Define field in programming.
CO 5
Page 17
A field is a variable of any type that is declared directly in a class or
struct.
7 What is an application file?
CO 5
An application file or an application package is a digital file that contains
all the necessary elements to run a specific software application.
8 What is a system file?
CO 5
A system file is a critical file that is part of an operating system or a
device driver. System files should be complete and present in a system for
the system to function properly. When system files are corrupted by
malware, users must know how to re-install or restore system files.
9 What are the various modes to work with files?
CO 5
Read mode, write mode, append mode and, read and write mode.
10 When read mode is used while working with files?
CO 5
If you are going to just read an existing file and you do not want to write
any further content in the file, then you will open the file in read-only
mode.
11 What is a data stream?
CO 5
A data stream is a countable infinite sequence of items and is used to
represent data items that are available over time.
12 What are the two basic types of data streaming?
CO 5
The two basic types of data streaming in a computer are input streams,
and output streams.
13 What is stream classes in OOP?
CO 5
The Stream class defines objects which accepts a sequence of characters.
14 Define byte stream.
CO 5
The byte stream classes provide a convenient means for handling input
and output of bytes and character streams provide a convenient means for
handling input and output of characters, respectively.
15 Why is stream classification important?
CO 5
It provides a template to understand and generalize stream responses to
disturbance and assist in determining best mitigation practices.
16 When append mode is used while working with files?
CO 5
Append mode is a write mode, which allows content to be appended at
the end of the file.
17 Define unformatted I/O operations.
CO 5
Page 18
Unformatted I/O functions are used only for character data type or
character array/string and cannot be used for any other datatype.
18 What are manipulators in OOP?
CO 5
Manipulators are helping functions that can modify the input/output
stream.
19 What is file operation?
CO 5
The various operations which can be implemented on a file such as read,
write, open and close etc. are called file operations.
20 List various file operations.
CO 5
create, delete, read, write, open, close, and seek
21 What is a file block?
CO 5
Blocks are fixed-length chunks of data that are read into memory when
requested by an application.
22 What is file pointer?
CO 5
The file pointer is actually a structure that stores the file data such as the
file name, its location, mode, and the current position in the file.
23 What is syntax in code?
CO 5
Syntax is the set of rules that define what the various combinations of
symbols mean.
24 Define input stream.
CO 5
Input streams are used for reading input from some input source.
25 What is file handling?
CO 5
The process of file handling refers to how we store the available data or
info in a file with the help of a program.
26 What is file level storage?
CO 5
It is a hierarchical storage methodology used to organize and store data
on a computer hard drive or on network-attached storage (NAS) device.
27 When read and write mode is used while working with files?
CO 5
If you are going to read as well as write into the same file, then you will
open file in read and write mode.
28 What is the size of block file?
CO 5
The block size of a filesystem determines how many bytes are allocated to
each block on the filesystem.
29 What is a text file?
CO 5
Page 19
A text file is a kind of computer file that is structured as a sequence of
lines of electronic text.
30 What is a binary file?
CO 5
A binary file is a file whose content is in a binary format consisting of a
series of sequential bytes, each of which is eight bits in length.
31 Define output stream.
CO 5
Output streams are used for writing data to some output source.
32 When write mode is used while working with files?
CO 5
If you are going to write into either an existing file or a newly created file
but you do not want to read any written content from that file, then you
will open the file in write-only mode.
33 What is the syntax for opening a file?
CO 5
ptr = fopen(”fileopen”,”mode”);
34 What is the syntax of file?
CO 5
File* fopen(char* name, char* mode);
Page 20