# 11 - Final Test

1. Computational thinking is the art of a human being able to think like a computer (e.g. in binary using 1s and 0s)

TRUE

FALSE

2. Computational thinking is a ….

way of computing things in binary and not the alphabet

way of thinking with numbers as opposed to with words

way of thinking about a problem to understand it and then logically working out a good solution

way of computing big numbers and adding them up faster than a computer would

3. What is this a description of? "Looking for repeating patterns in a sequence"

Decomposition

Encapsulation

Abstraction

Pattern Recognition

4. What sort of loop is being used in this flowchart?

There is no loop

While

Repeat - Until

For

5. What is another word for 'Iteration'

IF statements

Recursion

Programming

Loops

6. If you were writing an algorithm for a game and needed a way to find out if the game was over, what might you do?

This cannot be done

Use a variable such as x and assign it a number from 0 to 10.

Use facial recogintion to see when the user is clearly depressed, and then end the game

Use a boolean flag like "game_over = False" at the start of the program, which changes to 'True' if game over

7. What is line two of this algorithm doing?
```StopPlaying = False
Num = RANDOM between 1 and 100
Guess = INPUT (“Guess the number I am thinking of: ”)
WHILE StopPlaying = False
IF Guess = Num THEN
OUTPUT (“Correct”)
StopPlaying = True
ELSE IF Guess > Num THEN
OUTPUT (“Too high”)
Guess = INPUT (“Try a lower number: ”)
ELSE
OUTPUT (“Too low”)
Guess = INPUT (“Try a higher number: ”)
END IF
END WHILE```

It is generating a random number that allows the game to start in that many seconds

It is generating 100 different random numbers starting with 1 and ending with 100

It is generating 100 numbers that the user must guess in 100 turns

It is generating a random number between 1 and 100 for the user to guess

8. There are generally speaking four elements of computational thinking. What are they?
```Elements of Computational Thinking
==================================
1. Decomposition
2. Pattern Recognition
3. Abstraction
4. Algorithmic Thinking
5. Binary number conversion
7. Subtraction```

1,3,5,7

1,2,3,4

1,4,5,6

3,4,5,6

9. Read the excerpt on computational thinking (from barefoot computing) and see if you agree.
`For example, if you’re going to make an animation, you need to start by planning the story and how you’ll shoot it before you can use computer hardware and software to help you get the work done. The thinking that is undertaken before starting work on a computer is known as computational thinking.`

TRUE

FALSE

10. Computational thinking is not thinking about computers or like computers. Computers don’t think for themselves. Not yet, at least!

TRUE

FALSE

11. Why is computational thinking so important?
`Computer scientists are interested in finding the most ____________way to solve problems. They want to find the best solution that solves a problem correctly in the fastest way and using the least amount of resources (time / space)`

tiring

efficient

time consuming

12. This library system menu screen is an example of abstraction as it focuses on the bare basics necessary for a user to interact with the library

FALSE

TRUE

13. Using examples from this scenario, explain what is meant by abstraction.
`A theme park uses a 3D computer simulation of a rollercoaster. Riders must wear a virtual reality headset to experience the ride.`

A detailed and thought provoking novel that accurately describes a thing - e.g. a rollercoaster

a representation of a concept / object / thing… …in this case, the rollercoaster.

a conceptual thought cloud of an object which cannot be seen, heard or touched.

an exact recreation of a concept/object thing - in this case a rollercoaster

14. In abstraction it is important to pick out the important / relevant parts / components / ideas / details.
`In the scenario of simulating a rollercoaster this would be: track / rider / car / physics  / etc`

TRUE

FALSE

15. In the example of a rollercoaster 3d simulation examples of the unimportant details you would NOT include would be:

track, rider

general physics

queues / weather / smells / etc.

car

16. One definition is: Abstraction is the process of removing unnecessary detail from a problem. Why is this useful?

So a programmer can focus on what is needed to get on with problem solving!

It is important because detail orientated people are entirely pointless and inefficient

