Search Header Logo
Algorithm and Problem Solving

Algorithm and Problem Solving

Assessment

Presentation

English

11th Grade

Practice Problem

Easy

Created by

Robert B.A

Used 6+ times

FREE Resource

37 Slides • 29 Questions

1

ALGORITHM DESIGN AND PROBLEM SOLVING

2

PROGRAM DEVELOPMENT LIFE CYCLE

The program development life cycle is divided into five stages:
1. Analysis
2. Design
3. Coding
4. Testing
5. Maintenance

3

Analysis

  • The first stage of the program development life cycle that involves investigating the problem.

  • This stage uses both decomposition and abstraction.

  • Decomposition breaks down a complex problem into smaller parts, which can then be subdivided into even smaller parts, that can be solved easily.

  • Abstraction keeps the key elements required for the solution to the problem and discards any unnecessary details and information that is not required.

4

Design

  • The program specification from the analysis stage is used to show to how the program should be developed.

  • This stage involves structure charts, flowcharts and pseudocode

5

Coding and iterative testing

  • The program or set of programs is developed. Each module of the program is written using a suitable programming language and then tested to see if it works.

  • Iterative testing means that modular tests are conducted, code amended, and tests repeated until the module performs as required.

6

Testing

  • The completed program or set of programs is run many times with different sets of test data. This ensures that all the tasks completed work together as specified in the program design.

7

Reorder

Reorder the following stages of software development

Analysis

Design

Coding

Testing

Maintenance

1
2
3
4
5

8

Match

Match the following

Analysis

Design

Coding

Testing

Decomposition and Abstraction

structure charts, flowcharts and pseudoc

Code Development

Running a code

9

Multiple Choice

Which stage of the SDLC involves gathering and documenting requirements from stakeholders?

1

Analysis

2

Design

3

Coding

4

Testing

10

Multiple Choice

During which phase are algorithms implemented in a specific programming language?

1

Analysis

2

Design

3

Coding

4

Testing

11

Multiple Choice

Which of the following is NOT typically part of the Design phase?

1

Creating class diagrams

2

Defining the system architecture

3

Writing unit tests

4

Designing the user interface

12

Can you answer this?

  • There are two sons and 2 fathers in a car. Yet there are only 3 people. Explain how

13

media
  • There are 2 sons and 2 fathers in a car. Yet there are only 3 people. Explain how

Can you answer this?

14

Computer Systems, Sub-systems and decomposition

  • A computer system is made up of software, data, hardware, communications and people.

  • Each computer system can be divided up into a set of sub systems. each sub-systems can be further divided into sub-systems and so on until each sub-system just performs a single action.

15

Top-down design

  • Top-down design is the decomposition of a computer system into a set of sub systems, then breaking each sub-system down into a set of smaller sub-systems, until each sub-system just performs a single action.

  • The process of breaking down into smaller sub-systems is called stepwise refinement.

16

Decomposing a problem.

  • The parts of any computer system are

    • Inputs

    • Processes

    • Outputs

    • Storage

17

Example: An Alarm App

  • inputs – time to set the alarm, remove a previously set alarm time, switch an alarm off, press snooze button

  • processes – continuously check if the current time matches an alarm time that has been set, storage and removal of alarm times, management of snooze

  • outputs – continuous sound/tune (at alarm time or after snooze time expired)

  • storage – time(s) for alarms set.

18

Homework

  • Mention one computer system

  • identify Input, Processes, Outputs, Storage.

19

Match

Match the following

Inputs

Process

Output

Storage

Data to be entered

Task to be performed

Information to be displayed

data that needs to be stored

20

Multiple Choice

Which of the following is NOT typically considered one of the main components of a computer system?

1

Hardware

2

Software

3

People

4

Electricity

21

Multiple Choice

What component of a computer system processes data and controls other parts of the system?

1

Memory

2

Operating System

3

Network Interface Card

4

CPU

22

Multiple Choice

What type of software is designed to perform specific tasks for users?

1
Application software
2
Firmware
3
Utility software
4
System software

23

Multiple Choice

In a computer system, what does the term 'data' primarily refer to?

1
The speed at which a computer operates.
2
The process of executing commands in a program.
3
Physical components of a computer system.
4
Information processed or stored by a computer system.

24

Methods used to design and construct a solution to a problem

25

  • Structure diagrams

  • Flowcharts

  • Pseudocode.

26

Structure diagrams

27

  • Structure diagrams can be used to show top-down design in a diagrammatic form.

  • The name of the program at the top, below its subprograms

Structure Diagrams

media

28

Structure diagram for alarm app

media

29

Structure diagram for a calculator

media

30

Pair Work

media

31

media

Flowcharts

32

A Flowchart

  • A digramatic representation of an algorithm.

33

Flowchart symbols

34

  • Begin/End: Terminator flowchart symbols are used at the beginning and end of each flowchart.

Start/Stop (Begin/End)

media

35

  • Process flowchart symbols are used to show actions, for example, when values are assigned to variables.

Process

