ASSIGNMENT
1. a) State three advantages of low -level languages (3mks)
b) Give two differences between a compiler and an interpreter. (2mks)
c) Study this flowchart and use it to answer the questions that follow.
Start
S=1
Y = Y/10
S=S+1
Y < 10? NO
YES
S
Stop
I. Give the expected output from the flowchart when the value of Y is:
(i) 48 (1 marks)
(ii) 9170 (2 marks)
(iii) – 800 (2 marks)
II. Write the pseudo code that can be used to create a program represented by
the above Flowchart.
Q2. a. Use two complement to perform the following arithmetic operations
i) 1510 -1210 (4mks)
ii) 101112- 10112 (3mks)
b) 10112 is a ones complement binary representation of negative number using
four bits work out the likely positive equivalent in base 10. (4mks)
c) Convert the decimal fraction 10.37510 into its binary equivalent (3mks)
Q3.
(i) Define the following terms as used in programming. (3marks)
a. Machine dependent
b. Bug
c. Syntax
(ii) Give two reasons to justify why most programmers prefer using compilers
instead of interpreters. (2marks)
(iii) Describe two limitations of machine language. (2marks)
(iv) Study the pseudo code below and design its equivalent flowchart (8marks)
Start
Count=1
For count =1 to 5 Do
Get Value 1 and Value 2
If Value 1 > Value2 Then
Maximum =Value1
Else
Maximum =Value2
Endif
Display Maximum
Count=Count+1
Stop
Q4.
(i)The five-bit number 00101 is used to represent decimal number 5, show three
methods of coding for negative 5. (3marks)
(ii) Convert the binary number 1010111101011011100012 into its
(a) Octal equivalent (2marks)
(b) Hexadecimal (2marks)
(iii) Convert 10101.0101012 to decimal (3marks)
(iv) Use 8-bit twos to subtract 3510 from 1710 (3marks)
(v) Perform the following calculation (2marks)
1100012+11112-111112
Q5. Study the following three sections of code and name accordingly (3marks)
10101010110 MOV AL, 10 <OL> <li> Chemistry
01010101010 MOV DL, 25 <li>Biology
01000010101 MUL DL <li>Physics</li></OL>
10100010110
(a) (b) (c)
Q6. (a) Explain the term structured programming as used in program development.
(2marks)
(b) Name the stage of program development in which: (4marks)
(i). A flowchart would be drawn.
(ii). The programmer would check whether the program does as required.
(iii). User guide would be written.
(iv). The requirement specification would be written.
(c) State two function of an assembler. (2marks)
(d) To qualify to play in football tournament, a student must be aged between
13 and 18, the system automatically checks a player’s age once their names and date
of birth have been provided. 11 participants were evaluated and their qualification
status displayed alongside their name and age. Draw a flowchart that would be used
to create the program. (7 marks)