Unit 1 - Fundamentals of Programming Flashcards

1
Q

Define an algorithm

A

A sequence of instructions that can be followed to solve a problem

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

Define pseudocode

A

A language which is a simplified coding language

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

Why do we use pseudocode?

A
  1. It can be easily understood by anybody unfamiliar with programming
  2. It helps to lay out the design of the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What should you always keep in mind when writing pseudocode?

A

You need to keep the same rules throughout so that your program is consistent

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

What is an identifier?

A

A name that indicates a memory location

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

Define assignment

A

Assigning a piece of data to a memory location

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

Define variable

A

A piece of data held within a memory location

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

Define constant

A

A variable which does not change throughout the program

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

What does modulus division do?

A

Returns the remainder of the division

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

What does div division do?

A

Returns the integer part of the division

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

How are assignment statements expressed in pseudocode?

A

= or <–

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

How are input statements written in pseudocode?

A
  1. OUPUT “Enter current mileage”
    currentMileage ← USERINPUT
  2. currentMileage ← USERINPUT(”Enter current mileage”)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List the 6 relational operators and their symbols

A
  1. Equal to (==)
  2. Less than (<)
  3. Greater than (>)
  4. Greater than or equal to (>=)
  5. Less than or equal to (<=)
  6. Not equal to (!=)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

List the three logical operators

A
  1. AND
  2. OR
  3. NOT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens during iteration?

A

A set of instructions is repeated multiple times

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

Why is iteration used by programmers?

A

It is more efficient that writing out the same block of code multiple times

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

Give a situation when an infinite loop is useful?

A

To continuously check the input a device is receiving once it is activated

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

What is a data type?

A

A set of rules that dictate the range of values a variable can be and how that variable can be manipulated

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

Define data structure

A

Different methods of storing data within a program

20
Q

Define subroutine

A

A set of instructions with a name that can referenced and applied to data throughout the program

21
Q

What are the two types of subroutines?

A

Procedures and functions

22
Q

What is the difference between the two types of subroutine?

A

A procedure does not return a value where as a function does

23
Q

What is the difference between a parameter and an argument?

A

Parameters appear in subroutine definitions where as arguments appear in subroutine calls

24
Q

Built in subroutines are contained in…

25
What do you need to do in order to access the subroutines contained within a library?
Import the library at the beginning of the program
26
Where will the value returned by a function go?
It will be assigned to the same variable that the subroutine is assigned to
27
What is a variable scope?
It defines the visibility of a variable and which parts of the program can access it
28
What are local variables?
Variables which are defined and used within one subroutine
29
What are global variables?
Variables that are defined in the main program and can be used anywhere
30
What is the difference of variable scope between a local variable and a global variable?
A local variable can only be used within a subprogram where as a global variable can be used anywhere within the program
31
Why are local variables a good resource for a programmer?
There is no chance of accidentally changing a local variable in the main program as it is completely self contained within the subroutine
32
What is modular programming?
Breaking down a major task into smaller subtasks
33
Why is modular programming beneficial?
1. Programs are more easily and quickly written 2. It makes a program easier to manage 3. Each module can be individually tested 4. Modules can be re-used 5. Smaller problems are easier to debug and maintain
34
What are the two types of file?
A binary file or a text file
35
Why do we use files?
They allow us to organise our data and preserve it between code runs. Files also contain multiple records which can hold different data types
36
Why is it harder to use binary files?
Everything has to be in binary including commands and data
37
Define deceleration
The process of defining variable and constants in terms of their name and data type
38
Define debug
The process of finding and correcting errors in programs
39
Define pointer
A data item that identifies a particular element in a data structure
40
Define truncating
The process of cutting off a number after a certain number of characters
41
Define rounding
The process of reducing the number of characters used to represent a number whilst maintaining approximately the same value
42
Define pseudo-random number generator
A function that produces a random number that it not 100% random
43
Define block interface
Code that describes the data being passed from one subroutine to another\
44
What are naming conventions?
The process of giving meaningful names to elements used in a program
45
What is a call stack?
An area of memory allocated to a program to help it track active subprograms
46
What does a call stack broken down into?
Stack frames
47
What does a stack frame consist of?
1. A pointer indicating where execution should return to (the return address) 2. Local variable 3. Argument parameters