Set 1 Flashcards

Checked by Matt. Covers everything above SA 1 on BPCompSci topic list (48 cards)

1
Q

What are the advantages of RPN?

A
  • Eliminates the need for brackets in sub-expressions
  • There is no need for order of precedence of operators (DON’T MENTION BIDMAS)
  • The expressions are in a form suitable for evaluation using a stack, as the expression can be evaluated from left to right
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is main memory?

A

Memory that is directly addressable by the processor

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

What is the system bus?

A
  • A set of parallel wires connecting independent components of a computer system
  • It is used to pass signals between the components.
  • These signals can represent data, address, or control information.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the stored program concept?

A

Two parts:
(a) A program must be resident in main memory to be executed.
(b) Machine code instructions are fetched and executed serially (one at a time) by the processor.

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

What are the two types of stored program concept?

A
  1. Von Neumann (where data and instructions are stored in main memory)
  2. Harvard Architecture (where instructions and data are stored separately, using separate buses)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why is Harvard Architecture sometimes used in preference to Von Neumann?

A

Von Neumann:
- Competition for instructions and data as both share the same bus

Harvard:
- Instructions and writing/reading data can take place in parallel so can be faster
- Avoid bottleneck of single data/address bus
- Instruction and data memory can have different word lengths
- Avoids possibility of data being executed as code, which is one method that can be exploited by hackers

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

Where is Harvard Architecture used?

A

Embedded systems and digital signal processing systems

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

Describe the role of the control unit.
Give 4 points.

A

Any 4 from:
* To control operation of the fetch-execute cycle
* It controls fetching (or loading or storing) operations
* It determines the type of an instruction
* To execute (some) instructions
* To synchronise the operation of the processor
* To send control signals and commands to other components
* To control the transfer of data between registers
* To handle interrupts

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

Describe the fetch part of the fetch decode execute cycle

A

Fetch:
- Contents of Program Counter transferred to Memory Address Register
- Address bus used to transfer this address to main memory
- Read signal sent along control bus
- Transfer of main memory content uses the data bus
- Contents of addressed memory location loaded into the Memory Buffer Register
- Contents of memory buffer register are copied to the current instruction register
- Increment Program Counter (part of Fetch stage, but not directly involved in fetching an instruction)

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

Describe the decode part of the fetch decode execute cycle

A

Decode:
- Instruction to decode held by the Current Instruction Register
- The control unit decodes the instruction
- Instruction split into opcode and operand(s)

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

Describe the execute part of the fetch decode execute cycle
Give 4 points.

A

Any 4 from:
- If necessary, data is fetched or stored
- The opcode identifies the type of operation to be performed by the processor
- The operation (identified by the opcode) is performed by the control unit.
- The ALU is used for calculation (or comparisons)
- The result (may be) stored in a register (or main memory)
- The status register is updated
- If a branch is required then the program counter is updated
- The control bus will transfer signals to other components to initiate or sequence actions

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

How would you subtract a binary number A from a binary number B?

A

Convert A into -A using two’s complement. Then use binary addition with -A and B.

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

Why use hexadecimal instead of binary?

A
  • Easier for humans to read/write/remember
  • More compact representation
  • Fewer digits required for the same value
  • Less screen space

(NOT BECAUSE IT TAKES LESS MEMORY SPACE. IT DOESN’T TAKE LESS STORAGE SPACE!)

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

What is the data bus used for? What is its direction?

A

The data bus is used to transfer data between components.

The data bus is bidirectional

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

What is the address bus used for? What is its direction?

A

The address bus is used to transfer memory addresses and I/O (input output) locations.

The address bus is unidirectional from the processor

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

What is the control bus used for? Give 4 points.
What is its direction?

A

Any 4 from:
* The control bus is used to transport control signals between components.
* Indicate that a memory write is occurring
* Transfer clock signal
* Indicate the number of bits being transferred
* Receive transfer acknowledgement
* Send signal to request use of system bus
* Receive signal granting use of system bus

The control bus is bidirectional

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

Give three examples of control signals

A
  • Clock signals
  • Memory read
  • Memory write
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the difference between volatile and non-volatile memory

A
  • Volatile memory maintains its data only while the device is powered.
  • Non-volatile memory retains stored information even after power is removed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Give an example of non-volatile main memory

A

ROM (Read Only Memory)

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

What is the instruction set?

A
  • The set of binary codes for the machine operations that a processor has been designed to perform.
  • It is specific to the processor
21
Q

What is the purpose of main memory?

A

Main Memory holds the instructions and data currently being used by the processes.

22
Q

