0% found this document useful (0 votes)
19 views16 pages

Problem Solving Methodology MCQs

The document outlines a problem-solving methodology, emphasizing the importance of algorithms, flowcharts, and coding in programming. It includes multiple-choice questions and short answer questions that cover key concepts such as algorithm definition, flowchart components, and the significance of testing and debugging. Additionally, it explains the roles of decision-making and iterative processes in algorithm design.

Uploaded by

bavi221108
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)
19 views16 pages

Problem Solving Methodology MCQs

The document outlines a problem-solving methodology, emphasizing the importance of algorithms, flowcharts, and coding in programming. It includes multiple-choice questions and short answer questions that cover key concepts such as algorithm definition, flowchart components, and the significance of testing and debugging. Additionally, it explains the roles of decision-making and iterative processes in algorithm design.

Uploaded by

bavi221108
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

Problem Solving Methodology

MCQ
1. What is the first step in problem-solving as per the textbook?
- A) Testing the solution
- B) Coding the algorithm
- C) Analyzing the problem
- D) Debugging the program
- Answer: C

2. What is an algorithm?
- A) A set of exact steps to solve a problemPRIMUS PU COLLEGE, BANGALORE2
- B) A programming language
- C) A type of computer hardware
- D) A method of debugging
- Answer: A

3. What does the term "computerisation" refer to?


- A) The use of computers to develop software for automating tasks
- B) The physical components of a computer system
- C) The process of debugging a program
- D) The network connectivity of computers
- Answer: A

4. Which of the following is NOT a characteristic of a good algorithm?


- A) Precision
- B) Uniqueness
- C) Infinite steps
- D) Finiteness
- Answer: C

5. What does the process of 'coding' involve? PRIMUS PU COLLEGE, BANGA


- A) Writing an algorithm
- B) Testing the program
- C) Converting the algorithm into a format understood by the computer
- D) Debugging the code
- Answer: C

6. What shape is used to represent a process in a flowchart?


- A) Parallelogram
- B) Rectangle
- C) Diamond
- D) Circle
- Answer: B

7. In a flowchart, which symbol represents the start or end?


- A) Diamond
- B) Rectangle
- C) Oval
- D) Parallelogram
- Answer: C
PRIMUS PU COLLEGE, BANGALORE4
Problem Solving Methodology

8. What is the purpose of developing an algorithm before writing code?


- A) To debug the program
- B) To convert it into machine language
- C) To have a clear solution plan
- D) To test the program
- Answer: C

9. Which step comes immediately after developing an algorithm?


- A) Debugging
- B) Testing
- C) Coding
- D) Analyzing the problem
- Answer: C

10. What does GIGO stand for?


- A) Garbage In, Garbage Out
- B) Good Input, Good Output
- C) Great Input, Great Output
- D) Generated Input, Generated Output S PU COLLEGE, BANGALORE5
- Answer: A

11. What does 'finiteness' in an algorithm mean?


- A) The algorithm stops after a finite number of steps
- B) The algorithm has infinite steps
- C) The algorithm has unique steps
- D) The algorithm processes data infinitely
- Answer: A

12. Which of the following is an essential skill for a computer science student?
- A) Problem-solving
- B) Debugging
- C) Coding
- D) All of the above
- Answer: D

13. What is the output of an algorithm?


- A) Input data
- B) A set of instructions
- C) The result of the process
- D) A debugging report
- Answer: C

14. What does the parallelogram symbol in a flowchart represent?


- A) Process
- B) Decision
- C) Input/Output
- D) Start/End
- Answer: C

15. Which of the following steps is NOT part of the problem-solving process
mentioned in the textbook?
- A) Analyzing the problem
- B) Developing an algorithm
Problem Solving Methodology

- C) Compiling the code


- D) Testing and debugging
- Answer: C

16. What should be done after finalizing the algorithm?


- A) Debugging
- B) Testing
- C) Coding
- D) Analyzing the problem
- Answer: C

17. Why is it important to textbook the coding procedures?


- A) To make the code run faster
- B) To understand the logic at a later stage
- C) To avoid writing an algorithm
- D) To reduce the size of the program
- Answer: B

18. What is the role of testing in the problem-solving process?


- A) To analyze the problem
- B) To write the algorithm
- C) To check if the program meets user requirements
- D) To convert the algorithm into code
- Answer: C

19. Which of the following is a key component of analyzing a problem?PRIMUS PU


- A) Writing the program code
- B) Listing the principal components of the problem
- C) Testing the solution
- D) Debugging the program
- Answer: B

20. What is the primary purpose of using an algorithm?


- A) To debug the program
- B) To test the program
- C) To increase reliability, accuracy, and efficiency
- D) To compile the program
- Answer: C

21. What does the diamond shape in a flowchart represent?


- A) Process
- B) Decision
- C) Input/Output
- D) Start/End
- Answer: B
PRIMUS PU COLLEGE, BANGALORE9
22. Which programming language can be used to write a program after
developing an algorithm?
- A) Only Python
- B) Any high-level language
- C) Only Java
- D) Only C++
- Answer: B
Problem Solving Methodology

23. What must be done if the program generates incorrect output?


- A) Analyze the problem
- B) Develop a new algorithm
- C) Check for logical errors
- D) Ignore the output
- Answer: C

24. Why is a roadmap important for a programmer?


- A) To debug the program
- B) To clearly visualize the instructions to be written
- C) To reduce the size of the program
- D) To increase the speed of the program PRIMUS PU COLLEGE, BANGALOR
- Answer: B

25. What is the function of a 'terminator' symbol in a flowchart?


- A) To represent a decision point
- B) To indicate the start or end of the process
- C) To show data input/output
- D) To represent a process or action
- Answer: B

26. What should be done after coding the algorithm?


- A) Analyzing the problem
- B) Testing and debugging
- C) Developing the algorithm
- D) Writing the problem statement
- Answer: B

27. Why is precision important in an algorithm?


- A) To reduce the number of steps
- B) To ensure the steps are clearly stated and defined
- C) To make the algorithm run faster
- D) To avoid using high-level language
- Answer: B

28. Which step in problem-solving involves identifying the logical steps to reach
a solution?
- A) Analyzing the problem
- B) Developing the algorithm
- C) Coding
- D) Testing and debugging
- Answer: B

29. Which shape in a flowchart represents input or output data?


- A) Oval
- B) Rectangle
- C) Parallelogram
- D) Diamond
- Answer: C

30. Why is uniqueness important in an algorithm?


- A) To ensure each step is uniquely defined
PRIMUS PU COLLEGE, BANGALORE12
Problem Solving Methodology

- B) To make the algorithm run faster


- C) To reduce the number of steps
- D) To avoid using high-level language
- Answer: A

31. What is the primary objective of problem-solving in computer science?


- A) To debug the program
- B) To automate tasks efficiently
- C) To reduce the size of the program
- D) To increase the speed of the program
- Answer: B

32. In a flowchart, what is used to represent a decision?


- A) Oval
- B) Rectangle
- C) Diamond
- D) Parallelogram
- Answer: C
PRIMUS PU COLLEGE, BANGALORE13
33. What should be the next step if an algorithm is not producing the correct
output?
- A) Ignoring the error
- B) Rewriting the problem statement
- C) Revising the algorithm to check for logical errors
- D) Converting it into a flowchart
- Answer: C

34. Why is it necessary to document the coding process?


- A) To write more complex code
- B) To ensure the code is understandable and maintainable
- C) To reduce the size of the code
- D) To avoid using high-level language
- Answer: B

35. What role does testing play in the problem-solving process?


- A) To identify any logical errors in the algorithm
- B) To write the final algorithm
- C) To analyze the problem statementPRIMUS PU COLLEGE, BANGALORE14
- D) To convert the algorithm into code
- Answer: A

36. What is the purpose of a flowchart?


- A) To represent an algorithm visually
- B) To write the code
- C) To debug the program
- D) To test the solution
- Answer: A

37. Which of the following is NOT a step in the problem-solving process?


- A) Analyzing the problem
- B) Writing the program
- C) Testing and debugging
- D) Developing the algorithm
Problem Solving Methodology

- Answer: B

38. What is 'finiteness' in the context of an algorithm?


- A) The algorithm must have a finite number of steps
- B) The algorithm must run indefinitely
- C) The algorithm should have unique steps
- D) The algorithm must have infinite steps
- Answer: A

39. Why is it necessary to debug a program?


- A) To increase the size of the code
- B) To ensure the program runs without errors
- C) To write the algorithm
- D) To develop the problem statement
- Answer: B

40. What does a rectangle represent in a flowchart?


- A) Decision
- B) Input/Output
- C) Start/End
- D) Process
- Answer: D

41. Which step involves checking if a program meets user requirements?


- A) Analyzing the problem
- B) Developing the algorithm
- C) Coding
- D) Testing
- Answer: D

42. What is the outcome of an algorithm?


- A) Analyzing the problem
- B) Writing the program
- C) Producing a result
- D) Debugging the program
- Answer: C

43. What is the significance of 'precision' in an algorithm?


- A) To reduce the number of steps
- B) To ensure each step is clearly defined
- C) To make the algorithm faster
- D) To avoid using high-level language
- Answer: B

44. Why is it important to develop an algorithm before coding?PRIMUS PU COLL


- A) To reduce the size of the program
- B) To have a clear solution plan
- C) To debug the code
- D) To increase the speed of the program
- Answer: B

45. What is the role of testing in programming?


- A) To analyze the problem
Problem Solving Methodology

- B) To write the code


- C) To identify and fix errors
- D) To develop the algorithm
- Answer: C

46. What shape represents the start or end in a flowchart?


- A) Rectangle
- B) Parallelogram
- C) Oval
- D) Diamond
- Answer: C
PRIMUS PU COLLEGE, BANGALORE18
47. Which of the following best describes 'uniqueness' in an algorithm?
- A) Each step is distinct and clearly defined
- B) The algorithm has infinite steps
- C) The algorithm runs indefinitely
- D) The algorithm is written in a high-level language
- Answer: A

48. What should be done if a program produces unexpected results?


- A) Ignore the results
- B) Re-analyze the problem
- C) Debug and test the program
- D) Write a new algorithm
- Answer: C

49. What does the term 'coding' refer to in problem-solving?


- A) Writing the problem statement
- B) Converting the algorithm into a programming language
- C) Testing the program
- D) Analyzing the problem
- Answer: B
PRIMUS PU COLLEGE, BANGALORE19
50. Why is 'debugging' an essential part of problem-solving in programming?
- A) To write the algorithm
- B) To fix errors in the code
- C) To reduce the size of the program
- D) To develop the problem statement
- Answer: B

2 Marks Questions

1. Define an algorithm.
An algorithm is a finite set of instructions or a step-bystep procedure for
solving a problem or performing a task.

2. What is Pseudocode?
Pseudocode is a non-formal language that helps programmers to write
algorithms. It is a detailed description of instructions that a computer must follow in a
particular order and is intended for human reading.
Problem Solving Methodology

3. Explain the term "flowchart."


A flowchart is a graphical representation of the steps in an algorithm or a
process, using various symbols to denote different types of actions or steps.

4. What are conditionals in programming?


Conditionals are statements that allow a program to take different actions
based onwhether a certain condition is true or false. They are used to check
possibilities and perform operations depending on the outcome of the condition.
PRIMUS PU COLLEGE, BANGALORE20
5. What is the purpose of a flowchart?
The purpose of a flowchart is to visually represent the sequence of steps in a
process or algorithm, making it easier to understand and analyze the flow of control
and the logic of the process.

6. Describe the term "sequence" in the context of algorithms.


In the context of algorithms, "sequence" refers to the execution of steps one
after the other in a specific order, without any branching or repetition.

7. What does iterative mean in algorithm design?


In algorithm design, "iterative" refers to the process of repeating a set of
instructions a certain number of times or until a specific condition is met. This
repetition is known as a loop.

8. Why is it important to verify an algorithm?


It is important to verify an algorithm to ensure that it correctly and efficiently
solves the problem it is intended to address and to confirm that it produces the correct
output for all possible inputs.

9. What is a loop in programming?


A loop in programming is a control structure that allows the repeated
execution of a block of code as long as a specified condition is met.

10. What is the significance of decision making in algorithms?


Decision making in algorithms is significant because it allows the algorithm to
choose different paths of execution based on certain conditions, enabling it to handle a
variety of situations and inputs.

11. Write pseudocode to add two numbers.


Pseudocode for adding two numbers:
Step1 - INPUT num1
Step2 - INPUT num2
Step3 - COMPUTE Result = num1 + num2
Step4 - PRINT Result
PRIMUS PU COLLEGE, BANGALORE21
12. Define "space complexity" in algorithm analysis.
Space complexity in algorithm analysis refers to the amount of memory space
an algorithm needs to run to completion, taking into account both the fixed and
variable space requirements.

13. Define "time complexity" in algorithm analysis.


Time complexity in algorithm analysis refers to the amount of time an
algorithm takes to run as a function of the length of the input. It helps to estimate the
efficiency of the algorithm.
Problem Solving Methodology

