8.2 Programming Flashcards
What is an algorithm?
A set of instructions the computer follows in sequence?
What is a sequence?
The order the program runs in.
What is a variable?
A location in memory that stores one piece of data. It can change as the program runs.
What is iteration?
When a block of code repeats/loops?
What are the two iteration loops used in Python
A for loop is count controlled, whereas a while loop is condition controlled.
Why is iteration used in a program?
To make the program more efficient, e.g. less lines of code so the program runs faster.
What does selection mean?
The user has a choice and the program has different routes to follow based on the choice
What are the key terms you would expect to see when reading a selection statement?
If/elif/else
What is the purpose of indentation
The code belongs to the specific selection statement
Write a print statement
print(‘A print statement’)
Write an input statement for to user entering their name
name = input(‘Enter your name: ‘)
How do the four types of malware get into the computer system:
Virus, worm, trojan and ransomware?
Virus - attaches
Worm - duplicates
Trojan - pretends
Ransomware - locks
What is a list?
A location in memory that stores multiple elements under one name
What is the difference between a variable and a list?
A variable can only store one element whereas a list stores multiple elements.
How is a list defined in Python?
listName = [] (square brackets)
What is computational thinking?
Computational thinking is about breaking a big problem into smaller manageable problems: Abstraction - selecting the relevant information, Decomposition - breaking it down into steps, Algorithmic thinking - writing short programs for each step.
What is a structure diagram?
A structure diagram is a decomposition tool that shows visually the different steps in solving the problem.
When have I come across computational thinking before?
Maths - BIDMAS: Brackets, Indices , Division, Multiplication, Addition and Subtraction.
What is Python?
Python is a text-based programming language, which is close to the English language and is translated in order for a computer to understand.
What is an algorithm?
An algorithm is a set of instructions that a computer needs to follow in order/sequence.
What are de Facto standards in programming?
De Facto standards are the expected standard of presentation when writing programs, including title-author-date, this program is designed to… and #comments throughout code.
What is an array?
An array is another word for a list. An array/list store multiple pieces of data in one location.
What is a variable?
A variable stores one piece of data, and can change at the program runs?
How is an array shown in Python?
With a name for the array and square brackets, e.g. studentList = [ ]