Module 1 – Worksheet 1
Multiple Choice Questions
Q.No 1. What is the first step in the problem-solving process?
a) Implementing a solution
b) Identifying the problem
c) Analyzing the solution
d) Evaluating alternatives
Answer:
Q.No 2. Which of the following is a key component of effective problem-solving?
a) Ignoring possible solutions
b) Jumping to conclusions
c) Open-mindedness
d) Avoiding collaboration
Answer:
Q.No 3. What does the acronym SMART stand for in the context of setting goals during
problem-solving?
a) Simple, Manageable, Achievable, Relevant, Timely
b) Specific, Measurable, Achievable, Relevant, Time-bound
c) Strategic, Meaningful, Attainable, Realistic, Timeless
d) Structured, Motivating, Actionable, Reflective, Tangible
Answer:
Q.No 4. During the problem-solving process, what does brainstorming primarily involve?
a) Criticizing ideas
b) Generating ideas
c) Implementing solutions
d) Ignoring alternatives
Answer:
Q.No 5. Which of the following is a common barrier to effective problem-solving?
a) Collaboration
b) Lack of creativity
c) Open communication
d) Flexibility
Answer:
Q.No 6. What is the purpose of conducting a root cause analysis in problem-solving?
a) Implementing quick fixes
b) Identifying the underlying issues
c) Ignoring the problem
d) Avoiding responsibility
Answer:
Q.No 7. In the problem-solving context, what does the term "SWOT" stand for?
a) Specific, Workable, Organized, Timely
b) Strengths, Weaknesses, Opportunities, Threats
c) Systematic, Wise, Organized, Thoughtful
d) Solving, Weighing, Organizing, Tracking
Answer:
Q.No 8. What is the significance of prototyping in problem-solving?
a) Ignoring feedback
b) Testing and refining solutions
c) Avoiding alternative solutions
d) Rushing into implementation
Answer:
Q.No 9. What role does critical thinking play in problem-solving?
a) Encouraging unquestioning acceptance
b) Discouraging analysis
c) Facilitating logical reasoning and evaluation
d) Avoiding complexity
Answer:
Q.No 10. What is a common pitfall to avoid when solving problems in a group setting?
a) Encouraging collaboration
b) Groupthink
c) Embracing diversity of thought
d) Open communication
Answer:
Module 1 – Worksheet 2
Fill in the blanks
Q.No.1. In top-down design, the problem is broken down into ____________ subproblems.
Answer:
Q.No.2. The top-level module in top-down design represents the ____________ of the problem.
Answer:
Q.No.3. The process of breaking down a complex problem into manageable parts in top-down
design is often referred to as ____________.
Answer:
Q.No.4. Top-down design promotes ____________ by allowing different teams to work on
specific modules independently.
Answer:
Q.No.5. The top-level module in top-down design is sometimes called the ____________
module.
Answer:
Match the following
PART A PART B ANSWER
(1) Divide and Conquer (A) An algorithmic technique that involves trying out
different possibilities until a solution is found or all
possibilities have been exhausted.
(2) Greedy Algorithms (B) A straightforward approach to problem-solving
that involves systematically trying all possible
solutions until the correct one is found.
(3) Backtracking (C) A problem-solving technique that involves breaking
down a problem into smaller, more manageable
subproblems to solve them independently and
then combine the solutions.
(4) Dynamic (D) A problem-solving strategy that makes locally
Programming optimal choices at each stage with the hope of
finding a global optimum
(5) Brute force (E) A method for solving complex problems by
breaking them down into simpler overlapping
subproblems, and solving each subproblem only
once, storing the solutions to avoid redundant
computations.
Answer
(1) –
(2) –
(3) –
(4) –
(5) –
Module 1 – Worksheet 3
Q.No 1 : Write the Algorithm for finding the greatest common divisor of two numbers
Hint : Euclidean Algorithm
a = 48 and b = 18 , then GCD(a,b) = 6
Solution
Q.No 2: Write an algorithm for predicting house prices based on features like size,
location, and number of bedrooms
Hint :
1. Collect and Prepare Data
2. Define Features and Target
3. Initialize Model Parameters
4. Define the Hypothesis Function
5. Define the Cost Function – Mean Squared Error
6. Gradient Descent – minimizing the cost function
7. Training the Model
8. Make Predictions
9. Evaluate the Model
10. Deploy the Model
Solution:
Q. No 3 : Write the algorithm for Breadth First Search
Hint :
a. Traverse Breadth wise
b. Root Node : A
c. Output: A B C D E F G
Solution:
Q. No: 4. Calculate the Space Complexity of the following code
def linear_search(arr, target):
for element in arr:
if element == target:
return True
return False
Hint : The algorithm uses a constant amount of space
Solution :
Q. No: 5. Calculate the Space Complexity of the following code
def fibonacci(n):
fib = [0] * (n+1)
fib[0] = 0
fib[1] = 1
for i in range(2, n+1):
fib[i] = fib[i-1] + fib[i-2]
return fib[n]
Hint : The algorithm uses a constant amount of space
Solution :
Q. No: 6. Calculate the Time Complexity of the following code
def binary_search(arr, target):
low, high = 0, len(arr) - 1
while low <= high:
mid = (low + high) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
low = mid + 1
else:
high = mid - 1
return -1
Hint : Binary search repeatedly halves the search space until the target is found or the
search space becomes empty
Solution :
Q. No: 7. Calculate the Time Complexity of the following code
def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr)//2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quick_sort(left) + middle + quick_sort(right)
Hint : Worst Case - When the pivot selection consistently results in unbalanced partitions.
Solution :
Q. No 8. Draw the Flow chart for the Bubble sort Algorithm
Hint: The logic is to repeatedly go through the list, compare adjacent elements, and swap
them if they are in the wrong order.
Solution
Q. No 9. Write the Pseudocode for the below flowchart
Hint: Voting System
Solution:
Q. No 10. Consider the following two algorithms, Algorithm A and Algorithm B, for finding
the maximum element in an array. Analyze the time complexity of each algorithm and
compare their efficiency.
Algorithm A: FindMaxA(arr) Algorithm B: FindMaxB(arr)
Input: An array 'arr' of n elements Input: An array 'arr' of n elements
Output: The maximum element in the array Output: The maximum element in the array
1. Set maxElement to the first element of 1. Set maxElement to the first element of
the array (maxElement = arr[0]) the array (maxElement = arr[0])
2. For i from 1 to n-1: 2. For i from 1 to n-1:
a. If arr[i] is greater than maxElement: a. For j from i+1 to n:
i. Set maxElement to arr[i] i. If arr[j] is greater than maxElement:
3. Return maxElement - Set maxElement to arr[j]
3. Return maxElement
Hint:
The time complexity of Algorithm A is O(n), where 'n' is the size of the input array.
The time complexity of Algorithm B is O(n^2), where 'n' is the size of the input array.
Solution