14. What are the components of a flowchart?


The components of a flowchart include various symbols such as:
• Ovals for start and end points
• Rectangles for processing steps
• Diamonds for decision points
• Arrows for flow of control

15. Explain the difference between pseudocode and a flowchart.


Pseudocode is a textual representation of an algorithm written in a human-
readable format. flowchart is a graphical representation of the same algorithm, using
symbols to depict different types of actions and the flow of control.

16. Describe the term "branching" in algorithms.


Branching in algorithms refers to the process of making decisions within the
algorithm, where the flow of control can take different paths based on certain
conditions.

17. What is the role of an algorithm in problem-solving?


The role of an algorithm in problem-solving is to provide a clear, step-by-step
procedure to solve a specific problem, ensuring that the solution is correct, efficient,
and can be executed by a computer program.
PRIMUS PU COLLEGE, BANGALORE22
3 Marks Questions

1. Write an algorithm to find the greatest of two numbers.


o Algorithm:
1. Start
2. Input number1
3. Input number2
4. If number1 > number2, then
▪ Print "number1 is greater"
5. Else
▪ Print "number2 is greater"
6. End

2. Explain the importance of pseudocode before actual coding.


o Importance of Pseudocode:
▪ Helps in planning and organizing thoughts.
▪ Ensures all steps of the algorithm are considered.
▪ Easy to read and understand.
▪ Bridges the gap between human logic and programming
language syntax.
▪ Facilitates debugging by identifying logical errors before
coding.

3. Describe the process of writing a flowchart for a given algorithm.


o Process of Writing a Flowchart:
▪ Identify the major steps in the algorithm.
▪ Use standard flowchart symbols (ovals for start/end, rectangles
for processes, diamonds for decisions).
▪ Connect the symbols with arrows to show the flow of control.
▪ Ensure the flowchart is logically correct and covers all scenarios.
Problem Solving Methodology

▪ Review and refine the flowchart for accuracy and clarity.

4. How can you improve an algorithm that fails for certain inputs?
o Improving an Algorithm:
▪ Identify the inputs that cause the algorithm to fail.
▪ Analyze the algorithm to understand why it fails for those inputs.
▪ Modify the algorithm to handle those specific cases.
▪ Test the algorithm with a variety of inputs to ensure robustness.
▪ Optimize the algorithm to improve efficiency and performance.

5. Write pseudocode for calculating the area and perimeter of a rectangle.


o Pseudocode:
INPUT length
INPUT width
COMPUTE area = length * width
COMPUTE perimeter = 2 * (length + width)
PRINT area
PRINT perimeter

7. Describe the algorithm for checking whether a number is within a specific


range.
1. Start
2. Input number
3. Input lower_bound
4. Input upper_bound
5. If number >= lower_bound and number <= upper_bound, then
▪ Print "number is within the range"
6. Else
▪ Print "number is out of range"
7. End

8. Explain how to handle time addition in pseudocode when minutes exceed 60.

INPUT hours1, minutes1


INPUT hours2, minutes2
total_minutes = minutes1 + minutes2
extra_hours = total_minutes / 60
remaining_minutes = total_minutes % 60
total_hours = hours1 + hours2 + extra_hours
PRINT total_hours, remaining_minutes

9. Discuss the significance of decision-making algorithms with a real-life


example.
▪ Decision-making algorithms allow systems to choose between
different actions based on conditions.
▪ Example: In an e-commerce application, a recommendation
system suggests products based on user preferences and past
purchases, improving user experience and sales.
PRIMUS PU COLLEGE, BANGALORE25
10. What steps should be taken if an algorithm has multiple approaches?
▪ Analyze each approach for correctness and efficiency.
Problem Solving Methodology

▪ Compare the approaches based on their time and space


complexity.
▪ Test each approach with various inputs to identify the best one.
▪ Choose the most efficient and robust approach.
▪ Document the reasons for choosing that particular approach.

11. Explain the importance of verifying an algorithm with an example.


▪ Verifying ensures the algorithm produces correct results for all
inputs.
▪ Example: In a sorting algorithm, verification involves checking
that the output list is sorted for different input lists, including
edge cases like empty lists or lists with repeated elements.

