department of computer science
college of computing
western delta university
first semester examination 2023/2023 session
CSC209 - foundations of sequential programming time: 2hrs: 30mins
Answer question one (1) and any other three (3) questions
Question 1 (Compulsory) (25 Marks)
- What is program design? (2 marks)
- Define the following Program design tools:
- Algorithm
- Flowchart
- Decision Table
- Pseudo-Code
- List six (6) logical operators used in pseudocodes. (3 marks)
- Write explanatory notes on the following control structures:
- Sequence
- Selection
- Iteration
- Write a pseudo-code that computes and displays the product, sum, and average of three (3) integer numbers on the screen. (5 marks)
- Draw the corresponding flowchart. (5 marks)
Question 2 (15 Marks)
- What are the compilers and interpreters? (3 marks)
- Briefly explain four (4) reasons why computer programs are designed. (4 marks)
- Using an appropriate diagram, discuss the program development life cycle. (8 marks)
Question 3 (15 Marks)
- Convert 47510 to Base 2.
- Convert 2210 to Base 8.
- Convert 2210 to Base 16.
- Convert 110012 to Base 10.
- Expose the differences between Machine Language and Low-level Language. (2 marks)
- List three (3) advantages of machine language. (3 marks)
- Identify four (4) disadvantages of machine language. (2 marks)
Question 4 (15 Marks)
- Explain the following data storage representations:
- Binary Coded Decimal (BCD)
- Unsigned representation
- Signed representation
- Store 200 and 260 in a 16-bit memory locating using unsigned representation. (4 marks)
- Store 30 and -40 in an 8-bit memory locating using signed representation. (4 marks)
- Store -40 in an 8-bit memory location using two's complement. (2 marks)
- Explain the following data storage representations:
Question 5 (15 marks)
- Compute the following:
- NOT 101101010111
- 101001011 OR 010110100
- 10000 AND 01011
- 101110111011 XOR 001111011101 (6 marks)
- Explain the following shift operations:
- Logical shift left
- Logical shift right
- Circular left shift
- Circular right shift (6 marks)
- Perform shift left operation on 1000110 (2 marks)
- Carry out shift arithmetic right on 01100110 (1 marks)
- Compute the following:
Question 6 (15 Marks)
- Using an appropriate example, one for each, discuss the following:
- 3-address machine
- 2-address machine
- Give two (2) advantages and two (2) disadvantages of a 2-address machine. (4 marks)
- What is an Addres format? State two (2) methods of Address format. (3 marks)
- Show to implement the high-level statement
k = k - p - k * q
on a 3-address machine. (3 marks)
- Using an appropriate example, one for each, discuss the following: