Topic 1 Programming Flashcards

(37 cards)

1
Q

Describe a data type?

A

Defined by the values it can take or the operations which can be performed on it.

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

Describe the data type known as 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

Describe the data type known as real / 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

Describe the data type known as 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

Describe the data type known as 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

Describe the data type known as string?

A

A collection of characters

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

Describe the data type known as Date/Time?

A

A way of storing a point in time

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

Describe the data type known as records?

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

Describe the data type known as 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 are user-defined data types?

A

They 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

Why are user defined data types used?

A

Ensure that a solution is as memory efficient as possible

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

what is variable declaration?

A

Allocates a portion of the computers memory to the variable.

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

What is constant declaration?

A

Same as same as variable declaration 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
14
Q

What is assignment in programming?

A

Giving a constant or variable a value

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

What is iteration?

A

The process of repeating a block of code or instruction, this could be definite or indefinite

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

What is selection?

A

Comparing values and choosing an action based on those values.

17
Q

What is a subroutine?

A

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

18
Q

What is definite iteration?

A

A type of iteration in which the number of repetitions required is known before the loop starts

19
Q

what is indefinite iteration?

A

A type of iteration in when the number of repetitions required is not known before the loop starts

20
Q

What is nesting in programming?

A

One structure is placed within another and can be easily be identified by different levels of indentation in code.

21
Q

Why is indentation used in programming?

A

Easier for humans to understand

22
Q

Why should a programmer use sensible and meaningful identifier names?

A

Makes it easier for others to understand what the purpose of the named object is within the program

23
Q

How do you perform the MODULO function in C# and what does it do?

A

Returns the remainder of am integer division. The symbol is: %

24
Q

What is truncation?

A

Removing the decimal part of a number. Never rounds up.

25
Describe how random numbers work in programming?
A built-in function takes a seed value and uses a series of mathematical operations to arrive at a number. This number is not truly random but pseudorandom
26
How does a computer handle exceptions?
By pausing execution of the program and saving the current volatile state of the program to a system stack before running a section of code called a code block.
27
What are the advantages of subroutines?
Reduces repetition and makes the code more compact making it easier to read.
28
What's the difference and similarities of functions and procedures?
They are both types of subroutines but functions are required to return a value whilst procedures may not.
29
What are parameters and what are they used for?
They are used to pass data between subroutines within programs. They hold pieces of information that the subroutine requires to run.
30
What is an argument?
The actual value passed by a parameter.
31
What is a local variable?
Variables that can be accessed from any part of a program and exist in memory for the entire duration of the program's execution
32
What are stack frames used for?
To store return addresses, parameters and local variables for each subroutine call that occurs during the execution of a program
33
What is the role of stack frames in subroutine calls?
If one subroutine calls another, nesting is said to occur. Each subroutine call will be pushed onto the computer's call stack in the form of a stack frame before the subroutines code begins to execute. When the nested subroutine finishes executing the stack frame is popped from the call stack and the computer uses the information to return to execution of the previous subroutine.
34
What is a recursive subroutine?
One which is defined in terms of itself. There is call to the subroutine itself.
35
What is a stopping condition (Base case)?
The terminating situation in recursion that does not use recursion to produce a result
36
Why are base cases needed?
As the program will never terminate causing stack overflow.
37
What is recursion?
The process in which a block of code that is defined in terms of itself makes a call to itself.