Key Terms Flashcards

1
Q

What is a constant?

A

A variable that doesn’t change, doesn’t change in the program

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

What is a variable?

A

A value that can change value once imputed into a program

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

What can data values be stored as?

A

Constants or variables

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

What are the 4 types of variables?

A

Boolean, integers, float, and string

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

What is the function that changes all characters in a string to upper case?

A

x.upper

x being the string

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

What is the function that changes all the characters in a string to lower case?

A

x.lower

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

What is the function that returns all characters in a string?

A

x.length

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

x.(i) does what?

A

Extract the character in position (i) from string x

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

What does the function x.subString(a,b) do? What would the output be if this was ‘hello’?

A

Extracts part of the string starting at position a and with a length of b. Hello would be ‘lo’

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

Give an example of a cast? What is a cast?

A

Str(age)

Where the type of variable is stated

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

What is DIV?

A

Where the integer of a calculation is given without its remainder. E.g. 20 DIV 3 is 6

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

What is MOD?

A

What the remainder of a calculation is E.g. 20 MOD 3 is 2

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

What are the 3 types of loops?

A

While, for and if

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

How many dimensions of arrays are there?

A

3

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

What is an array?

A

A data structure that consists of a group of elements (values or variables), each identified as an index
A data structure where all the data is stored and defined under one variable

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

What is an algorithm?

A

A procedure / sequence that allows a computer to solve a problem, it is a sequence of instructions, it defines the routes through programs. A step by step set of rules for instructions

17
Q

What does the while loop do?

A

If keeps running a program (instruction in a program) until a certain condition is met

18
Q

What does the for loop do?

A

Set a number of cycles for that instruction / that part of the program to do before moving in. E.g. for(1,3) which would make the program run for 3 times leaving each answer in a row in an array then the program either ends or moves on once this has been met and 3 (in this example) values have been left

19
Q

Iteration is what?

A

The act of repeating a process

20
Q

What is an assignment?

A

The operation to change the data value of a variable, overwriting what was there before

21
Q

What is the scope (of variables) ?

A

Whether a variable is local or global, local variables only work in the loop, procedure or class it is set in whereas global variable can be accessed from any point in the program

22
Q

What is a declaration?

A

Declaring a name of a variable, what type it will be and where it will be stored in memory

23
Q

What are operations?

A

Signs that give something a value compared to something else, a logical decision E.g. ==equal to, < less than, > greater than, >= greater than or equal to, <= less than or equal to, != not equal to

24
Q

What does data control?

A

The sequence in which instructions occur

25
Q

What is an iterative program?

A

A statement which makes a program repeat a set of instructions

26
Q

What is selection?

A

When you select what part of the program to run, you can skip buts due to selective statements such as IF.

27
Q

What is sequence?

A

When a program is run in sequence line by line

28
Q

What is a container data type?

A

A data type that contains several items of data

29
Q

Give 4 examples of container data types

A

Strings, lists, tuples and dictionary

30
Q

What does mutable mean? Give examples of what is mutable

A

That somethings value can be changed, a list, variable and dictionary are mutable

31
Q

What is a dictionary (what does it do)?

A

Stores data items in pairs, consisting of a key and a value. Like a printed dictionary, you look up the word (key) and find its definition (the value)

32
Q

What types of checks can you do to validate the user?

A

Length check, type check and format check

33
Q

What is a tuple?

A

They are very similar to list but immutable. It is a type of sequence that like a list can store items of the same or different types, can be indexed, sliced and sorted

34
Q

What is a tuple written in?

A

Parentheses (round brackets)

35
Q

What is a list?

A

A list is a type of sequence, like a string but can contain elements of any type. A list can store items of the same or different types, can be indexed, sliced and sorted

36
Q

Can you define an empty list in python? What about a list with many elements of the same value? What do you write a list in

A
Yes and yes
[square brackets]
Empty list: aList = [ ]
Repeated value: bList = [None] * 10
                                 cList = [0] * 5