Preview

10 - Practice Test

 1. Computational thinking is a ….

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

  way of thinking with numbers as opposed to with words

  way of computing things in binary and not the alphabet

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

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

  Abstraction

  Pattern Recognition

  Encapsulation

  Decomposition

 3. It can be easier to see how a problem is decomposed by making a diagram. ___________are a popular way of doing this.
The diagram is complete when all of the problems have been broken down into enough detail to find an easy solution for them. (Be sure to look up examples of top down diagrams and see how they are used in programming e.g. game design)

  Top Down Diagrams

  Bottom up Diagrams

  Fenyman Diagrams

  Functional Tree Diagrams

 4. What is another word for 'Iteration'

  Programming

  IF statements

  Recursion

  Loops

 5. 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?

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

  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

 6. 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 between 1 and 100 for the user to guess

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

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

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

 7. 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
6. Addition
7. Subtraction

  1,3,5,7

  1,4,5,6

  1,2,3,4

  3,4,5,6

 8. 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.

  FALSE

  TRUE

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

  FALSE

  TRUE

 10. 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

  radical

  efficient

  time consuming

 11. 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
abstracrion3.png

  TRUE

  FALSE

 12. 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 representation of a concept / object / thing… …in this case, the rollercoaster.

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

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

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

 13. 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

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

  car

  general physics

  queues / weather / smells / etc.

  track, rider

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

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

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

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

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

 16. 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 
each smaller task and break it down further into sub-tasks. 
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

  TRUE

  FALSE

 17. 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.

  TRUE

  FALSE

 18. 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.

  All of the above

  Just #1 and #3

  #1 , #2 and #4

  none of the above

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

  modules (e.g. separate functions or suboutines)

  python programming code variables

  binary sequences

  Decomposition cannot be used in programming

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

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

  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?

  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

 21. 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.

  TRUE

  FALSE

 22. Which of these is an example of decomposition?

  None of the above

  Looking at different bicycles for similarities between them

  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

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

  speed

  exact code

  vessel

  order

 24. 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!

  piece of python code or in C#

  flowchart or obfuscated cloud object

  C or Java implementation of code

  flowchart or in pseudocode

 25. 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.

  FALSE

  TRUE

 26. 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

  as similar as possible to python programming code

  easy to read, unambiguous and error free

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

 27. Pseudocode should also be precise. How could the following pseudocode be improved?
CardNumber ....
===============
   CardNumber=INPUT(“Please enter Card Number”)
   DO
      Pin=INPUT(“Please enter Pin”)
      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

  Put variables in UPPER CASE

  Delete all the IF statements

  It cannot be improved

  The data types of the inputs could be specified

 28. 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!
flowchart_q2.png

  Profit = 133

  Loss = 133

  Profit = 10

  Loss = 10

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

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

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

  A program that counts from 1 to 12

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

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

  order of precedence (order in which calculations are done)

  preferential treatment

  binary only rule

  zero law

 31. What does the B in BODMAS mean?

  Anything inside the brackets must be done first

  The brackets must be done last

  The brackets must be ignored

  Anything inside the brackets must be subtracted from everything else

 32. 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)

  3

  2

  8

  6

 33. 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: mid = (high + low) //2

  It hasn't

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

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

 34. 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

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

  Patterns make it easier for us to solve complex problems

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

  None of the above

  different feature

  similar feature

  distinct colour