Object Oriented MCQ Set 1
1. Passing object to a function ___
a) Can be done only in one way
b) Can be done in more than one ways
c) Is not possible
d) Is not possible in OOP
Answer
Answer: b [Reason:] The objects can be passed to the functions and this requires OOP concept because objects are main part of OOP. The objects can be passed in more than one way to a function. The passing depends on how the object have to be used.
2. The object ____
a) Can be passed by reference
b) Can be passed by value
c) Can be passed by reference or value
d) Can be passed with reference
Answer
Answer: c [Reason:] The objects can be passed by reference if required to use the same object. The values can be passed so that the main object remains same and no changes are made to it if the function makes any changes to the values being passed.
3. Which symbol should be used to pass the object by reference in C++?
a) &
b) @
c) $
d) $ or &
Answer
Answer: a [Reason:] The object to be passed by reference to the function should be preceded by & symbol in the argument list syntax of the function. This indicates the compiler not to use new object. The same object which is being passed have to be used.
4. If object is passed by value, ____
a) Copy constructor is used to copy the values into another object in the function
b) Copy constructor is used to copy the values into temporary object
c) Reference to the object is used to access the values of the object
d) Reference to the object is used to created new object in its place
Answer
Answer: a [Reason:] The copy constructor is used. This constructor is used to copy the values into a new object which will contain all the values same as that of the object being passed but any changes made to the newly created object will not affect the original object.
5. Pass by reference of an object to a function ___
a) Affects the object in called function only
b) Affects the object in prototype only
c) Affects the object in caller function
d) Affects the object only if mentioned with & symbol with every call
Answer
Answer: c [Reason:] The original object in the caller function will get affected. The changes made in the called function will be same in the caller function object also.
6. Copy constructor definition requires ______
a) Object to be passed by value
b) Object not to be passed to it
c) Object to be passed by reference
d) Object to be passed with each data member value
Answer
Answer: c [Reason:] The object must be passed by reference to a copy constructor. This is to avoid the out of memory error. The constructors keeps calling itself, if not passed by reference, and goes out of memory.
7. What is the type of object that should be specified in argument list?
a) Function name
b) Object name itself
c) Caller function name
d) Class name of object
Answer
Answer: d [Reason:] The type of object is the class itself. The class name have to be specified in order to pass the objects to a function. This allows the program to create another object of same class or to use the same object that was passed.
8. If an object is passed by value, _____
a) Temporary object is used in the function
b) Local object in the function is used
c) Only the data member values are used
d) The values are accessible from the original object
Answer
Answer: b [Reason:] When an object is called by values, copy constructor is called and object is copied to the local object of the function which is mentioned in the argument list. The values gets copied and are used from the local object. There is no need to access the original object again.
9. Can data members be passed to a function using the object?
a) Yes, it can be passed only inside class functions
b) Yes, only if the data members are public and are being passed to a function outside the class
c) No, can’t be passed outside the class
d) No, can’t be done
Answer
Answer: b [Reason:] The data members can be passed with help of object but only if the member is public. The object will obviously be used outside the class. The object must have access to the data member so that its value or reference is used outside the class which is possible only if the member is public.
10. What exactly is passed when an object is passed by reference?
a) The original object name
b) The original object class name
c) The exact address of the object in memory
d) The exact address of data members
Answer
Answer: c [Reason:] The location of the object, that is, the exact memory location is passed, when the object is passed by reference. The pass by reference is actually a reference to the object that the function uses with another name to the same memory location as the original object uses.
11. If the object is not to be passed to any function but the values of the object have to be used then:
a) The data members should be passed separately
b) The data members and member functions have to be passed separately
c) The values should be present in other variables
d) The object must be passed
Answer
Answer: a [Reason:] The data members can be passed separately. There is no need to pass whole object, instead we can use the object to pass only the required values.
12. Which among the following is true?
a) More than one object can’t be passed to a function
b) Any number of objects can be passed to a function
c) Objects can’t be passed, only data member values can be passed
d) Objects should be passed only if those are public in class
Answer
Answer: b [Reason:] There is no restriction on passing the number of objects to a function. The operating system or the compiler or environment may limit the number of arguments. But there is no limit on number of objects till that limit.
13. What will be the output if all necessary code is included (Header files and main function)?
void test (Object &y) { y = "It is a string"; } void main() { Object x = null; test (x); System.out.println (x); }
a) Run time error
b) Compiler time error
c) Null
d) It is a string
Answer
Answer: d [Reason:] This is because the x object is passed by reference. The changes made inside the function will be applicable to original function too.
14. In which type is new memory location will be allocated?
a) Only in pass by reference
b) Only in pass by value
c) Both in pass by reference and value
d) Depends on the code
Answer
Answer: b [Reason:] The new memory location will be allocated only if the object is passed by value. Reference uses the same memory address and is denoted by another name also. But in pass by value, another object is created and new memory space is allocated for it.
15. Pass by reference and pass by value can’t be done simultaneously in a single function argument list.
a) True
b) False
Answer
Answer: b [Reason:] There is no condition which specifies that only the reference pass or values pass is allowed. The argument list ca contain one reference pass and another value pass. This helps to manipulate the objects with functions more easily.
Object Oriented MCQ Set 2
1. Which is private member functions access scope?
a) Member functions which can only be used within the class
b) Member functions which can used outside the class
c) Member functions which are accessible in derived class
d) Member functions which can’t be accessed inside the class
Answer
Answer: a [Reason:] The member functions can be accessed inside the class only if they are private. The access is scope is limited to ensure the security of the private members and their usage.
2. Which among the following is true?
a) The private members can’t be accessed by public members of the class
b) The private members can be accessed by public members of the class
c) The private members can be accessed only by the private members of the class
d) The private members can’t be accessed by the protected members of the class
Answer
Answer: b [Reason:] The private members are accessible within the class. There is no restriction on use of private members by public or protected members. All the members can access the private member functions of the class.
3. Which member can never be accessed by inherited classes?
a) Private member function
b) Public member function
c) Protected member function
d) All can be accessed
Answer
Answer: a [Reason:] The private member functions can never be accessed in the derived classes. The access specifiers is of maximum security that allows only the members of self class to access the private member functions.
4. Which syntax among the following shows that a member is private in a class?
a) private: functionName(parameters)
b) private(functionName(parameters))
c) private functionName(parameters)
d) private::functionName(parameters)
Answer
Answer: c [Reason:] The function declaration must contain private keyword follower by the return type and function name. Private keyword is followed by normal function declaration.
5. If private member functions are to be declared in C++ then _______
a) private:
b) private
c) private(private member list)
d) private :- <private members>
Answer
Answer: a [Reason:] The private members doesn’t have to have the keyword with each private member. We only have to specify the keyword private followed by single colon and then private member’s are listed.
6. In java, which rule must be followed?
a) Keyword private preceding list of private member’s
b) Keyword private with a colon before list of private member’s
c) Keyword private with arrow before each private member
d) Keyword private preceding each private member
Answer
Answer: d [Reason:] The private keyword must be mentioned before each private member. Unlike the rule in C++ to specify private once and list all other private member’s, in java all member declarations must be preceded by the keyword private.
7. How many private member functions are allowed in a class ?
a) Only 1
b) Only 7
c) Only 255
d) As many as required
Answer
Answer: d [Reason:] There are no conditions applied on the number of private member functions that can be declared in a class. Though the system may restrict use of too many functions depending on memory.
8. How to access a private member function of a class?
a) Using object of class
b) Using object pointer
c) Using address of member function
d) Using class address
Answer
Answer: c [Reason:] Even the private member functions can be called outside the class. This is possible if address of the function is known. We can use the address to call the function outside the class.
9. Private member functions ______
a) Can’t be called from enclosing class
b) Can be accessed from enclosing class
c) Can be accessed only if nested class is private
d) Can be accessed only if nested class is public
Answer
Answer: a [Reason:] The nested class members can’t be accessed in the enclosed class even though other members can be accessed. This is to ensure the class members security and not to go against the rules of private members.
10. Which function among the following can’t be accessed outside the class in java in same package?
a) public void show()
b) void show()
c) protected show()
d) static void show()
Answer
Answer: c [Reason:] The protected members are available within the class. And are also available in derived classes. But these members are treated as private members for outside the class and inheritance structure. Hence can’t be accessed.
11. If private members are to be called outside the class, which is a good alternative?
a) Call a public member function which calls private function
b) Call a private member function which calls private function
c) Call a protected member function which calls private function
d) Not possible
Answer
Answer: a [Reason:] The private member functions can be accessed within the class. A public member function can be called which in turn calls the private member function. This maintains the security and adheres to the rules of private members.
12. A private function of a derived class can be accessed by the parent class.
a) True
b) False
Answer
Answer: b [Reason:] If private functions get accessed even by the parent class that will violate the rules of private members. If the functions can be accessed then the derived class security is hindered.
13. Which error will be produced if private members are accessed?
a) Can’t access private message
b) Code unreachable
c) Core dumped
d) Bad code
Answer
Answer: a [Reason:] The private members access from outside the class produce an error. The error states that the code at some line can’t access the private members. And denies the access terminating the program.
14. Can main() function be made private?
a) Yes, always
b) Yes, if program doesn’t contain any classes
c) No, because main function is user defined
d) No, never
Answer
Answer: d [Reason:] The reason given in c option is wrong. The proper reason that the main function should not be private is that it should be accessible in whole program. This makes the program flexible.
15. If a function in java is declared private then it ______
a) Can’t access the standard output
b) Can access the standard output
c) Can’t access any output stream
d) Can access only the output streams
Answer
Answer: b [Reason:] The private members can access any standard input or output. There is no restriction on access to any input or output stream. And since standard input can also be used hence only accessing the output stream is not true.
Object Oriented MCQ Set 3
1. Which among the following best describes abstract classes?
a) If a class has more than one virtual function, it’s abstract class
b) If a class have only one pure virtual function, it’s abstract class
c) If a class has at least one pure virtual function, it’s abstract class
d) If a class has all the pure virtual functions only, then it’s abstract class
Answer
Answer: c [Reason:] The condition for a class to be called abstract class is that it must have at least one pure virtual function. The keyword abstract must be used while defining abstract class in java.
2. Can abstract class have main() function defined inside it?
a) Yes, depending on return type of main()
b) Yes, always
c) No, main must not be defined inside abstract class
d) No, because main() is not abstract function
Answer
Answer: b [Reason:] This is a property of abstract class. It can define main() function inside it. There is no restriction on its definition and implementation.
3. If there is an abstract method in a class then, ____
a) Class must be abstract class
b) Class may or may not be abstract class
c) Class is generic
d) Class must be public
Answer
Answer: a [Reason:] It is a rule that if a class have even one abstract method, it must be an abstract class. If this rule was not made, the abstract methods would have got skipped to get defined in some places which is undesirable with the idea of abstract class.
4. If a class is extending/inheriting any other abstract class having abstract method, then _______
a) Either implementation of method or making class abstract is mandatory
b) Implementation of the method in derived class is mandatory
c) Making the derived class also abstract is mandatory
d) It’s not mandatory to implement the abstract method of parent class
Answer
Answer: a [Reason:] Either of the two things must be done, either implementation or declaration of class as abstract. This is done to ensure that the method intended to be defined by other classes gets defined at every possible class.
5. Abstract class A has 4 virtual functions. Abstract class B defines only 2 of those member functions as it extends class A. Class C extends class B and implements the other two member functions of class A. Choose the correct option below.
a) Program won’t run as all the methods are not defined by B
b) Program won’t run as C is not inheriting A directly
c) Program won’t run as multiple inheritance is used
d) Program runs correctly
Answer
Answer: d [Reason:] The program runs correctly. This is because even class B is abstract so it’s not mandatory to define all the virtual functions. Class C is not abstract but all the virtual functions have been implemented will that class.
6. Abstract classes can ____ instances.
a) Never have
b) Always have
c) Have array of
d) Have pointer of
Answer
Answer: a [Reason:] When an abstract class is defined, it won’t be having implementation of at least one function. This will restrict the class to have any constructor. When the class doesn’t have constructor, there won’t be any instance of that class.
7. We ___ to an abstract class.
a) Can create pointers
b) Can create references
c) Can create pointers or references
d) Can’t create any reference, pointer or instance
Answer
Answer: c [Reason:] Even though there can’t be any instance of abstract class. We can always create pointer or reference to abstract class. The member functions which have some implementation inside abstract itself, can be used with these references.
8. Which among the following is an important use of abstract classes?
a) Header files
b) Class Libraries
c) Class definitions
d) Class inheritance
Answer
Answer: b [Reason:] The abstract classes can be used to create a generic, extensible class library that can be used by other programmers. This helps us to get some already implemented codes and functions that might have not been provided by the programming language itself.
9. Use of pointers or reference to an abstract class gives rise to which among the following feature?
a) Static Polymorphism
b) Run time polymorphism
c) Compile time Polymorphism
d) Polymorphism within methods
Answer
Answer: b [Reason:] The run time polymorphism is supported by reference and pointer to an abstract class. This relies upon base class pointer and reference to select the proper virtual function.
10. The abstract classes in java can _____
a) Implement constructors
b) Can’t implement constructor
c) Can implement only unimplemented methods
d) Can’t implement any type of constructor
Answer
Answer: a [Reason:] The abstract classes in java can define a constructor. Even though instance can’t be created. But in this way, only during constructor chaining, constructor can be called. When instance of concrete implementation class is created, it’s known as constructor chaining.
11. Abstract class can’t be final in java.
a) True
b) False
Answer
Answer: a [Reason:] If an abstract class is made final in java, it will stop the abstract class from being extended. And if the class is not getting extended, there won’t be any other class to implement the virtual functions. Due to this contradicting fact, it can’t be final in java.
12. Can abstract classes have static methods (Java)?
a) Yes, always
b) Yes, but depends on code
c) No, never
d) No, static members can’t have different values
Answer
Answer: a [Reason:] There is no restriction on declaring static methods. The only condition is that the virtual functions must have some definition in program.
13. It is ___ to have an abstract method.
a) Not mandatory for an static class
b) Not mandatory for a derived class
c) Not mandatory for an abstract class
d) Not mandatory for parent class
Answer
Answer: c [Reason:] Derived, parent and static classes can’t have abstract method (We can’t say what type of these classes is). And for abstract class it’s not mandatory to have abstract method. But if any abstract method is there inside a class, then class must be abstract type.
14. How many abstract classes can a single program contain?
a) At most 1
b) At least 1
c) At most 127
d) As many as required
Answer
Answer: d [Reason:] There is no restriction on the number of abstract classes that can be defined inside a single program. The programs can use as many abstract classes as required. But the functions with no body must be implemented.
15. Is it necessary that all the abstract methods must be defined from an abstract class?
a) Yes, depending on code
b) Yes, always
c) No, never
d) No, if function is not used, no definition is required
Answer
Answer: b [Reason:] That is rule of programming language that each function declared, must have some definition. There can’t be some abstract method that remains undefined. Even if it’s there, it would result in compile time error.
Object Oriented MCQ Set 4
1. Which among the following best defines the abstract methods?
a) Functions declared and defined in base class
b) Functions only declared in base class
c) Function which may or may not be defined in base class
d) Function which must be declared in derived class
Answer
Answer: b [Reason:] The abstract functions must only be declared in base class. Their definitions are provided by the derived classes. It is a mandatory condition.
2. Which among the following is true?
a) The abstract functions must be only declared in derived classes
b) The abstract functions must not be defined in derived classes
c) The abstract functions must be defined in base and derived class
d) The abstract functions must be defined either in base or derived class
Answer
Answer: a [Reason:] The abstract functions can’t be defined in base class. They are to be defined in derived classes. It is a rule for abstract functions.
3. How are abstract functions different from the abstract functions?
a) Abstract must not be defined in base class whereas virtual function can be defined
b) Either of those must be defined in base class
c) Different according to definition
d) Abstract functions are faster
Answer
Answer: a [Reason:] The abstract functions are only declared in base class. Derived classes have to implement those functions in order to inherit that base class. The functions are always defined in derived classes only.
4. Which among the following is correct?
a) Abstract functions should not be defined in all the derived classes
b) Abstract functions should be defined only in one derived class
c) Abstract functions must be defined in base class
d) Abstract functions must be defined in all the derived classes
Answer
Answer: d [Reason:] The abstract function are only declared in base classes and then has to be defined in all the derived classes. This allows all the derived classes to define own definition of any function whose declaration in base class might be common to all the other derived classes.
5. It is ___ to define the abstract functions.
a) Mandatory for all the classes in program
b) Necessary for all the base classes
c) Necessary for all the derived classes
d) Not mandatory for all the derived classes
Answer
Answer: c [Reason:] The derived classes must define the abstract function of base class in their own body. This is a necessary condition. Because the abstract functions doesn’t contain any definition in base class and hence becomes mandatory for the derived class to define them. All the functions in a program must have some definition.
6. The abstract function definitions in derived classes is enforced at ___
a) Runtime
b) Compile time
c) Writing code time
d) Interpreting time
Answer
Answer: b [Reason:] When the program is compiled, these definitions are checked if properly defined. This compiler also ensure that the function is being defined by all the derived classes. Hence we get a compile time error if not done.
7. What is this feature of enforcing definitions of abstract function at compile time called?
a) Static polymorphism
b) Polymorphism
c) Dynamic polymorphism
d) Static or dynamic according to need
Answer
Answer: c [Reason:] The feature is known as Dynamic polymorphism. Because the definitions are resolved at runtime. Even though the definitions are checked at compile time, they are resolved at runtime only.
8. What is the syntax for using abstract method?
a) <access-modifier>abstract<return-type>method_name (parameter)
b) abs<return-type>method name (parameter)
c) <access-modifier>abstract return-type method name (parameter)
d) <access-modifier>abstract <returning> method name (parameter)
Answer
Answer: a [Reason:] The syntax must firstly contain the access modifier. Then the keyword abstract is written to mention clearly to the compiler that it is an abstract method. Then prototype of the function with return type, function name and parameters.
9. If a function declared as abstract in base class doesn’t have to be defined in derived class then ______
a) Derived class must define the function anyhow
b) Derived class should be made abstract class
c) Derived class should not derive from that base class
d) Derived class should not use that function
Answer
Answer: b [Reason:] If the function that is not to be defined in derived class but is declared as abstract in base class then the derived class must be made an abstract class. This will make the concept mandatory that the derived class must have one subclass to define that method.
10. Static methods can’t be made abstract in java.
a) True
b) False
Answer
Answer: a [Reason:] The abstract functions can’t be made static in a program. If those are made static then the function will be a property of class rather than each object. In turn ever object or derived class must use the common definition given in the base class. But abstract functions can’t be defined in the base class. Hence not possible.
11. Which among the following is true?
a) Abstract methods can be static
b) Abstract methods can be defined in derived class
c) Abstract methods must not be static
d) Abstract methods can be made static in derived class
Answer
Answer: c [Reason:] The abstract methods can never be made static. Even if it is in derived class, it can’t be made static. If this happens, then all the subsequent sub classes will have a common definition of abstract function which is not desirable.
12. Which among the following is correct for abstract methods?
a) It must have different prototype in the derived class
b) It must have same prototype in both base and derived class
c) It must have different signature in derived class
d) It must have same return type only
Answer
Answer: b [Reason:] The prototype must be the same. This is to override the function declared as abstract in base class. Or else it will not be possible to override the abstract function of base class and hence we get a compile time error.
13. If a class have all the abstract methods the class will be known as _____
a) Abstract class
b) Anonymous class
c) Base class
d) Derived class
Answer
Answer: a [Reason:] The classes containing all the abstract methods are known as abstract classes. And the abstract classes can never have any normal function with definition. Hence known as abstract class.
14. The abstract methods can never be _____ in a base class.
a) Private
b) Protected
c) Public
d) Default
Answer
Answer: a [Reason:] The base class must not contain the abstract methods. The methods have to be derived and defined in derived class. But if it is made private it can’t be inherited. Hence we can’t declare it as a private member.
15. The abstract method definition can be made _____ in derived class.
a) Private
b) Protected
c) Public
d) Private, public, or protected
Answer
Answer: d [Reason:] The derived class implements the definition of the abstract methods of base class. Those can be made private in derived class if security is needed. There won’t be any problem in declaring it as private.
Object Oriented MCQ Set 5
1. Which among the following best defines abstraction?
a) Hiding the implementation
b) Showing the important data
c) Hiding the important data
d) Hiding the implementation and showing only the features
Answer
Answer: d [Reason:] It includes hiding the implementation part and showing only the required data and features to the user. It is done to hide the implementation complexity and details from the user. And to provide a good interface in programming.
2. Hiding the implementation complexity can:
a) Make the programming easy
b) Make the programming complex
c) Provide more number of features
d) Provide better features
Answer
Answer: a [Reason:] It can make the programming easy. The programming need not know how the inbuilt functions are working but can use those complex functions directly in the program. It doesn’t provide more number of features or better features.
3. Class is ___ abstraction
a) Object
b) Logical
c) Real
d) Hypothetical
Answer
Answer: b [Reason:] Class is logical abstraction because it provides a logical structure for all of its objects. It gives an overview of the features of an object.
4. Object is ________ abstraction
a) Object
b) Logical
c) Real
d) Hypothetical
Answer
Answer: c [Reason:] Object is real abstraction because it actually contains those features of class. It is the implementation of overview given by class. Hence the class is logical abstraction and its object is real.
5. Abstraction gives higher degree of ________
a) Class usage
b) Program complexity
c) Idealized interface
d) Unstable interface
Answer
Answer: c [Reason:] It is to idealize the interface. In this way the programmer can use the programming features more efficiently and can code better. It can’t increase the program complexity, as the feature itself is made to hide it.
6. Abstraction can apply to:
a) Control and data
b) Only data
c) Only control
d) Classes
Answer
Answer: a [Reason:] Abstraction applies to both. Control abstraction involves use of subroutines and control flow abstraction. Data abstraction involves handling pieces of data in meaningful ways.
7. Which among the following can be viewed as combination of abstraction of data and code.
a) Class
b) Object
c) Inheritance
d) Interfaces
Answer
Answer: b [Reason:] Object can be viewed as abstraction of data and code. It uses data members and their functioning as data abstraction. Code abstraction as use of object of inbuilt class.
8. Abstraction principle includes_____
a) Use abstraction at its minimum
b) Use abstraction to avoid longer codes
c) Use abstraction whenever possible to avoid duplication
d) Use abstraction whenever possible to achieve OOP
Answer
Answer: c [Reason:] Abstraction principle includes use of abstraction to avoid duplication (usually of code). It this way the program doesn’t contain any redundant functions and make the program efficient.
9. Higher the level of abstraction, higher are the details.
a) True
b) False
Answer
Answer: b [Reason:] Higher the level of abstraction, lower are the details. The best way to understand this is to consider a whole system that is highest level of abstraction as it hides everything inside. And next lower level would contain few of the computer components and so on.
10. Encapsulation and abstraction differ as:
a) Binding and Hiding respectively
b) Hiding and Binding respectively
c) Can be used any way
d) Hiding and hiding respectively
Answer
Answer: a [Reason:] Abstraction is hiding the complex code. For example we directly use cout object in C++ but we don’t know how is it actually implemented. Encapsulation is data binding, as in, we try to combine the similar type of data and functions together.
11. In terms of stream and files________
a) Abstraction is called a stream and device is called a file
b) Abstraction is called a file and device is called a stream
c) Abstraction can be called both file an stream
d) Abstraction can’t be defined in terms of files and stream
Answer
Answer: a [Reason:] Abstraction is called stream to provide a level of complexity hiding, for how the files operations are actually done. Actual devices are called file because in one way or other, those can be considered as single entity and there is nothing hidden.
12. If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?
a) Using private access specifier for data members
b) Using class concept with both data members and member functions
c) Using public member functions to access and manipulate the data members
d) Data is not sufficient to decide what is being used
Answer
Answer: c [Reason:] It is the concept of hiding program complexity and actual working in background. Hence use of public member functions illustrates abstraction here.
13. A phone is made up of many components like motherboard, camera, sensors and etc. If the processor represents all the functioning of phone, display shows the display only, and the phone is represented as a whole. Which among the following have highest level of abstraction?
a) Motherboard
b) Display
c) Camera
d) Phone
Answer
Answer: d [Reason:] Phone as a whole have the highest level of abstraction. This is because the phone being a single unit represents the whole system. Whereas motherboard, display and camera are its components.
14. Which among the following is not a level of abstraction:
a) Logical level
b) Physical level
c) View level
d) External level
Answer
Answer: d [Reason:] Abstraction is generally divided into 3 different levels, namely, logical, physical and view level. External level is not defined in terms of abstraction.
15. Using higher degree of abstraction ____
a) May get unsafe
b) May reduce readability
c) Can be safer
d) Can increase vulnerability
Answer
Answer: c [Reason:] It will make the code safer. One may think it reduces the readability, but the fact is, it actually helps us understand the code better. We don’t have to read the complex code which is of no use in understanding the program.