Programming Flashcards

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

Variable

A

Can change throughout the program

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

Constant

A

Remains fixed throughout the program

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

Subroutine

A

A block of code given a unique, identifiable name within a program

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

Advantages of Subroutines

A
  • Programs become easier to write and debug
  • Creates reusable components
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Arithmetic Operators : MOD

A

How many whole numbers are left when you fit the number on the right into the number on the left as many times as you can

(e.g, 7 MOD 2 = 1 as 2 goes into 7 three times leaving 1 left)

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

Arithmetic Operators : ^

A

Power

(e.g, 5 ^ 2 = 25)

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

Arithmetic Operators : DIV

A

How many times the number on the right fits into the number on the left

(e.g, 7 DIV 2 = 3 as 2 goes into 7 three times)

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

Arithmetic Operators : Equal to and Not Equal to

A

== - Equal to
!= - Not equal to

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

Recursion

A

When a subroutine calls itself from within its own subroutine

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

Characteristics of a Recursive Subroutine

A

1.) Contains a stopping condition
2.) For any other input value other than the stopping condition, the subroutine should call itself
3.) The stopping condition should be reachable within a finite number of times

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

Features of a Recursive Subroutine

A
  • Contains a stopping condition
  • A function that calls itself
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Recursive Subroutine Without Characteristics

A

Without the characteristics, a recursive subroutine may call itself indefinitely, resulting in a stack overflow

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

Iterative V Recursive Approach

A

Iterative - More efficient in memory usage
Recursive - More useful in tree traversal algorithms

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

Global Variable

A

A variable declared in the main program which exists outside any of the subroutines but can be used anywhere in the program

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

Local Variable

A

A variable declared within a subroutine of a program which only exists and can be used within that subroutine

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

Advantages and Disadvantages of Local Variables

A

A - Easier to debug a program as variables are contained within subroutines
A - More memory efficient

D - Cannot be accessed outside it’s function

17
Q

Advantages and Disadvantages of Global Variables

A

A - You do not need to return a value
A - Can be accessed from anywhere in the program

D - Increases memory usage
D - Alterations with the function may have unwanted side effects elsewhere in the program