All Question paper with solution mean Bachelorexam.com

Aktu Object Oriented Programming/System Design Quantum Pdf Notes Solved Question Paper

Object Oriented Programming/System Design Solved Question Paper, Important Question, Quantum Pdf Notes Previous repeated Question Easy language, Aktu Syllabus

Dudes 🤔.. You want more useful details regarding this subject. Please keep in mind this as well.

Important Questions For Object Oriented Programming/System Design:
*Aktu Quantum          *B.tech-Syllabus
*Circulars                     *B.tech AKTU RESULT
* Btech 3rd Year

Section A: Object Oriented Programming/System Design Aktu Short Question Notes

a. Differentiate between link and association.  

Ans. Link: Link defines the relationship between two or more objects and a link is considered as an instance of an association. 

Association: It is a group of links that relates objects from the same classes. 


b. What is an abstract class ? Is it possible that an abstract class is inherited by another class ?

Ans. An abstract class is a class that is declared abstract-it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. Yes, we can inherit abstract class from another abstract class.


c. Draw a state diagram for electric bulb.

Ans. 

Draw a state diagram for electric bulb. (Object Oriented Programming/System Design)

d. When do we use the protected visibility specifier to a class member?

Ans. Protected variables allow access to the variables only from sub-classes and classes within the same package. Protected variables can be useful if we want our data to be read-only, or when we want to abstract our data.


e. When will you make a function inline ? Why? 

Ans. When a function is small and called very often, we can make a function inline. Inline functions run a little faster than the normal functions as the compiler replaces the function call statement with the function code itself and then compiles the entire code. 


f. Define destructor. Why do we use a destructor in a program ?

Ans. Destructor:  Destructor is a member function which destructs or deletes an object. Following is the Syntax of destructor: constructor-name(); 

Use of destructor: Destructors are used to deallocate memory and do other cleanup for a class object and its class members when the object is destroyed. A destructor is called for a class object when that object passes out of scope or is explicitly deleted. 


g. What is the use of scope resolution operator ? 

Ans. A scope resolution operator without a scope qualifier refers to the global namespace. We can use the scope resolution operator to identify a member of a namespace, or to identify a namespace that nominates the member’s namespace in a using directive.


h. What is the candidate key ? 

Ans. 1. A super key with no redundant attribute is known as candidate key. 

2. Candidate keys are selected from the set of super keys, the only thing we take care while selecting candidate key is that the candidate key should not have any redundant attributes. 


i. What is the use of friend function in C++? 

Ans.

  • 1. If a function is defined as a friend function in C++, then the protected and private data of a class can be accessed using the function. 
  • 2. By using the keyword friend compiler knows the given function is a friend function. 
  • 3. For accessing the data, the declaration of a friend function should be done inside the body of a class starting with the keyword friend. 

j. What is information hiding? 

Ans. Information hiding is the process of hiding the details of an object or function. The hiding of these details results in an abstraction, which reduces the external complexity and makes the object or function easier to use.


Section B: Object Oriented Programming/System Design Quantum Pdf Notes

a. What is a Constructor ? Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading.    

Ans. Constructor: 

  • 1. A constructor is a member function of a class which initializes objects of a class. 
  • 2. In C++, Constructor is automatically called when object (instance of class) create. It is special member function of the class. 

Characteristics of constructor: 

  • 1. They should be declared in the public section. 
  • 2. They do not have any return type, not even void. 
  • 3. They get automatically invoked when the objects are created.
  • 4. They cannot be inherited through derived class can call the base class constructor.
  • 5. Like other functions, they can have default arguments.
  • 6. Constructors cannot be virtual. 

Program in C++ for constructor overloading:

Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading. Quantum Pdf
Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading. Aktu Note

b. What is an inline function? Why do we use inline functions in our program ? Write a program in C++ for inline function.  

Ans. Inline function: 

  • 1. Inline function is a function that is expanded in line when it is called. 
  • 2. When the inline function is called whole code of the inline function gets inserted or substituted at the point of inline function call. 
  • 3. This substitution is performed by the C++ compiler at compile time. Inline function may increase efficiency if it is small.  

Why we use inline function: 

  • 1. An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. 
  • 2. This eliminates call-linkage overhead and can expose significant optimization opportunities.

Program: 

Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading.
Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading.
Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading.
Write down the different characteristics of a constructor. Write a program in C++ for constructor overloading.

c. Explain object oriented programming. What are the main advantages of object oriented programming over procedural programming ? Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 

