0% found this document useful (0 votes)
26 views5 pages

OOP Assignment 1

Uploaded by

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

OOP Assignment 1

Uploaded by

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

Name: M Usman

Roll No. 2241045


Section: 2C1
Subject: OOP

1. Understanding Problem Solving


Problem Solving: This is the systematic approach to identifying a challenge,
breaking it down into smaller, manageable tasks, and crafting a solution, often
through the use of algorithms.

Steps to Develop a Computer Program:

1. Define the Problem: Clearly articulate the issue that needs to be addressed.
2. Plan the Solution: Decompose the problem into logical steps, potentially
using flowcharts or pseudocode for clarity.
3. Write the Code: Translate the planned solution into a programming
language.
4. Test the Program: Conduct various tests to ensure the solution works as
intended.
5. Debug: Identify and correct any errors or issues that arise.
6. Document and Maintain: Organize the code and create comprehensive
documentation for future reference.

2. Visual Programming
Visual Programming: This methodology allows users to design software by
manipulating graphical elements rather than writing code. It is especially useful for
educational purposes and for quickly developing applications.
Key Features:

1. Graphical Interface: Users interact with a visual layout instead of lines of


code.
2. Drag-and-Drop Functionality: Components like buttons or blocks can be
easily placed into the program.
3. Real-Time Feedback: Users can see outputs instantly as they build the
program.
4. User-Friendly Learning Curve: Simplifies programming by minimizing
the need for extensive coding knowledge.

3. Comparing Structured Programming


and Object-Oriented Programming (OOP)
Object-Oriented
Structured Programming
Programming (OOP)
Organized around functions and Organized around objects and
procedures classes
Data and functions are kept Data and methods are
separate encapsulated within objects
Employs a bottom-up approach,
Follows a top-down approach
emphasizing objects

Example Languages: C Example Languages: Python, Java

4. Algorithm to Determine the Largest of Four


Numbers
 Start
 Input four numbers: a, b, c, d
 Initialize max to a
 If b is greater than max, update max to b
 If c is greater than max, update max to c
 If d is greater than max, update max to d
 Output the largest number (max)
 End

5. Algorithm to Calculate the Greatest


Common Factor (GCF) of Two Numbers
 Start
 Input two numbers: a and b
 While b is not zero:

1. Calculate remainder = a % b
2. Set a to b and b to remainder

 When b equals 0, the GCF is now in a


 Output the GCF
 End

6. Algorithm to Calculate the Sum of Even


Numbers
 Start
 Initialize sum to 0
 For each number i from 1 to 10:

1. If i is even, add i to sum

 Output the final value of sum


 End

7. Flowchart to Calculate the Factorial of a


Number N
 Start
 Input the number N
 Initialize factorial to 1
 For each number i from 1 to N:

1. Multiply factorial by i

 Output the value of factorial


 End

8. Flowchart to Check if a Number is Prime


 Start
 Input the number n
 If n ≤ 1, output "Not Prime" and terminate
 For each number i from 2 to n - 1:

1. If n % i == 0, output "Not Prime" and terminate

 If no divisors are found, output "Prime"


 End

MCQs
Q1: Q2: Q3: Q4: Q5: Q6: Q7:
(A) (D) (C) (A) (D) (D) (B)
Q8: Q9: Q10: Q11: Q12: Q13: Q14:
(B) (D) (A) (D) (C) (D) (A)
Q15: Q16: Q17: Q18: Q19: Q20: Q21:
(A) (C) (C) (D) (B) (D) (B)
Q22: Q23: Q24: Q25: Q26: Q27: Q28:
(B) (A) (D) (D) (D) (D) (C)
Q29: Q30: Q31: Q32: Q33: Q34: Q35:
(B) (C) (D) (C) (B) (D) B
Q36: Q37: Q38:
(B) (D) (D)

FILL IN THE BLANKS


1. Computer Hardware
2. Debugging
3. Implementation
4. Algorithm
5. Flowchart
6. Rectangle
7. Structured
8. Object Oriented Programming 9. Dynamic Link Library
10. .exe

You might also like