Friday, October 21, 2011

Tutorial 1 - Chapter 2

QUESTION 1 (Total 10 marks)
a) i) How many different integers can be represented by 4 bits? 1 mark

ii) Convert the hexadecimal value 5A to binary. 1 mark.

iii) Convert the hexadecimal value 5A to decimal (denary). 1 mark.

b) i) What is meant by a floating point number? 2 mark.

ii) Explain why some numbers are stored by computers in floating point format instead of as integers. 2 mark.

c) i) Describe the purpose of the Arithmetic Logic Unit (ALU) in a processor. 2 mark.

ii) Which register holds the address of the next instruction to be fetched into the processor from
memory during the fetch-decode-execute cycle? 1 mark.

QUESTION 2 (Total 10 marks)
a) i) Why are computers are built to work with digital data? 3 mark.

ii) State the number of different whole numbers that can be stored in 8 bits of memory. 1 mark.

iii) Explain what are hexadecimal numbers. 2  mark.

iv) Why do programmers often use hexadecimal numbers to represent values stored in a computer? 2  mark.

b) State TWO (2) tasks performed by the control unit of a microprocessor. 2  mark.

QUESTION 3 (Total 10 marks)
The following is a program written for the Little Man Computer.
0 : INP
1 : STA NUM1
2 : INP
3 : STA NUM2
4 : SUB NUM1
5 : BRP SECOND
6 : LDA NUM1
7 : OUT
8 : BRA END
9 : SECOND LDA NUM2
10 : OUT
11 : END HLT
12 : NUM1 DAT
13 : NUM2 DAT
a) Explain the purpose of the instruction in line 5. (3 marks)

b) Identify TWO labels used in this program. (2 marks)

c) State the purpose of this program. (2 marks)

d) The program is run and the number 5 is input, followed by the number 4. State the contents of the
accumulator and the program counter when the program is terminated.
(2 marks)

e) Define the term instruction set. (2 marks)

1 comment:

  1. ANSWERS TUTORIAL 2

    QUESTION 1
    Throughout the question, please credit any valid alternative point.

    a) i) How many different integers can be represented by 4 bits?
    • 16

    ii) Convert the hexadecimal value 5A to binary.
    • 01011010 (the leading zero may be omitted)

    iii) Convert the hexadecimal value 5A to decimal (denary).
    • 90

    b) i) What is meant by a floating point number?
    • number that is split into two parts
    • parts separated by a (binary) point
    • mantissa/fractional part
    • exponent/measure of size

    ii) Explain why some numbers are stored by computers in floating point format instead of as integers.
    • integers cannot handle fractions/to accommodate fractions
    • bigger range of numbers than integers
    • floating point can be used to store very large/very small numbers

    c) i) Describe the purpose of the Arithmetic Logic Unit (ALU) in a processor.
    • performs calculations
    • performs comparisons

    ii) Which register holds the address of the next instruction to be fetched into the processor from memory during the fetch-decode-execute cycle?

    • program counter


    QUESTION 2
    a) i) Why are computers are built to work with digital data?
    • only two states need to be distinguished
    • this makes them simpler to build
    • this reduces costs
    • this makes them more reliable

    ii) State the number of different whole numbers that can be stored in 8 bits of memory.
    • 256

    iii) Explain what hexadecimal numbers are.
    • base 16 numbers
    • each place value is worth 16 x the one on its right
    • 16 different digits used
    • 0-9, A-F

    iv) Why do programmers often use hexadecimal numbers to represent values stored in a computer?
    • direct equivalence with binary
    • they take less space to write
    • less likely to make an error when writing them

    b) State TWO (2) tasks performed by the control unit of a microprocessor.
    • decodes program instructions
    • carries out program instructions
    • fetches data from memory




    QUESTION 3
    The following is a program written for the Little Man Computer.
    0 : INP
    1 : STA NUM1
    2 : INP
    3 : STA NUM2
    4 : SUB NUM1
    5 : BRP SECOND
    6 : LDA NUM1
    7 : OUT
    8 : BRA END
    9 : SECOND LDA NUM2
    10 : OUT
    11 : END HLT
    12 : NUM1 DAT
    13 : NUM2 DAT

    a) Explain the purpose of the instruction in line 5.
    • it checks the number in the accumulator
    • to see if it is greater than or equal to zero
    • if it is the program branches to the line labelled SECOND / line 9


    b) Identify TWO labels used in this program.
    • END
    • SECOND
    • NUM1
    • NUM2


    c) State the purpose of this program. 2
    • inputs two numbers
    • outputs the larger


    d) The program is run and the number 5 is input, followed by the number 4. State the contents of the accumulator and the program counter when the program is terminated.

    • accumulator=5
    • program counter=11

    e) Define the term instruction set.
    • the complete list of all the instructions that a processor can carry out

    ReplyDelete