Unit 1 - Lesson 2: Program Design Flashcards
What is an Algorithm?
An algorithm describes a set of steps to solve a problem. It also describes the logical structure of a program by defining the actions that a program will carry out.
Why do programmers create algorithms before thy start to write code?
The reason programmers create algorithms is so they can have a clear idea of the steps required to solve the problem in a general sense before they try to work out the actual code.
In a flowchart, input and output are shown by the same shape of box. How can you tell whether a box stands for input or output?
Even though they are the same shape, the input box should say “input” and the output box should say “output” and describe what the output is.
How is sequence shown in a flowchart algorithm?
The arrows show the sequence of the flowchart
What do the rounded rectangles show in a flowchart?
Rounded rectangles shows the start and end of a flowchart.
What do parallelograms show in a flowchart?
Parallelograms show the input and outputs.
What do normal rectangles show in a flowchart?
Normal rectangles show the value of a variable.
In the following line of pseudocode, what is the variable? What is the expression and what type of expression is it?
Month <– “January”
The variable is Month, the expression is January, and it is a string literal.
How would you write a line of pseudocode to assign user input to a variable called email_address?
email_address <– USERINPUT
How would you write a line of pseudocode to output the message Game Over.
OUTPUT Game Over
How would you write a line of pseudocode to assign the value 99 to a variable called Height.
Height <– 99
What is pseudocode?
Pseudocode is a way of writing out an algorithm in words. Pseudocode helps us plan our algorithm before we turn it into actual code. It is not a real program and cannot be run on a computer.
What is coding?
Turning an algorithm into a program.
Is an algorithm the same as code?
No, an algorithm is the solution to a problem, while code is the computer language in which the algorithm is implemented.