**UNIVERSITY EXAMINATIONS: 2018/2019**

**EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN **

**SOFTWARE DEVELOPMENT**

**BSD1208 COMPUTATIONAL THINKING THEORY**

**FULL TIME/PART TIME/DISTANCE LEARNING**

**DATE: APRIL, 2019 TIME: 2 HOURS**

**INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.**

**QUESTION ONE**

a) Define the following terms:

i) Computation thinking (2 Marks)

ii) Decision structure (2 Marks)

iii) Sequence (2 Marks)

b) Describe the meaning of the term “ computational thinking concepts” (2 Marks)

c) State and explain any five computational thinking concepts (5 Marks)

d) Define the term “Class” as used in computational thinking (2 Marks)

e) Write python code for creating a class named Person, which use __init__() function to

assign values for name and age (4 Marks)

f) Describe the difference between a function and a procedure (2 Marks)

(g) Briefly the meaning of the term “abstraction” as used in computational thinking theory

(2 Marks)

(i) State and explain two types of abstraction (4 Marks)

(h) Describe computation thinking concept that is illustrated in the following figure

(3 Marks)

**QUESTION TWO**

(a)Define the term “ algorithm” (2 Marks)

(c ) outline any five characteristics of an algorithm (5 Marks)

(d)State and explain two techniques of representing an algorithm (4 Marks)

(e ) state and explain three types of Instructions in an Algorithm. Write an example for each case

(6 Marks)

(e) Write algorithms and determining and outputting whether Number N is Even or Odd

(3 Marks)

**QUESTION THREE**

(a)Briefly explain the following terms in the context of computational thinking theory. Write a

sample python code to demonstrate implementation of each term

i) Variable (3 Marks)

ii) Data Dictionary (3 Marks)

iii)Set (3 Marks)

iv)Tupple (3 Marks)

(b) What is a “pseudocode”? (2 Marks)

(c) Write a pseudocode for a determining whether a Student Passed the Exam or Not

(3 Marks)

(d) Draw a flowchart to represent to graphically represent the pseudocode written in (b)

(3 Marks)

**QUESTION FOUR**

a) The figure below shows a crane in a certain port.

The crane in the above figure is operated using the following six command buttons

(i)Use the command buttons to swap the positions of the two crates (4 Marks)

(ii) Describe computation thinking concept that was used to solve the swapping problem in (i)

(2Marks)

b) Students want to encode numbers. They developed the quick code (Q-code) that consists of

squares. Every square has a certain value. The squares are filled line by line from the bottom

to the top and from right to left. The value of the square before them.

The figure below shows one of the developed Q-code.

Which is the encoded number in the above Q R-code?. Describe computational thinking that you

have used to obtain the answer. (4 Marks)

(e) Briefly explain meaning of the term “QR codes” in the context of computation thinking

(2 Marks)

(d) Describe any two applications of QR codes in the industry (4 Marks)

(e) Alice and Bob want to send signals in the night using a flashlight. They transmit sequences of

4 symbols ‘0’ or ‘1’. Before each sequence they turn on the light for 1 second. If the symbol is ‘0’,

the light is on for 1 second and if the symbol is ‘1’, the light is off for 1 second. After each

sequence a pause of at least 1 second is made. For example, the sequences ‘1001’ and ‘0110’ are

transmitted as follows:

i) Which sequence or sequences of signals are transmitted in the following diagram?

(2 Marks)

Left up Let go Grab Down

n

Right

ii) Draw a diagram to illustrate how the sequences ‘10010101’ and 1100101 can be

transmitted (2 Marks)

**QUESTION FIVE**

a) Describe the meaning of the following terms in the context of computational thinking theory

(6 Marks)

(i) Search Problem

(ii) Problem Decomposition

(iii) Generalization

(b) A farmer and his wolf, goat, and cabbage come to the north side of a river that they wish to

cross. There is a boat, but it has only room for two, and the farmer is the only one that can cross

alone If the goat and the cabbage are left alone together, the goat will eat the cabbage. Similarly,

if the wolf and the goat are together without the farmer, the goat will be eaten.

i) Devise a series of crossings of the river so that all concerned make it across safely

(3 Marks)

ii) Define any four elements of the search problem (4 Marks)

iii) Draw a well labelled and directed graph to represent the search problem (3 Marks)

(c) A group of inspectors need to make an inspection of the river today: at least one of them has to

swim along each of the river streams. Due to the heavy current, inspectors can only sail a boat

downstream and they can only do one trip from A to B. So the inspectors start at A, and they will

meet at B. Every stream of the river has to be inspected. The figure below show a map of the river

streams.

(i) Use the above figure to determine number of inspectors needed for a full inspection

(2 Marks)

(ii) Describe computation thinking concept that has been used to solve the problem of

inspecting the river in(i).

(2 Marks)

A

B