Unit 2 - 2 Flashcards

1
Q

What are variable assigned to?

A

An identifier and store a value in RAM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an identifier?

A

Must start with a letter and be a single word

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can variables be used to carry out calculations?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does input ask for?

A

Computer will wait for a value from the user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is casting?

A

Where variables and values can be converted to different data types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a string?

A

A variable that stores text rather than a number and is made up of a series of characters that can include spaces, symbols and numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is concatenation?

A

Links things together, doing with the string using the ‘+’ operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is string traversal?

A

A software able to keep track of the position of every character within a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you print the string length?

A

len(variable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a ‘real’?

A

A decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is ‘boolean’?

A

True or False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is selection?

A

if variable == :
elif:
else:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a function?

A

from random import*
def identifier():
variable =
return variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Define a procedure?

A

A block of code with an identifier which can be run anytime throughout a program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Give an example of a procedure?

A

def identifier():

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an iteration loop, give an example?

A

variable =

count =
while count <=
variable = variable * count
print(variable)
count = count + 1

17
Q

How do you break an iteration loop?

A

break
print(“end of loop”)

18
Q

Iteration scenario - Output square numbers up to 144?

A

for x in range (1,13)
print(x**2)

19
Q

What is an array?

A

A data structure that holds similar related data

20
Q

What does an array store?

A

Similar, related data

21
Q

What is the purpose of an array?

A

Reduces number of variables

22
Q

What 2 things need to be declared to make an array?

A

Identifier + a size (number of elements it will hold)

23
Q

What is the difference between 1D array and 2D array?

A

A 2D array can hold more than one set of data

24
Q

How, using an array, would you find the name of the 3rd car in a set of data (SEE ONENOTE)?

A

third_car_name = cars[2]
REMEMBER ALWAYS STARTS AT 0

25
Why is data stored in a file?
So that it can be assessed again at a later date without losing any data what is being held
26
What are the 2 modes of file operation?
Read from Write to
27
What are the 3 lines of close to open, read a line and then close a file?
file = openRead() file = openWrite() file.close()
28
Give an example of a text file?
file = open('names.txt') DONT FORGET EOF
29
What is a database?
A persistent store of related data, the data within is stored as records in files
30
What is an attribute?
One item of data
31
What do multiple related attributes create?
A record e.g. surname
32
What does the * represent?
Everything
33
Give an example of an SQL to retrieve data?
SELECT * FROM customers WHERE City = 'London'
34
What is a subprogram?
A set of small programmes that are written within a larger program
35
What is the purpose of a subprogram?
Perform specific tasks
36
What are the 2 types of subprogram?
Procedures Functions
37
Benefits of programming with subprograms?
Smaller in size - easier to write/test/debug Can be saved separately as modules - saves time Used repeatedly at various points - shorter programs code only written once
38
What happens when a procedure ends?
Mina program continues where it left off
39
What makes a function different to a procedure?
It manipulates data and returns result back to main program