Ans. Object oriented programming:

  • 1. Object-Oriented Technology (OOT) is an approach to program organization and development that attempts to reduce some of the issues with conventional programming techniques.
  • 2. It is a new way of organizing and developing programs and has nothing to do with any particular programming language. 
  • 3. However, not all languages are suitable to implement the object-oriented concepts or implement partial features of object-oriented concepts. 

Advantages:

  • 1. It allows parallel development: If we are working with programming teams, then each can work independently of one another once the modular classes have been worked out.
  • 2. The Modular classes are often reusable: Once the modular classes have been created, they can often be used again in other applications or projects. 
  • 3. The coding is easier to maintain: 
    • a. With OOP, because our coding base has been centralized, it is easier to create a maintainable procedure code. 
    • b. That makes it easier to keep our data accessible when it becomes necessary to perform an upgrade. 
    • c. This process also improves the security of the programming since high levels of validation are often required. 

Program to create a class integer: 

Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 
Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 

Function that prints all prime numbers:

Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 
Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 
Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 
Write a program in C++ by creating a class integer and write a function that prints all the prime numbers from the class. 

}


d. Explain all basic concepts of object oriented programming.

Ans. Features of object-oriented language are:  

  • 1. Encapsulation:
    • i. Encapsulation means that data are encapsulated inside an inviolable shell along with the methods required to use it.
Explain all basic concepts of object oriented programming. Important Questions
  • ii. The only way to reach the data is through these particular methods (see Fig.). 
  • iii. It is the mechanism that binds together code and the data it manipulates. 
  • iv. This concept is also used to hide the internal representation, or state, of an object from the outside. 
  • 2. Polymorphism:
    • i. Polymorphism means having many forms. 
    • ii. Polymorphism is the ability of a message to be displayed in more than one form. 
    • iii. lt plays an important role in allowing objects having different internal structure to share the same external interface.
  • 3. Inheritance:
    • i. Inheritance is the ability to create classes that share the attributes and methods of existing classes, but with more specific features.
    • ii. Inheritance is mainly used for code reusability. 

e. What is an inheritance ? Explain the different types of it. Write a program in C++ for multiple inheritance. 

Ans. Inheritance:

  • 1. The capability of a class to derive properties and characteristics from another class is called Inheritance. 
  • 2. Inheritance is one of the most important features of Object Oriented Programming. 
  • 3 The class that inherits properties from another class is called Sub class or Derived class.

Types:

  • 1. Single inheritance:
    • a. In single inheritance, a class is allowed to inherit from only one class. i.e., one sub class is inherited by one base class only. 
    • b. Following is the syntax:
What is an inheritance ? Explain the different types of it. Write a program in C++ for multiple inheritance.
  • 2. Multiple inheritance: 
    • a. Multiple inheritance is a feature of C++ where a class can inherit from more than one classes. i.e one sub class is inherited from more than one base classes, 
    • b. Following is the syntax:
What is an inheritance ? Explain the different types of it. Write a program in C++ for multiple inheritance.
  • 3. Multilevel inheritance: In this type of inheritance, a derived class is created from another derived class. 
  • 4. Hierarchical inheritance: In this type of inheritance, more than one sub class is inherited from a single base class, i.e., more than one derived class is created from a single base class. 
  • 5. Hybrid (Virtual) inheritance: 
    • a. Hybrid inheritance is implemented by combining more than one type of inheritance. 
    • b. For example : Combining Hierarchical inheritance and Multiple Inheritance.  

Program in C++ for multiple inheritance: 

What is an inheritance ? Explain the different types of it. Write a program in C++ for multiple inheritance.

Section 3: Object Oriented Programming/System Design Aktu Important Repeated Questions

a. What is polymorphism ? Differentiate between runtime polymorphism and compile time polymorphism.

Ans. Polymorphism:

  • i. Polymorphism means having many forms. 
  • ii. Polymorphism is the ability of a message to be displayed in more than one form. 
  • iii. lt plays an important role in allowing objects having different internal structure to share the same external interface. 

Difference: 

S. No.Compile Time PolymorphismRun time Polymorphism 
1.In Compile time polymorphism, the call is resolved by the compiler. In Run time polymorphism, the call is not resolved by the compiler. 
2.It is also known as Static binding, Early binding and overloading as well. It is also known as Dynamic binding, Late binding and overriding as well. 
3.Method overloading is the compile-time polymorphism where more than one methods share the same name with different parameters or Signature and different return type.Method overriding is the runtime polymorphism having same method with same parameters or signature, but associated in different classes.
4.It is achieved by function overloading and operator overloading. It is achieved by virtual functions and pointers.
5.It provides fast execution because the method that needs to be executed is known early at the compile time. It provides slow execution because the method that needs to be executed is known at the run time. 
6.Compile time polymorphism is less flexible as all things execute at compile time.Run time polymorphism is more flexible as all things execute at run time.

