Programming techniques Flashcards

1
Q

What is a sequence?

A

A series of statements that are executed one afte ranother

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

What is Selection?

A

Where a decesion is made based on the state of a boolan expression

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

What is iteration?

A

Iteratin mean repition. It is used to make a section of code repeat itself
for i in range(0,3):
print(i)

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

What is recursion?

A
This is where a procedure or function calls itself. It is another way of producing iteration. recursion will call a stack overflow error if a terminating condition is not built in.
def recuse (number):
        print(number)
        recurse(number)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a global variable?

A

Can be seen throughout a program. They are declared or set outside any function or subprograms
Global variables can be dangerous .it is easy to overlook when they are changed

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

What is a local variable?

A

Local variables are set or declared inside a function or other subprogram, they can only be accessed from within that subprogram

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

What are functions?

A

A subroutine retrun a value

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

What are procedures

A

Perform some opeartios but do not return a value

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

What is passing by reference?

A

Parameters can be passed by reference. this means that the address of the variable is passed to the subprogram

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

Features of IDE?

A

BREAKPOINT- this will cause the program to stop on the line so that you can see where it reaches that line
WATCH-set a watch on a variable so that its value is displayed each time it changes
STEP THROUGH-you can step through a program line at a time so that you can see what is happening

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

What is passing by value?

A

If a parameter is passed by value, its actual value is passed to the subroutine, where it is treated as a local variable. changing a parameter inside the subroutine will not affect its value outside the subroutine

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