Develop code unit 2 Flashcards
(14 cards)
What is the difference between an algorithm and a program?
An algorithm is a set of steps to solve a problem, while a program is the algorithm written in code to run on a computer.
What is pseudocode?
A structured, code-like way of writing an algorithm that’s easier to understand and less strict than real programming code.
What are the four basic data types?
Integer, Float/Real, Boolean, and Character.
What is an integer?
A whole number (e.g. 5, -12, 100).
What is a float/real?
A number with a decimal point (e.g. 3.14, -0.5).
What is a Boolean?
A data type that has only two values: True or False.
What is a character data type?
A single letter, digit, or symbol (e.g. ‘A’, ‘7’, ‘#’).
Why is selecting the correct data type important?
Because it determines what operations can be performed on that variable.
Do you have to declare data types in pseudocode?
No, but it’s a good habit to do so for clarity.
What are the structural components of a program?
Variable/type declarations, command sequences, selection, and iteration.
What is sequencing in a program?
Executing instructions one after the other in order.
What is selection in a program?
Using conditions to make decisions (e.g. IF…THEN…ELSE).
What is iteration in a program?
Repeating actions using loops like FOR, WHILE, or REPEAT.
Can an algorithm be written in both pseudocode and a high-level language?
Yes — it can be first written in pseudocode and then translated into actual code like Python, Java, etc.