13. What improvements can be made to an algorithm that only accepts positive
integers up to 100?
o Improvements:
▪ Add input validation to check if the input is within the range.
▪ Provide feedback to the user if the input is out of range.
▪ Optimize the algorithm to handle edge cases.
▪ Ensure the algorithm handles different data types correctly.
▪ Include error handling to manage invalid inputs gracefully.

14. Write the pseudocode to print all multiples of 5 between 10 and 25.
o Pseudocode:
FOR number FROM 10 TO 25
IF number % 5 == 0 THEN
PRINT number

15. How do you write an algorithm to read the marks of three subjects and
calculate the aggregate?
o Algorithm:
1. Start
2. Input marks1, marks2, marks3
3. aggregate = marks1 + marks2 + marks3
4. Print aggregate
5. End

16. What is the significance of iterative steps in an algorithm?


o Significance:
▪ Iterative steps allow the repetition of certain actions until a
condition is met.
▪ They help in simplifying complex problems by breaking them
down into repetitive tasks.
▪ Improve the efficiency of algorithms by reducing [Link] PU
▪ Essential for tasks like searching, sorting, and processing data in
loops.
▪ Enable handling of large datasets and continuous processes.

5 Marks Questions

1. Write a detailed algorithm to determine the winner in a coin-flipping game.


o Algorithm:
Problem Solving Methodology

1. Start
2. Input the number of coin flips (n)
3. Initialize counters: player1_wins = 0, player2_wins = 0
4. For each flip from 1 to n:
▪ Flip the coin and get the result (heads or tails)
▪ If the result is heads, increment player1_wins
▪ If the result is tails, increment player2_wins
5. If player1_wins > player2_wins, then: PRIMUS PU COLLEGE, BANGALORE29
▪ Print "Player 1 wins"
6. Else if player2_wins > player1_wins, then:
▪ Print "Player 2 wins"
7. Else:
▪ Print "It's a tie"
8. End

2. Explain the importance of flowcharts in problem-solving.


o Importance of Flowcharts:
▪ Visual Representation: Provides a clear and visual way to
understand the flow of a process.
▪ Simplifies Complex Processes: Breaks down complex processes
into understandable parts.
▪ Identifies Bottlenecks: Helps in pinpointing inefficiencies or
bottlenecks in a process.
▪ Facilitates Communication: Acts as a common language for
team members from different backgrounds.
▪ Example: A flowchart for a customer service process can help
identify steps where delays occur, improving efficiency.

3. Describe the algorithm for adding hours and minutes, including the
necessary conditionals.
o Algorithm:
1. Start
2. Input hours1, minutes1
3. Input hours2, minutes2
4. total_minutes = minutes1 + minutes2
5. extra_hours = total_minutes / 60
6. remaining_minutes = total_minutes % 60
7. total_hours = hours1 + hours2 + extra_hoursRIMUS PU COLLEGE, BANGAL
8. If total_hours >= 24, then:
▪ total_hours = total_hours % 24
9. Print total_hours, remaining_minutes
10. End

4. Write the pseudocode for calculating the area and perimeter of a rectangle.
o Pseudocode:
INPUT length
INPUT width
COMPUTE area = length * width
COMPUTE perimeter = 2 * (length + width)
PRINT area
PRINT perimeter

PRIMUS PU COLLEGE, BANGALORE31


Problem Solving Methodology

5. Explain the importance of verifying algorithms with multiple examples.


o Importance:
▪ Ensures Correctness: Verification confirms that the algorithm
produces the correct output for various inputs.
▪ Identifies Edge Cases: Helps in discovering and handling edge
cases that might not be apparent initially.
▪ Improves Reliability: Builds confidence in the algorithm's
reliability and robustness.
▪ Enhances Understanding: Multiple examples provide a deeper
understanding of how the algorithm works.
▪ Reduces Errors: Early detection of errors prevents issues later in
the development process.

6. Explain the process of improving an algorithm that fails for certain inputsPRIMUS
o Process:
1. Identify the inputs causing the failure.
2. Analyze the algorithm to understand why it fails for these inputs.
3. Modify the algorithm to handle these specific cases.
4. Test the modified algorithm with a variety of inputs.
5. Example: If a sorting algorithm fails for an array containing
negative numbers, modify the algorithm to include handling of
negative values, then test it with arrays containing negative
numbers.

7. Write a detailed pseudocode to calculate the factorial of a number.


o Pseudocode:
INPUT number
IF number == 0 THEN
factorial = 1
ELSE
factorial = 1
FOR i FROM 1 TO number
factorial = factorial * i
PRINT factorial

