0% found this document useful (0 votes)
7 views3 pages

CSE Assignment 2.1

The document outlines fundamental principles of Object-Oriented Programming (OOP) including encapsulation, abstraction, inheritance, polymorphism, class and object, and message passing. It compares programming paradigms such as Procedural, Object-Oriented, and Functional Programming, discussing their advantages and disadvantages. Additionally, it explains algorithm complexities in terms of time and space, emphasizes the importance of algorithms and flowcharts in program design, and contrasts Assembly language with High-Level languages.

Uploaded by

dhruvtiwarix2910
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

CSE Assignment 2.1

The document outlines fundamental principles of Object-Oriented Programming (OOP) including encapsulation, abstraction, inheritance, polymorphism, class and object, and message passing. It compares programming paradigms such as Procedural, Object-Oriented, and Functional Programming, discussing their advantages and disadvantages. Additionally, it explains algorithm complexities in terms of time and space, emphasizes the importance of algorithms and flowcharts in program design, and contrasts Assembly language with High-Level languages.

Uploaded by

dhruvtiwarix2910
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSE Assignment 2.

1. List and describe the fundamental principles of Object-Oriented Programming (OOP).

Object-Oriented Programming is based on the following key principles:

●​ Encapsulation: Bundling data and methods that operate on that data into a single unit
or class. It hides internal details and exposes only necessary functionalities.​

●​ Abstraction: Hiding complex implementation details and showing only the essential
features of the object.​

●​ Inheritance: A mechanism by which one class (child) inherits the properties and
behaviors of another class (parent), promoting code reuse.​

●​ Polymorphism: The ability of a function or method to behave differently based on the


object that invokes it. It can be achieved through method overloading or overriding.​

●​ Class and Object: A class is a blueprint; an object is an instance of a class.​

●​ Message Passing: Objects communicate by sending messages (calling


methods/functions).​

2. Compare different programming paradigms, including Procedural Programming,


Object-Oriented Programming, and Functional Programming. Discuss the advantages
and disadvantages of each.

Paradigm Description Advantages Disadvantages

Procedural Based on Simple and efficient Not suitable for large


procedures/functions. Uses for small programs; programs; poor code
sequence, selection, and easy to implement. reusability.
iteration.

Object-Orie Organizes code into objects Promotes More complex; can be


nted containing data and modularity, code overkill for small tasks.
functions. reuse, easier
maintenance.
Functional Focuses on pure functions Easier to Less intuitive for those
and avoids changing states. test/debug; good for used to imperative style;
concurrency. limited by availability of
libraries.

3. Explain different types of algorithm complexities.

Algorithm complexity is a way to describe the performance of an algorithm in terms of time and
space. The two major types are:

1.​ Time Complexity:​


It measures how the execution time of an algorithm increases with the size of the input.
It is commonly expressed using Big O Notation:​

○​ O(1) – Constant time: independent of input size.​

○​ O(log n) – Logarithmic time: e.g., Binary Search.​

○​ O(n) – Linear time: increases proportionally with input size.​

○​ O(n log n) – Log-linear time: e.g., Merge Sort.​

○​ O(n²) – Quadratic time: e.g., Bubble Sort.​

○​ O(2^n) – Exponential time: highly inefficient, used in recursive solutions like


Fibonacci.​

2.​ Space Complexity:​


It measures the total memory space required by an algorithm as a function of input size.
It includes both temporary space and input storage space.​

Understanding complexities helps in selecting the most efficient algorithm for solving a problem.
4. Discuss why algorithms and flowcharts are essential prior to writing a computer
program.

●​ Algorithms provide a step-by-step solution to a problem, ensuring logic and order in


program design.​

●​ Flowcharts offer a visual representation of the algorithm, helping to understand the flow
of logic.​

●​ Importance:​

○​ Helps in identifying logical errors early.​

○​ Aids communication between programmers and stakeholders.​

○​ Makes program implementation easier and more structured.​

○​ Saves time during debugging and maintenance.​

5. Define a programming language. Compare Assembly language with High-Level


Language.

●​ Programming Language: A formal language comprising a set of instructions used to


produce various kinds of output and communicate with computers.​

Feature Assembly Language High-Level Language

Level Low-level High-level

Readability Hard to understand (uses Human-readable (uses English-like


mnemonics) syntax)

Portability Hardware-specific Portable across systems

Execution Fast and efficient Slower due to abstraction


Speed

Ease of Use Difficult to write and debug Easier to learn and maintain

Examples NASM, MASM Python, Java, C++

You might also like