Procedural Programming Flashcards

(34 cards)

1
Q

What is a data type

A

a classification that defines the kind of values a variable can hold and the operations that can be performed on them

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

What is an integer

A

A whole number, positive or negative, including zero

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

WHat is a float

A

A positive or negative number which can have a
fractional part

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

What is a boolean

A

A value which is either true or false

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

WHat is character

A

A single number, letter or symbol.

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

What is a string

A

A collection of characters

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

WHat is a pointer

A

A way of storing memory addresses.

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

What is a record

A

A collection of fields, each of which could have a
different data type

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

What is an array

A

A finite, indexed set of related elements each of which
has the same data type.

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

What is user defined data type

A

User-defined data types are derived from existing data
types in order to create a customised data structure.

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

WHat is variable declaration

A

Creating a variable for the first time, giving it a name
and sometimes a data type. This allocates a portion of
the computer’s memory to the variable.

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

What is constant declaration

A

but when creating a constant. The value of a constant does not change
while the program is running.

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

What is a subroutine

A

A named block of code containing a set of instructions
designed to perform a frequently used operation.

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

WHat is length

A

Position Returns the position of a specified character within a string.

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

What is a sub string

A

Returns the number of characters in a specified string.

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

What is substring

A

Substring Given a starting position and a length, returns a portion of a string

16
Q

WHat is concatenation

A

Joining two or more strings together to form a new, longer
string

17
Q

What is character to charcater code

A

Returning the character code which corresponds to a
specified character.

18
Q

What is characater code to character

A

Returning the character represented by a given character
code.

19
Q

WHat is random number generator

A

A built-in function takes a seed value and uses a series of
mathematical operations to arrive at a number

20
Q

What is a random integer generator

A

import random
random_integer = random.randint(1, 10)
print(random_integer)

21
Q

Difference between procedure and function

A

Procedure dosent always returns a vlue function always returns a value

22
Q

What is local variable

A

A local variable is a variable that can only be accessed from the subroutine within which it
is declared. It is memory efficient

23
Q

What is global variable

A

global variables can be accessed from any part of a program
and exist in memory for the entire duration of the program’s execution.

24
WHat are stack frames used for
Stack frames are used by computers to store return addresses, parameters and local variables for each subroutine call
25
WHat is recursive subroutine
A recursive subroutine is one which is defined in terms of itself
26
How is exception handling done
● It does this by: ○ Pausing execution of the program ○ Saving the current volatile state of the program on the system stack ○ Running a section of code called a catch block ● Once the exception has been handled, the program uses the system stack to restore its previous state before resuming execution.
27
What is assignment
Giving a constant or variable a value.
28
WHat is iteration
Repeating an instruction, this could be definite or indefinite (see below).
29
Advantages of using a constant
makes code easier for a human to understand. using a constant makes changing that value much easier as it only needs to be updated in one place.
30
Advantages of a local variable
They only exist in the computer’s memory when their parent subroutine is executing. This makes local variables a more memory efficient
31
Advantages of a global variable
accessed from any part of a program and exist in memory for the entire duration of the program’s execution.
32
WHat is a base case
the crucial stopping condition in a recursive function
33
What is a stakc overflow
When two many items are pushed unto a stack