It is important because the details just don't matter - the devil is in the detail!

It isn't important - it's just an art

17. Read the following excerpt on top down programming (decomposiiton) and see if you think it is TRUE or FALSE
```Top down programming
==================================
In top-down programming, a programmer takes a task and
then breaks it down into smaller tasks. They then take
They continue to do this until each sub-task is simple enough
to understand and program and, ideally, each sub-task performs
only one job. The sub-tasks are then programmed as self-contained
modules of code```

FALSE

TRUE

18. Read this excerpt on reusability of modules and decide whether it is true or false
```Decomposition and re-usability of modules
==================================
Splitting up a problem into modules improves a company's efficiency because
self-contained modules can be re-used. They can be put into a library of
modules. When a module is needed to, for example, display some values,
you don't need to get the programmers
to write and test a module for this again.
You just re-use a module from the library. Over time, this will save a
company a lot of time and money.```

FALSE

TRUE

19. Which of the following statements is an ADVANTAGE of decomposition?
```The advantages of decomposition
==================================
#1 >> Splitting up a problem into modules helps get the job done more
efficiently because modules of code can be worked on at the same time by different
programmers. In addition, it helps because easier modules can be given to less
experienced programmers while the harder ones can be given to more experienced ones.

#2 >> Splitting up a problem into modules helps program testing because it is easier to
debug lots of smaller self-contained modules than one big program.

#3 >> Splitting up a problem into modules helps program readability because it is easier
to follow what is going on in smaller modules than a big program.

#4 >> Splitting up a problem into modules improves a company's efficiency because self-
contained modules can be re-used. They can be put into a library of modules.
When a module is needed to, for example, display some values, you don't need
to get the programmers to write and test a module for this again. You just re-use
a module from the library. Over time, this will save a company a lot of time and money.

#5 >> Splitting up a problem into modules improves a Project Manager's ability to monitor the
progress of a program. Modules can be 'ticked off the list' as they are done and this
will demonstrate some progress. This is far harder for a Project Manager to do if
the program has not been split up into modules.

#6 >> Splitting up a problem into modules is good for future program maintenance.
If a program needs to be changed for any reason, it may be possible simply to
remove one module of code and replace it with another.```

#1 , #2 and #4

none of the above

Just #1 and #3

All of the above

20. In programming, one way of decomposing a task is to break it into…..

binary sequences

python programming code variables

Decomposition cannot be used in programming

modules (e.g. separate functions or suboutines)

21. How would you decompose the task of creating an app?

First know the answer to a series of smaller problems e.g. will it be android or iphone, what is the colour scheme, what language will you use?

The task of building an app can simply not be decomposed.

By making the problem a single whole entity by using an overview diagram (to define a single task)

By finding other similar apps and copying their code

22. Dealing with many different stages all at once is much more difficult than breaking a problem down into a number of smaller problems and solving each one, one at a time.

FALSE

TRUE

23. Which of these is an example of decomposition?

None of the above

Finding out how a bicycle works by looking in detail at the different parts that make up the bicycle

Watching a mechanic repair a bicycle

Looking at different bicycles for similarities between them

24. In an algorithm, each instruction is identified and the ________in which they should be carried out is planned

order

vessel

exact code

speed

25. Algorithms are often used as a starting point for creating a computer program, and they are sometimes written as a ___________________________
`Note: If you have never heard of an obfuscated cloud object, don't worry. It probably doesn't exist!`

C or Java implementation of code

piece of python code or in C#

flowchart or in pseudocode

flowchart or obfuscated cloud object

26. Computers are only as good as the algorithms they are given. If you give a computer a poor algorithm, you will get a poor result – hence the phrase: ‘Garbage in, garbage out.’
`Note:  An algorithm must be clear. It must have a starting point, a finishing point and a set of clear instructions in between.`

TRUE

FALSE

27. Pseudocode can differ, as there are no hard and fast rules, but what is important is that it is…..

as artistic as possible, ambiguous and vague and creative

