Previous year paper

(SEM V) THEORY EXAMINATION 2021-22 OBJECT ORIENTED SYSTEM DESIGN

Engineering B.Tech 0 downloads

About this previous year paper

SECTION–A (2 Marks Each)


a) Link vs Association

Association shows a relationship between two classes (e.g., Teacher–Student).

Link is an actual instance of an association (e.g., Mr. Sharma teaches Rahul).


b) Abstract Class

An abstract class is a class that contains at least one pure virtual function.
Yes, an abstract class can be inherited, but the derived class must implement all abstract methods.


c) State Diagram of Electric Bulb

States:

OFF → Switch ON → ON

ON → Switch OFF → OFF


d) Protected Visibility Specifier

Used when class members should be accessible inside the class and its derived classes, but not outside.


e) Inline Function

A function is made inline when it is small and frequently used.
It reduces function call overhead and improves performance.


f) Destructor

A destructor is a special function used to free memory and resources when an object is destroyed.


g) Scope Resolution Operator (::)

Used to access:                                       Global variables

Class methods outside the class             Static class members


h) Candidate Key

A candidate key is a minimal attribute that can uniquely identify a record in a table.


i) Friend Function

A friend function can access private and protected members of a class without being its member.


j) Information Hiding

It means restricting direct access to object data and exposing only necessary details.


SECTION–B (Attempt Any Three – 10 Marks Each)


a) Constructor & Constructor Overloading

A constructor is a special function that initializes objects.


Characteristics

Same name as class             No return type                 Automatically called

Constructor Overloading Example

 

class Demo { public:    Demo() {        cout << "Default Constructor";    }    Demo(int x) {        cout << "Parameterized Constructor";    } };

b) Inline Function

Inline functions reduce execution time by avoiding function calls.

 

inline int square(int x) {    return x * x; }


c) Object Oriented Programming (OOP)

OOP organizes programs using objects and classes.

Advantages

Code reusability                  Security                   Easy maintenance

Prime Number Program Using Class

 

class Integer { public:    void printPrime(int n) {        for(int i=2;i<n;i++) {            bool prime=true;            for(int j=2;j<i;j++) {                if(i%j==0) prime=false;            }            if(prime) cout<<i<<" ";        }    } };


d) Basic Concepts of OOP

Class                    Object             Encapsulation            Inheritance

Polymorphism             Abstraction


e) Inheritance

Inheritance allows one class to acquire properties of another.


Types

Single                     Multiple

Multilevel               Hierarchical

Hybrid


Multiple Inheritance Example

 

class A { }; class B { }; class C : public A, public B { };


SECTION–C (10 Marks)

Polymorphism

Ability of one function to behave differently.

Compile Time

Function overloading              Operator overloading

Run Time

Function overriding                Virtual functions


Operator Overloading Example

 

class Test { public:    int x;    Test operator+(Test t) {        Test temp;        temp.x = x + t.x;        return temp;    } };


SECTION–D

Farmer–Goat–Lion–Grass Problem

Safe Steps

Take goat across                            Return alone

Take grass across                           Bring goat back

Take lion across                             Return alone

Take goat across

(Event trace diagram explanation can be written step-wise in exam)


Multiplicity & Quantification

Multiplicity defines number of objects in relation (1..1, 1..*, etc.)

Example: One teacher teaches many students


SECTION–E

UML

UML is a visual modeling language used to design systems.

Building Blocks

Things                        Relationships                     Diagrams


Types of Things

Structural                                          Behavioral

Grouping                                          Annotational

Virtual Base Class                           Used to avoid ambiguity in multiple inheritance.

 

class A { }; class B : virtual public A { }; class C : virtual public A { }; class D : public B, public C { };


SECTION–F

Type Conversion

Implicit: Done automatically by compiler

Explicit: Done manually using casting

Generalization, Aggregation & Association

Generalization: IS-A relationship

Aggregation: HAS-A (weak)

Association: Logical connection

SECTION–G

Friend Function Example

 

class Test {    int x; public:    friend void show(Test); }; void show(Test t) {    cout << t.x; }

This Pointer                       Refers to the current object.


Array of Objects               class Student { }; Student s[5];

TypePrevious year paper
SubjectEngineering
Board / courseB.Tech
FilePDF · 137.8 KB
Shared by SuGanta International

Added by the SuGanta team.