b. What is operator overloading ? Write a program in C++ for binary operator overloading.  

Ans. Operator overloading: 

  • 1. Operator overloading is a compile-time polymorphism in which the operator is overloaded to provide the special meaning to the user-defined data type. 
  • 2. Operator overloading is used to overload or redefines most of the operators available in C++.
  • 3. It is used to perform the operation on the user-defined data type.
  • 4. For example, C++ provides the ability to add the variables of the user defined data type that is applied to the built-in data types.
  • 5. The advantage of Operators overloading is to perform different operations on the same operand.

Program in C++ for binary operator overloading:

Write a program in C++ for binary operator overloading.  
Write a program in C++ for binary operator overloading.  
Write a program in C++ for binary operator overloading.  Aktu Pdf Notes

Section 4: Object Oriented Programming/System Design Quantum Important Notes Pdf

a. A farmer wants to cross the river in a boat along with a bag of grass, a goat and a lion. Only one things can be carried in the boat at a time. If the goat is left alone with the grass the grass will be eaten. If the goat is left along with the lion, the goat will be eaten. 

i. Prepare a scenario in which everything is safely transported across the river. 

ii. Prepare the event trace diagram for the above problem. 

Ans. i. Scenario for the given problem is shown below:

  • 1. The man will first go with the goat in the boat, leave the goat at the other side of the river and come back alone in the boat. 
  • 2. The man will go with the lion in the boat, leave the lion at the other side of the river and come back with the goat. 
  • 3. The man will go with the grass in the boat, drop the grass at the end of the river with the lion and come back alone. 
  • 4. The man will finally go with the goat in the boat.

ii. 

A farmer wants to cross the river in a boat along with a bag of grass, a goat and a lion. Only one things can be carried in the boat at a time.

b. Define the term multiplicity and quantification with suitable examples.

Ans. Multiplicity: 

  • 1. Multiplicity is a definition of cardinality -i.e., number of elements of some collection of elements by providing an inclusive interval of non-negative integers to specify the allowable number of instances of described element. 
  • 2. Multiplicity specifies the number of instances of one class that may relate to a single instance of an associated class. 
  • 3. For example, UML specifies multiplicity with following notations:
Define the term multiplicity and quantification with suitable examples.

Quantification: 

  • 1. Quantification is the act of counting and measuring that maps human sense observations and experience into quantities. 
  • 2. Quantification process is subjected. 
  • 3. Once quantified, the measure is objective.

Examples:

Define the term multiplicity and quantification with suitable examples.

Section 5: Aktu Long Important Questions Object Oriented Programming/System Design

a. What is UMIL ? List all building blocks of UML. Explain all types of things used in UML.

Ans. UML: 

  • 1. UML stands for Unified Modeling Language. 
  • 2. UML is a pictorial language used to make software blueprints. 
  • 3. UML can be described as a general purpose visual modeling language to visualize, specify, construct, and document software system. 
  • 4. lt is also used to model non-software systems as well. 
  • 5. UML is not a programming language but tools can be used to generate code in various languages using UML diagrams. 
  • 6. UML has a direct relation with object-oriented analysis and design. 

Building Block of UML:  

List all building blocks of UML. Explain all types of things used in UML.

Types of things used in UML: Things can be divided into several different categories: 

  • 1. Structural things: Nouns that depicts the static behavior of a model is termed as structural things. They display the physical and conceptual components. They include class, object, interface, node, collaboration, component, and a use case. 
  • 2. Behavioral things: They are the verbs that encompass the dynamic parts of a model. It depicts the behavior of a system. They involve state machine, activity diagram, interaction diagram, grouping things, annotation things. 
  • 3. Grouping things: It is a method that together binds the elements of the UML model. In UML, the package is the only thing, which is used for grouping.
  • 4. Annotational things: It is a mechanism that captures the remarks, descriptions, and comments of UML model elements. In UML, a note is the only Annotational thing. 

b. Explain virtual base class with the help of an example.

Ans. 1. Virtual base classes are used in virtual inheritance in a way of preventing multiple “instances” of a given class appearing in an inheritance hierarchy when using multiple inheritances. 

2. Following is the Syntax for Virtual Base Classes: 

Explain virtual base class with the help of an example.

3. For example, 

Explain virtual base class with the help of an example.
Explain virtual base class with the help of an example.

Section 6: Quantum Pdf Object Oriented Programming/System Design Notes

a. Discuss implicit and explicit type conversion in detail.

Ans. A type cast is basically a conversion from one type to another. There are two types of type conversion: 

