Code definitions Flashcards

(19 cards)

1
Q

What is a Variable?

A

A storage location, with a name, storing a single value at any one time that can be changed

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

What is a Constant?

A

A storage location, with a name, that stores one value at any one time and cannot be changed while the program is running

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

What is a nested loop?

A

A nested loop is a loop within a loop whereby the inner loop re-iterates depending on the outer loops status ( if it can re-iterate or if it has met its target )

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

What is a syntax error?

A

A problem with the language (not defined)

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

What is a Logical error?

A

The error does not produce the expected output

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

Name the three Programming constructs

A

Sequence, selection, iteration

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

What is sequence?

A

The order in which the program is executed

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

What is selection?

A

When the program makes decisions

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

What is iteration?

A

Repeating a set of code / instructions until a condition is met

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

What is a substring?

A

A part of a string (slicing)

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

What are the 2 subroutines?

A

Procedures and Functions

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

What is a procedure?

A

Completes a task but doesn’t return

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

What is a subroutine?

A

A block of code for completing a task

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

What is a function?

A

Completes a task and returns

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

What is a parameter?

A

A variable used to pass between functions or procedures

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

Name 4 benefits of using subroutines

A
  • Makes the program shorter and easier to read
  • You can test each procedure or function individually for the source of an error
  • You can reuse the code instead of rewriting the whole code
  • Large programs can be split into different subroutines
17
Q

What are the 3 lines of code needed to save to a file?

A

file = open(‘filename.py’,’w’)

file. write(‘addedtext’)
file. close()

18
Q

What is the difference between count controlled and condition controlled?

A

Condition controlled loops reiterate until a condition put in place is met whereas a count controlled loop repeats the set code a set amount of times

19
Q

What are the advantages of bubble sort?

A
  • Easy to use

-