Programming Foundations | Study
Questions and Answers Rated A+ |
2025/2026 Guide
Algorithm Efficiency - Correct Answer - is measured by computational
complexity, which evaluates the resources (time or space) required as
input size grows.
Key Types:
Time Complexity: Measures how runtime increases with input size.
Space Complexity: Measures memory usage as input size grows.
Why It Matters: Helps identify how well an algorithm scales with larger
inputs, guiding efficient problem-solving.
Computational Complexity - Correct Answer - The amount of resources
an algorithm uses to solve a problem.
Key Resources:
Runtime: How long the algorithm takes to execute.
Memory Usage: The amount of storage required during execution.
Purpose: Helps evaluate and compare algorithm performance, especially
for large inputs.
Best Case vs Worst Case - Correct Answer - Best Case: The scenario
where the algorithm performs the minimum number of operations.
,Worst Case: The scenario where the algorithm performs the maximum
number of operations.
Space Complexity - Correct Answer - A function S(N) representing the
memory used by an algorithm for an input of size N.
Example: If an algorithm duplicates a list, S(N)=2N+k, where:
2N: Memory for the original and duplicated lists.
k: Constant memory (e.g., loop counters, pointers).
Purpose: Measures memory efficiency of an algorithm.
Auxiliary Space Complexity - Correct Answer - The part of space
complexity that excludes the memory used by the input data.
Example:
Finding the max in a list:
Space Complexity: S(N)=N+k (list + constant).
Auxiliary Space Complexity: S(N)=k (only the constant for variables).
Purpose: Focuses on the additional memory allocated by the algorithm
itself.
Linear Search - Correct Answer - A search algorithm that begins at the
start of a list and checks each element sequentially.
Stops when the search key is found. The end of the list is reached.
Binary Search - Correct Answer - A search algorithm that finds an
element in a sorted list by repeatedly dividing the list in half.
,Sorting - Correct Answer - the process of arranging a list of elements in a
specific order, usually ascending or descending.
Heuristic - Correct Answer - A problem-solving technique that accepts
non-optimal or less accurate solutions to improve execution speed or
reduce resource usage.
Ex: In search problems, a heuristic may guide the algorithm towards a
good enough solution quickly rather than an exhaustive search for the
perfect one.
System Development Life Cycle (SDLC) - Correct Answer - The SDLC is
a structured approach to building a program, divided into phases.
Phases:
Analysis: Defines the program's goals.
Design: Specifies how to build the program.
Implementation: Writing the program code.
Testing: Verifying the program meets its goals.
Waterfall Approach - Correct Answer - SDLC phases are carried out in
strict sequence.
No returning to earlier phases.
Resembles a one-way waterfall, where each step is completed before
moving to the next.
Agile Approach - Correct Answer - SDLC phases are done in small,
iterative cycles.
, Phases repeat with feedback and adjustments after each cycle.
Focuses on flexibility and continuous improvement.
Abstraction - Correct Answer - Hiding internal details and allowing
interaction at a high level.
Ex: Oven has controls for heat, but users don't need to know how the
internal components work.
Information Hiding (Encapsulation) - Correct Answer - Keeping internal
workings of an object or system hidden, exposing only necessary
functionality.
Abstract Data Type (ADT) - Correct Answer - A data type defined by
specific, well-defined operations for creation and updates.
Can be implemented using classes in programming.
Universal Modeling Language (UML) - Correct Answer - A modeling
language used for software design.
Visualizes the structure and behavior of programs using different
diagrams.
Structural Diagrams - Correct Answer - Visualize static elements, like
types of variables and functions.
Behavioral Diagrams - Correct Answer - Visualize dynamic behavior,
such as algorithm flow
Use Case Diagram - Correct Answer - A UML behavioral diagram used
to model user interactions with a software program.