media

36

  • The same flowchart symbol is used to show the input of data and output of information.

Input and output

media

37

  • Decision Decision flowchart symbols are used to decide which action is to be taken next; these can be used for selection and repetition/iteration.

  • There are always two outputs from a decision flowchart symbol.

Decision

media

38

Flowchart flow lines use arrows to show the direction of flow, which is usually, but not always, top to bottom and left to right.

Flow lines

39

Examples

  1. Draw flowchart to find the average of two numbers.

  2. Draw a flowchart to allow a user to input the username and password. If the password is correct display the message "Logged in Successfully", Otherwise allow user to re enter the details.

40

Homework

  1. Tickets are sold for a concert at $20 each, if 10 tickets are bought then the discount is 10%, if 20 tickets are bought the discount is 20%. No more than 25 tickets can be bought in a single transaction. Draw a flowchart for this scenario.

  2. Draw a flowchart that will accept three numbers from the user, and displays the greatest number among the three numbers.

41

Multiple Choice

In a program that calculates the area of a circle, what is considered the INPUT?

1

The formula πr²

2

The radius of the circle

3

The calculated area

4

The multiplication process

42

Multiple Choice

In a student grading program, what would be considered an OUTPUT?

1

The list of test scores entered

2

The calculation of the average

3

The final letter grade displayed to the user

4

The grading scale used

43

Multiple Choice

For an ATM withdrawal system, which combination correctly represents the Input-Process-Output sequence?

1

Account balance, withdrawal amount, receipt

2

PIN verification, money dispensing, new balance calculation

3

Card insertion/PIN/amount → Balance verification/transaction processing → Money dispensed/receipt/new balance

4

Money dispensed, account update, transaction record

44

Multiple Choice

In a password validation algorithm, what is NOT typically part of the INPUT?

1

he password entered by the user

2

The minimum password length requirement

3

The error message displayed

4

The required character types

45

Multiple Choice

What does a rectangle represent in a flowchart?

1

A decision

2

An input or output

3

A connector

4

A process

46

Multiple Choice

Which symbol is used to represent a decision in a flowchart?

1
Circle
2
Square
3
Diamond
4
Triangle

47

Multiple Choice

What does an arrow indicate in a flowchart?

1
An arrow represents a decision point in a flowchart.
2
An arrow indicates the end of a process in a flowchart.
3
An arrow shows the start of a flowchart.
4
An arrow indicates the direction of flow in a flowchart.

48

Multiple Choice

Which shape is used for the start and end of a flowchart?

1
Triangle
2
Diamond
3
Rectangle
4
Oval

49

Multiple Choice

In a flowchart, what does the process symbol represent?

1

Start/End

2

Decision

3

Data Input/Output

4

Sequential steps or actions

50

Multiple Choice

Question image

What is the output when "a" is 10

1

10

2

9

3

11

51

Multiple Choice

Question image

What will the program print when the value of a is 10

1

10

2

11

3

9

52

Multiple Choice

Question image

What will the program print when the value of "a" is 9

1

9

2

10

3

8

53

Multiple Choice

Question image

What is the output when A is 9 and B is 14

1

B is greater

2

A is greater

3

No output

54

Multiple Choice

Question image

What will be the output when "a" is 15

1

a is odd

2

a is even

3

16

55

Pseudocode

56

Pseudocode

  • Pseudocode is a simple method of showing an algorithm. It describes what the algorithm does by using English key words that are very similar to those used in a high-level programming language.

57

Principles

  1. All keywords (words used to describe a specific action e.g. INPUT) are written in capital letters.

  2. Where conditional and loop statements are used, repeated or selected statements are indented by two spaces.

58

Assignment statement

  • A value is assigned to an item/variable using the <--- operator

  • Examples

  • score <--- 90 score has the value of 90

  • age <--- 15 age has the value of 15

  • name <--- "Alice" name has the value of Alice

  • IsMarried <--- FALSE IsMarried has the value of FALSE

59

Fill in the Blanks

60

Fill in the Blanks

61

Fill in the Blanks

62

Fill in the Blanks

63

Fill in the Blanks

Type answer...

64

The pseudocode for conditional statements

  • When different actions are performed by an algorithm according to the values of the variables, conditional statements can be used to decide which action should be taken.

  • There are two types of conditional statement:

    • a condition that can be true or false

    • a choice between several different values

65

IF … THEN … ELSE … ENDIF

  • For an IF condition the THEN path is followed if the condition is true and the ELSE path is followed if the condition is false.

    IF Age < 18

    THEN

    OUTPUT "Child"

    ELSE

    OUTPUT "Adult"

    ENDIF

66

Discussion questions

  • Write a pseudocode for the following scenarios

    1. Determine if the number is even or odd

    2. Check if the grade is pass of fail (pass score>50)

    3. Check if the number is negative or positive

    4. Checking whether its a weekend or not.

ALGORITHM DESIGN AND PROBLEM SOLVING

Show answer

Auto Play

Slide 1 / 66

SLIDE