8. Write a detailed algorithm to print all multiples of 5 between 10 and 25.


o Algorithm:
1. Start
2. For number from 10 to 25:
▪ If number % 5 == 0, then:
▪ Print number
3. End

9. Describe the process of writing an algorithm to read the marks of three


subjects and calculate the percentage.
o Process:
1. Start
2. Input marks for subject1, subject2, and subject3
3. total_marks = subject1 + subject2 + subject3
4. percentage = (total_marks / 300) * 100
Problem Solving Methodology

5. Print percentage
6. End

10. Explain the significance of iterative and branching steps in algorithm


design with examples.
o Significance:
▪ Iterative Steps: Allow repetitive actions, simplifying the process
of handling multiple data elements. Example: Looping through
an array to calculate the sum of its elements.
▪ Branching Steps: Enable decision-making by allowing different
actions based on conditions. Example: Using if-else statements
to handle different cases in a grading system.
▪ Enhance Efficiency: Iterative steps reduce redundancy, while
branching steps handle diverse scenarios, making the algorithm
robust and efficient.
▪ Improve Clarity: Clearly defined iterative and branching steps
make the algorithm easier to understand and maintain.
▪ Adapt to Complex Problems: Combine iterative and branching
steps to solve complex problems by breaking them into
manageable parts.

11. Explain the steps involved in Problem Solving. PRIMUS PU COLLEGE,

1. Analysing the Problem:


o Understand the problem thoroughly before seeking a solution.
o Carefully read and analyze the problem statement.
o List the principal components and decide the core functionalities of the
solution.
o Identify the inputs and expected outputs.

2. Developing an Algorithm:
o Devise a solution plan represented in natural language, called an
algorithm.
o Refine the algorithm until it captures all aspects of the desired solution.
o Select the most suitable algorithm if multiple solutions are possible.

3. Coding:
o Convert the finalized algorithm into a format understood by the
computer using a high-level programming language.
o Record coding procedures and document the solution for future
reference and maintenance.

4. Testing and Debugging:


o Test the program to ensure it meets user requirements and responds
Problem Solving Methodology

within the expected time.


o Verify that the program generates correct output for all possible inputs.
o Fix any syntactical or logical errors encountered during testing.
o Follow standard testing methods like unit, integration, system, and
acceptance testing to ensure the software meets all business and
technical requirements.
o Debug the program to rectify any defects found during testing.

12. Explain the different flowchart symbols


Also called ‘Terminator’
Start / End symbol. It indicates where the
flow starts and ends.
Also called ‘Action Symbol’ it
Process represents a process, access and
single step.
A decision or branching
Decision statement, usually a yes/no or
true/false based on the answer
the path gets spilt into two
branches.
Also called data symbol,this
Input/Output parallelogram shape is used for
input and output data
Connector to show order of flow
Arrow between shapes.
Connection is used to connect
Connector the flow of controls in
flowchart.

13. Explain the characteristics of a good algorithm.


Characteristics of a good algorithm
• Precision — the steps are precisely stated or defined.
• Uniqueness — results of each step are uniquely defined and only depend on
the input and the result
of the preceding steps.
• Finiteness — the algorithm always stops after a finite number of steps.
• Input — the algorithm receives some input.
• Output — the algorithm produces some output.
PRIMUS PU COLLEGE, BANGALORE3814
14. Write a pseudocode to calculate the factorial of a number. (Hint: Factorial
of 5, written as 5! = 5 × 4 × 3 × 2 × 1).
Start
Input number
Set factorial = 1
For i from 1 to number do
factorial = factorial * i
End For
Print "Factorial of " + number + " is " + factorial
End
Problem Solving Methodology

15. Explain the flow of control?


The flow of events as represented in the flow chart.
 Sequence – explain with an example
 Selection - explain with an example
 Repetition – explain with an example

16. Explain Decomposition?


Diving a complex problem into smaller more manageable sub problems.
Developing algorithms for each sub problem and then combining them to solve the
overall problem.

17. Define Source code and dry run


Source code - source code refers to the set of instructions written by a human
programmer using the Python language. It is the human-readable form of a
program, consisting of statements, commands, and algorithms that define how
a computer program operates.
Dry run - refers to the process of simulating the execution of a program or a
specific piece of code without actually running it and producing its intended
side effects (like modifying files, sending network requests, or updating a
database).

PRIMUS PU COLLEGE, BANGALORE

You might also like