easy to read, unambiguous and error free

creative, similar to one particularl language .e.g C++ and polite

as similar as possible to python programming code

28. Pseudocode should also be precise. How could the following pseudocode be improved?
```CardNumber ....
===============
DO
IF Pin != CorrectPin
PRINT(“Wrong PIN”)
END IF
UNTIL Pin==CorrectPin
Amount=INPUT(“How much money would you like?”)
IF Amount <= CurrentBalence THEN
DispenseCash(Amount)
CurrentBalence = CurrentBalence - Amount
ELSE
PRINT(“Sorry, insufficient funds”)
END IF
END```

The data types of the inputs could be specified

Delete all the IF statements

It cannot be improved

Put variables in UPPER CASE

29. Trace the flowchart's logic to find the profit or loss when CP(Cost Price) = 325 and SP (Selling Price) = 458
`Note: If the selling price is more than the cost price, a profit has been made!`

Profit = 133

Profit = 10

Loss = 133

Loss = 10

30. Analyse the logic of the flowchart and predict what it's function/purpose is.

A loop that counts from count = 1 to count = 10

Multiplication table for the number n - e.g. 12

A program that takes a number N (e.g. 12) and adds it to the number 10, and does so 10 times

A program that counts from 1 to 12

31. Just like in Maths there is the ________________________ for performing calculations, otherwise known as BODMAS/BIDMAS

binary only rule

zero law

order of precedence (order in which calculations are done)

preferential treatment

32. What does the B in BODMAS mean?

Anything inside the brackets must be subtracted from everything else

The brackets must be done last

The brackets must be ignored

Anything inside the brackets must be done first

33. What is the output of Z for the following algorithm, when the following numbers are input. A=27, B=15, C=52.
`Z=(88 MOD B)  DIV (A MOD 5)`

6

3

8

2

34. The code below is for a Binary Search (in python). Where has DIV been used here?
```def binary_search(list, int):
high = len(list)-1
low = 0

while low <= high:
mid = (high + low) // 2
guess = list[mid]
if guess > int:
high = mid -1
elif guess < int:
low = mid + 1
else:
return ('{} found in list at position {}'.format(int, mid))
return None

print(binary_search([12,15,19,23,27,29], 27))```

On the line that says: "If guess > int:"

It hasn't

On the line that says: mid = (high + low) //2

Straight forward division (/) has been used but not DIV

35. Why do we need to look for patterns in problems?

None of the above

Patterns make it more complex and therefore more difficult to solve problems

Patterns make it easier for us to solve complex problems

It is never useful to look for patterns - this is just an artistic, fun thing to do

36. All cars have wheels' is a pattern, because all cars have a _____________________ - wheels.

None of the above

different feature

distinct colour

similar feature

37. What is the following algorithm doing?
```n=1
while n<=100
display n
n=n+1
endwhile```

None of the above

Print the numbers 1 to 100 inclusive- with a while loop

Print the number 1 and check to see if 1 = 100

Print the number 1 and use a while loop to check random numbers

38. The following algorithm does this: Input 100 positive (>=0) numbers. Add up the numbers, and print the total. If a negative number is encountered, ___________________
```sum=0
count=1
input number
while (count<=100)and(number>=0)
sum=sum+number
count=count+1
input number
endwhile
display sum```

the program should continue as if nothing happened

The program should go back to the beginning and change all the positive inputs into negative ones

the program should alert the user that a negative number is found and then continue

the program should terminate, and print the sum so far.

39. What sort of iterative structure has been used in this algorithm?
```for hours=0 to 11
for mins=0 to 59
dis[play hours, mins
endfor
endfor```

a for loop within a while loop

a nested for loop

a catch-me-if-you-can statement

a beautiful soup loop

40. In the following algorithm, it is likely that 'a' is referring to ….
```input low, high
for n=1 to 100
if (a[n]>=low) and (a[n]<=high)
print a[n]
endif
endfor```

a statement called 'a'