(SEM VI) THEORY EXAMINATION 2023-24 OBJECT ORIENTED PROGRAMMING

B.Tech Engineering 0 downloads
₹29.00

OBJECT ORIENTED PROGRAMMING – KOE064

Section-wise Important Questions & Ready Answers


SECTION A

(Attempt all questions in brief – 2 marks each)


(a) Aggregation and Composition

Aggregation and composition represent has-a relationships between classes. Aggregation is a weak association where objects can exist independently, such as a department and teachers. Composition is a strong association where the lifetime of the part depends on the whole, such as a house and its rooms.


(b) Encapsulation with Example

Encapsulation is the process of wrapping data and functions into a single unit called a class and restricting direct access to data. For example, in a BankAccount class, account balance is kept private and accessed only through public methods like deposit() and withdraw().


(c) Generosity (Generality / Generalization)

Generality refers to the process of extracting common characteristics from multiple classes and creating a generalized superclass. It helps reduce redundancy and promotes reuse.


(d) Importance of Modeling and Its Principles

Modeling helps visualize, understand, and manage complex software systems before implementation. Principles of modeling include abstraction, simplicity, consistency, and accuracy to represent real-world systems effectively.


(e) Two Procedure-Oriented Programming Languages

Examples of procedure-oriented programming languages are C and Pascal.


(f) Features of Object-Oriented Programming

OOP features include classes and objects, encapsulation, data abstraction, inheritance, polymorphism, and dynamic binding, which improve modularity and reusability.


(g) C++ Program to Check Prime Number

#include <iostream> using namespace std; int main() {    int n, i, flag = 0;    cin >> n;    for(i = 2; i <= n/2; i++) {        if(n % i == 0) {            flag = 1;            break;        }    }    if(flag == 0 && n > 1)        cout << "Prime Number";    else        cout << "Not Prime";    return 0; }


(h) Use of typedef

typedef is used to create an alias name for an existing data type, making programs easier to read and maintain.


(i) Three Access Specifiers

The three access specifiers in C++ are private, protected, and public, which control the visibility of class members.


(j) Default Access Modifier in C++

By default, the access modifier used in a C++ class is private.


SECTION B

(Attempt any three – 10 marks each)


2(a) Importance of Modeling and Its Principles

Modeling is important because it helps in visualizing system structure, behavior, and interactions before coding. It reduces complexity, improves communication among stakeholders, and minimizes errors. Principles of modeling include abstraction to focus on essential details, consistency across models, simplicity for clarity, and correctness to accurately represent the system.


2(b) Activity Diagram vs Sequence Diagram

An activity diagram represents the flow of activities and decisions in a system, focusing on control flow. A sequence diagram represents interaction among objects over time, showing message flow. Activity diagrams are useful for workflow modeling, while sequence diagrams are ideal for object interaction analysis.


2(c) Procedural vs Object-Oriented Programming

Procedural programming focuses on functions and procedures, while OOP focuses on objects and classes. OOP supports data hiding, reuse, and flexibility through inheritance and polymorphism, whereas procedural programming has limited reuse and security.


2(d) Polymorphism Program & Macros vs Inline Functions

Polymorphism Example:

 

class Shape { public:    virtual void draw() {        cout << "Drawing Shape";    } }; class Circle : public Shape { public:    void draw() {        cout << "Drawing Circle";    } };

Macros are preprocessor directives without type checking, while inline functions are actual functions with type safety and better debugging support.


2(e) Namespace and Enum in C++

Namespace avoids name conflicts by grouping identifiers. The enum keyword is used to define a set of named integer constants, improving code readability and safety.

 

SECTION C


3(a) Data Abstraction vs Encapsulation

Data abstraction focuses on exposing only essential features while hiding implementation details. Encapsulation focuses on bundling data and methods together and controlling access. Abstraction deals with what an object does, while encapsulation deals with how it does it.


3(b) UML Diagrams and Their Types

UML diagrams include class diagrams, use case diagrams, sequence diagrams, activity diagrams, state machine diagrams, and deployment diagrams. Each diagram provides a different perspective of system design.


4(a) Use Case Diagram for Restaurant

A restaurant use case diagram includes actors like Customer, Waiter, and Manager interacting with use cases such as placing order, billing, and food preparation.


4(b) State Machine Diagram for Cricket Match

States include start match, batting, bowling, break, and end match. Transitions occur based on events such as innings change or match completion.

File Size
146.23 KB
Uploader
SuGanta International
⭐ Elite Educators Network

Meet Our Exceptional Teachers

Discover passionate educators who inspire, motivate, and transform learning experiences with their expertise and dedication

KISHAN KUMAR DUBEY

KISHAN KUMAR DUBEY

Sant Ravidas Nagar Bhadohi, Uttar Pradesh , Babusarai Market , 221314
5 Years
Years
₹10000+
Monthly
₹201-300
Per Hour

This is Kishan Kumar Dubey. I have done my schooling from CBSE, graduation from CSJMU, post graduati...

