Computering Flashcards

You may prefer our related Brainscape-certified flashcards:
0
Q

What are the 5 variable naming rules?

A
  1. You can only use letters, numbers or underscores
  2. Your variable must start with a letter (underscores are for special occasions, don’t usually use)
  3. Python is case sensitive (spam, sPam, Spam are all different)
  4. Variables should be lowercase
  5. You are advised on Python to separate words with underscore (My_list) but camel case is fine also (myList)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

What is RAM?

A

Random Access Memory

Each memory location is the RAM has an address (like 346701)

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

What is a variable?

A

A name pointing to a memory address which contains a value and has a data type

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

What is an integer?

A

A whole number

67

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

What is a float?

A

Short for a floating point number, decimal

12.5

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

What is a boolean?

A

True is a boolean data type.
“If it’s raining put up your umbrella.” The first part: “If it’s raining” is a boolean test. True or false answers this. If it’s true, put your umbrella up. If it’s false don’t

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

What is a string?

A

Not to be confused with a word, it is a string of characters
Jane
&@£!”

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

Why is knowing the data type important?

A

Python can work out how much memory to put aside.
It will tell Python which operations can be carried out on the data. For example, you can’t have lowercase
number and you can’t divide a word

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

What is declaring a variable?

A

Saying what the data type is when you create a variable (you don’t have to do this in python)

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

In a mathematical sum, how do you get decimal places in your answer?

A

You must make the variables doing the sum be a string.

24/13.0 = 1.84615384615

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

What is Sequence?

A

Each instruction is carried out in order. No action can be skipped

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

What is Selection?

A

A question is asked which produces a Boolean value and the action that follows depends on the answer

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

What is Iteration?

A

Executing the same set of instructions a given number of times or until a specified result is obtained (loops)

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

What is the difference between == and =?

A

== means equals to

= means python will assign a value to a variable

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

Explain If

A

If is a keyword followed by a condition followed by a colon

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

Explain Else

A

Else means everything else, followed by a colon

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

Explain Elif

A

Elif is a keyword followed by a condition followed by a colon. It means else if

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

What does a colon mean?

A

Python expects a block of code (instructions on what to do)

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

Explain While Loops

A

While a condition is true do something and keep looping until the condition has become false (or the user has had all their guesses). You need to decide what your string is, variable and calculation

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

Explain Nested While Loops

A

A while loop within a while loop. After the first while loop colon, everything will repeat to the second while loop until the code breaks

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

What is < ?

A

Less than

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

What is > ?

A

More than

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

What is <= ?

A

Less than or equal to

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

What is >= ?

A

More than or equal to

25
Q

What is == ?

A

Equal to

26
Q

What is != ?

A

Not equal to

27
Q

What is a Boolean Expression?

A

An expression which produces a boolean value

28
Q

What does And mean?

A

Both sides of the operator must be true for it to be considered true

29
Q

What does Or mean?

A

Only ones statement needs to be true for it to be considered true

30
Q

What does Not mean?

A

Not turns a true value to a false value and a false value to a true value

31
Q

What is Assignment?

A

Giving a variable a value

32
Q

What is an Array?

A

A group of data items of the same data type, which is stored under one identifier (name) in
contiguous (one after another) memory locations

33
Q

What is Syntax Error?

A

Python does not understand what is written

34
Q

What is Runtime Error?

A

The syntax is correct but the computer does not understand the instruction.

35
Q

What is Logic Error?

A

Occurs when the code runs but the result is not what was expected

36
Q

What is Algorithm?

A

A sequence of steps taken to solve a problem. The steps use the three basic logic
structures: sequence, selection and iteration

37
Q

What is Abstraction?

A

Breaking a problem into small parts and hiding how the code works

38
Q

Explain Lists

A

Lists point to a collection of value. They go in square brackets and are seperaed by commas.

39
Q

Explain Range

A

range() is a quick way of creating a list of integers

40
Q

How do you add to a list?

A

.append()

41
Q

How do you remove from a list?

A

.remove()

42
Q

How do you change a value in a list?

A

Place the index that you want to change in square brackets followed by an equals sign to the value that you want to change it to.
E.g. my_list[3]=5

43
Q

How do you create an empty list?

A

Empty square brackets

E.g. my_list[]

44
Q

Explain For Loops

A

For loops are used to repeat code. They work with lists.

E.g. For i (i is a variable often used) in range (3)

45
Q

What is a Function?

A

A piece of reusable code. Functions hide how the code works. Python has built in functions
E.g. raw_input()

46
Q

How do you create a function?

A

Use the def keyword (define). Then give the function a meaningful name (use variable rules and conventions). Add brackets, add a colon and and a block of indented code
E.g. def multi():
total = etc…

47
Q

Why and how do you call a Function?

A

A function needs to be called so that they work. To call a function to enter its name within brackets. This is not useful, you need to make two values called arguments.

48
Q

What is an Argument?

A

An argument is a value that is given to a parameter in a function.

49
Q

What is Pseudocode?

A

A mixture between english and code

50
Q

What is a one-dimensional array assignment?

A

Python calls this a list. Indexing starts at 1 instead of 0.

51
Q

What is integer expression?

A

iexp

52
Q

What is boolean expression?

A

bexp

53
Q

How do you end conditionals?

A

You but END before the condition statement

E.g. ENDWHILE, ENDIF

54
Q

What is OUTPUT?

A

What is outputted

55
Q

What is INPUT?

A

What is inputted

56
Q

What does <– mean?

A

It acts as equals

57
Q

How do you do Elif in Pseudocode?

A

There is no Elif. You have to make nested If statement

58
Q

What is a Procedure?

A

It is a function that does not return a value

59
Q

What is a Parameter

A

A placeholder used in a function or a procedure