What is the ALU?

A

The Arithmetic Logic Unit is the part of the CPU that is responsible for executing arithmetic operations (e.g. addition, subtraction, binary shifts) and logic comparisons (e.g. Or / And / Not)

23
Q

What is a register?

A

Extremely fast, very small, memory in the processor for temporary storage of binary values

24
Q

What does the program counter do?

A

Stores the address of the next instruction to be executed

25
What does the MAR do?
- Temporarily holds the address of the memory location that data will be read/written to - The MAR is the processor’s direct connection to the address bus for accessing main memory - Holds the address of the instruction in the fetch stage as it is fetched
26
What does the MBR do?
- Temporarily stores data read from or written to main memory - The MBR is the processor’s direct connection to the data bus for accessing main memory - Holds the instruction in the fetch stage before it is copied into the CIR
27
What is the role of the CIR in the FDE cycle?
- Stores the recently fetched instruction to be decoded by the control unit before it is executed
28
What information is stored in the status register?
- The status register contains many bits (binary flags) that are set (1) or cleared (0) depending on the result of an instruction - Each bit represents a boolean value, for example if an overflow error has occurred
29
What is the purpose of general purpose registers?
- Have no specific value stored - Usually used as temporary storage while performing arithmetic operations - Often store the operands of processor instructions
30
4 reasons secondary storage is needed
* Main memory is volatile, so secondary storage needed to store files that are needed multiple times * Secondary storage can be used to store larger files, as it usually has a much higher capacity than main memory * Secondary storage can be used for *virtual memory* * Main memory is expensive
31
4 advantages of Harvard architecture
* Instruction and data can be accessed simultaneously * Instruction and data memory can have different word lengths * Different technologies can be used to implement instruction and data memory * For systems with a predetermined use, instruction memory can be implemented as ROM which protects the programs from hacking
32
What is the significance of the leftmost bit in two's complement?
* The most significant bit (leftmost) is the sign bit, which represents a negative number when set to 1 * The MSB also contributes to the value of the number
33
What is 1111...111 in two's complement binary?
-1
34
Range of an 8-bit number represented as: 1. unsigned binary number 2. two's complement number
1. Unsigned: 0 to 255 2. Two's complement: -128 to 127
35
An 8-bit two's complement binary number can be between ___ and ___
-128 and 127
36
How to turn a negative number into its positive version in two's complement (and vice versa)?
1. From the right, every bit up to and including the first 1 stays the same. 2. Everything else gets flipped. *(This is the same as flipping every bit then adding 1)*
37
Where is Von Neumann architecture used?
General purpose computing systems
38
What is an identifier in the following examples? static void SetValue(int num){}; static string name;
SetValue name num (Notice there is no other code given).
39
What is iteration?
Where a code block is repeated through a 'for' loop or a 'foreach' loop
40
What is a selection structure?
Either an 'if' or a 'switch'
41
What values does the following code generate? int num = random.Next(1,100)
Integers from 1 - 99
42
What is nested selection?
Where you have an if within an if
43
What is nested iteration?
Where you have a for loop within a for loop
44
In the following code what is the highest value of the counting variable i reached: for(int i = 0; i < 10; i++) { Console.WriteLine(i); }
The highest value of i printed to the console is 9, but i gets to 10 and then the condition ( i < 10) is no longer met and the for loop exits
45
What are the steps for converting postfix to infix?
- Convert “num num op” triplets one at a time, adding brackets each time - Remove any unnecessary brackets Alternatively: - From left to right push numbers into a stack - When you reach an operator pop the last two numbers (or expressions) off the stack and apply the operator - push the result back onto the stack (Note that in this case to 'apply' an operator you should not evaluate e.g. 3 4 + -> 3 + 4 NOT 7)
46
What are the steps for converting infix to postfix?
- Add brackets around every operation - Draw arrow from operator to end of its bracket - Write expression, keeping numbers in the same order
47
What is concatenation?
When two string data type variables are merged together into a single variable
48
Describe the role of an I/O controller. Give 4 points.
Any 4 from: * Allows processor to communicate with a peripheral using an I/O port * Allows peripheral to appear as a set of registers * Translates data received from a peripheral into a form that can be processed by the computer * Buffer data being received from a peripheral so the processor does not have to wait for it * Allows new peripherals to be added without having to redesign the processor * Allows peripheral designers to create new peripherals to one common interface standard * To carry out some of the I/O related processing * To check that data received from peripherals is not corrupted * Implements the protocols used by I/O devices for communication * Generates an interrupt when data is ready to be transferred from an I/O device