Swethavyas bakka

Swethavyas bakka

Hyderabad, Telangana , 500044
10 Years
Years
₹10000+
Monthly
₹501-600
Per Hour

I have 10+ years of experience in teaching maths physics and chemistry for 10th 11th 12th and interm...

Vijaya Lakshmi

Vijaya Lakshmi

Hyderabad, Telangana , New Nallakunta , 500044
30+ Years
Years
₹9001-10000
Monthly
₹501-600
Per Hour

I am an experienced teacher ,worked with many reputed institutions Mount Carmel Convent , Chandrapu...

Shifna sherin F

Shifna sherin F

Gudalur, Tamilnadu , Gudalur , 643212
5 Years
Years
₹6001-7000
Monthly
₹401-500
Per Hour

Hi, I’m Shifna Sherin! I believe that every student has the potential to excel in Math with the righ...

Divyank Gautam

Divyank Gautam

Pune, Maharashtra , Kothrud , 411052
3 Years
Years
Not Specified
Monthly
Not Specified
Per Hour

An IIT graduate having 8 years of experience teaching Maths. Passionate to understand student proble...

Explore Tutors In Your Location

Discover expert tutors in popular areas across India

Music Theory & Composition Classes Near By Najafgarh – Build Your Musical Foundation Najafgarh, Delhi
App Development Classes Near Noida Sector 100 – Learn Mobile App Development and Start Your Tech Career Sector 100, Noida
Web Development Course Near Sector 59 Gurugram – Learn Coding & Build a Successful Tech Career Sector 59, Gurugram
Spoken English Classes Near Khanna Market By Improve Fluency, Build Confidence & Unlock Global Opportunities in 2026 Khanna Market, Delhi
Guitar Classes Near Vasant Kunj – Learn Guitar with Expert Trainers in South Delhi Vasant Kunj, Delhi
Violin Classes Near DLF Phase 5 – Learn Classical & Modern Violin from Expert Teachers DLF Phase V, Gurugram
Spoken English Classes Near By Subhash Nagar Improve Fluency, Build Confidence & Unlock Career Opportunities in 2026 Subhash Nagar, Delhi
Painting Classes Near By Dwarka Mor – Discover the Artist Within You Dwarka Mor, Delhi
Photography Basics Classes Near By Dwarka Mor – Learn the Art Behind the Lens Dwarka Mor, Delhi
History Classes Near Sector 91 Gurugram – Build Strong Understanding of the Past for a Better Future Gurugram
Voice-over Training Near Sushant Lok Phase 2 – Build a Powerful & Professional Voice Career Gurugram
Zumba Classes Near Sector 130 Greater Noida – Enjoy Dance Fitness and Stay Active Sector 130, Noida
Personal Fitness Training Near Palam Vihar – Transform Your Body with Expert Guidance Palam Vihar, Gurugram
Prenatal Yoga Training Near By Uttam Nagar – Safe & Guided Pregnancy Wellness Uttam Nagar, Delhi
🇫🇷 French Language Classes Near Sector 112 Noida – Learn French with Expert Trainers Noida
Dance Classes (Bollywood, Hip-Hop, Classical) Near Palam Vihar Extension – Learn Dance with Professional Trainers New Palam Vihar, Gurugram
Guitar Classes Near Central Noida Sector 10 – Learn Guitar with Expert Trainers A Block Sector 10, Noida
Prenatal Yoga Training Near Sector 121 Noida – A Complete Guide for Healthy Pregnancy and Wellness Noida
Keyboard / Piano Classes Near DLF Phase 3 Gurugram – Professional Music Training for Kids, Beginners & Advanced Learners DLF Phase 3, Gurugram
🇪🇸 Spanish Language Classes Near Sector 111 Noida – Learn Spanish with Professional Trainers Noida
⭐ Premium Institute Network

Discover Elite Educational Institutes

Connect with top-tier educational institutions offering world-class learning experiences, expert faculty, and innovative teaching methodologies

Réussi Academy of languages

sugandha mishra

Réussi Academy of languages
Madhya pradesh, Indore, G...

Details

Coaching Center
Private
Est. 2021-Present

Sugandha Mishra is the Founder Director of Réussi Academy of Languages, a premie...

IGS Institute

Pranav Shivhare

IGS Institute
Uttar Pradesh, Noida, Sec...

Details

Coaching Center
Private
Est. 2011-2020

Institute For Government Services

Krishna home tutor

Krishna Home tutor

Krishna home tutor
New Delhi, New Delhi, 110...

Details

School
Private
Est. 2001-2010

Krishna home tutor provide tutors for all subjects & classes since 2001

Edustunt Tuition Centre

Lakhwinder Singh

Edustunt Tuition Centre
Punjab, Hoshiarpur, 14453...

Details

Coaching Center
Private
Est. 2021-Present
Great success tuition & tutor

Ginni Sahdev

Great success tuition & tutor
Delhi, Delhi, Raja park,...

Details

Coaching Center
Private
Est. 2011-2020