1. Implicit Type Conversion (automatic type conversion):

  • a. Done by the compiler on its own, without any external trigger from the user. 
  • b. Generally takes place when in an expression more than one data type is present. In such condition type conversion (type promotion) takes place to avoid lose of data.
  • c. All the data types of the variables are upgraded to the data type of the variable with largest data type. 
  • d. It is possible for implicit conversions to lose information, signs can be lost (when signed is implicitly converted to unsigned), and overflow can occur (when long is implicitly converted to float). 

2. Explicit Type Conversion: 

a. This process is also called type casting and it is user-defined. Here the user can typecast the result to make it of a particular data type. 

b. In C++, it can be done by two ways:

i. Converting by assignment: 

a. This is done by explicitly defining the required type in front of the expression in parenthesis. This can be also considered as forceful casting.

b. Following is the syntax: 

(type) expression 

where type indicates the data type to which the final result is converted.

ii. Conversion using Cast operator:

Inheritance: concept of inheritance, types of inheritance: single,

 multiple, multilevel, hierarchical, hybrid, protected

 members, overriding, virtual base class   

a. A cast operator is a unary operator which forces one data type to be converted into another data type.  

b. C++ supports four types of casting: 

i. Static Cast 

ii. Dynamic Cast 

iii. Const Cast 

iv. Reinterpret Cast  


b. Explain generalization, aggregation and association in detail.

Ans. Generalization:

  • i. In the generalization process, the common characteristics of classes are combined to form a class in a higher level of hierarchy, i.e., sub-classes are combined to form a generalized super-class. 
  • ii. It represents an “is – a- kind-of” relationship. For example, “car is a kind of land vehicle”, or “ship is a kind of water vehicle”. 

Aggregation:

  • 1. Aggregation is a stronger form of association. It represents the has-a or part-of relationship.
  • 2. An aggregation association depicts a complex object that is composed ot other objects.3. For example, we may characterize a house in terms of its roof, floors, foundation, walls, rooms, windows, and so on. A room may, in turn be, composed of walls, ceiling, floor, windows, and doors, as represented in Fig.  
Explain generalization, aggregation and association in detail.
  • 4. Hence object aggregation helps us describe models of the real world that are composed of other models, as well as those that are composed of still other models.

Association:

  • 1. Association is the semantic relationship between classes that shows how one instance is connected or merged with others in a system. 
  • 2. The objects are combined either logically or physically. Since it connects the object of one class to the object of another class, it is categorized as a structural relationship. 
  • 3. Following are the constraints applied to the association relationship are:
    • i. implicit: Implicit constraints define that the relationship is not visible, but it is based on a concept. 
    • ii. ordered: It describes that the set of entities is in a particular way at one end in an association. 
    • iii. changeable: The changeable constraint ensures that the connections between several objects within a system are added, improved, and detached, as and when required. 
    • iv. addonly: It specifies that any new connection can be added from an object located at the other end in an association. 
    • v. frozen: The frozen constraint specifies that whenever a link is added between objects, it cannot be altered by the time it is activated over the connection or given link.

Section 7: Object Oriented Programming/System Design Aktu Important Solved Questions

a. What is friend function in C++ ? Write a program in C++ to implement friend function. 

Ans. 1. If a function is defined as a friend function in C++, then the protected and private data of a class can be accessed using the function. 

2. By using the keyword friend compiler knows the given function is a friend function. 

3. For accessing the data, the declaration of a friend function should be done inside the body of a class starting with the keyword friend. 

4. For example,

Write a program in C++ to implement friend function. 

b. Explain the following concepts in C++ by taking a suitable example:

i. This pointer 

ii. Array of objects

Ans. i. This pointer:

  • 1. In C++ programming, this is a keyword that refers to the current instance of the class. 
  • 2. There can be three main Usage of this keyword in C++:
    • a. It can be used to pass current object as a parameter to another method. 
    • b. It can be used to refer current class instance variable. 
    • c. It can be used to declare indexers.

ii. Array of objects: 

  • 1. An array in C++ is a collection of similar data items stored at contiguous memory locations. 
  • 2. When a class is defined, only the specification for the object is defined; no memory or storage is allocated. 
  • 3. To use the data and access functions defined in the class, you need to create objects. 
  • 4. The Array of Objects stores objects. 
  • 5. An array of a class type is also known as an array of objects.  

Example: Storing more than one Employee data. 

1. An array of objects can be used if there is a need to store data of more than one employee. 

2. Below is the C++ program to implement the approach.

Explain the following concepts in C++ by taking a suitable example:
Explain the following concepts in C++ by taking a suitable example: