Unit 1 - Fundamentals of Programming Flashcards
Define an algorithm
A sequence of instructions that can be followed to solve a problem
Define pseudocode
A language which is a simplified coding language
Why do we use pseudocode?
- It can be easily understood by anybody unfamiliar with programming
- It helps to lay out the design of the code
What should you always keep in mind when writing pseudocode?
You need to keep the same rules throughout so that your program is consistent
What is an identifier?
A name that indicates a memory location
Define assignment
Assigning a piece of data to a memory location
Define variable
A piece of data held within a memory location
Define constant
A variable which does not change throughout the program
What does modulus division do?
Returns the remainder of the division
What does div division do?
Returns the integer part of the division
How are assignment statements expressed in pseudocode?
= or <–
How are input statements written in pseudocode?
- OUPUT “Enter current mileage”
currentMileage ← USERINPUT - currentMileage ← USERINPUT(”Enter current mileage”)
List the 6 relational operators and their symbols
- Equal to (==)
- Less than (<)
- Greater than (>)
- Greater than or equal to (>=)
- Less than or equal to (<=)
- Not equal to (!=)
List the three logical operators
- AND
- OR
- NOT
What happens during iteration?
A set of instructions is repeated multiple times
Why is iteration used by programmers?
It is more efficient that writing out the same block of code multiple times
Give a situation when an infinite loop is useful?
To continuously check the input a device is receiving once it is activated
What is a data type?
A set of rules that dictate the range of values a variable can be and how that variable can be manipulated