Preview

01 - An introduction to logical reasoning

 1. We think logically all the time. Watch this presentation and click "Yes" when you have done so.

  Nope, not bothered.

  Yes - I've watched the presentation

 2. A recipe is basically a simple algorithm.

  FALSE

  TRUE

 3. If you wrote out a set of rules to make a cup of coffee, this would count as an algorithm.

  TRUE

  FALSE

 4. If someone put jelly in their car instead of petrol, what is likely to happen when they turn on the engine?

  It may not work as intended.

  It would work just perfectly!

  The car may turn red.

  The person driving the car may turn into jelly!

 5. Fred has four apples. He gives two apples to Hannah. Hannah gives one apple to her brother. How many apples does Hannah have now?

  0

  3

  2

  1

 6. What is the output of the following code?
a=2
b=3
x=b+a
print(x)

  5

  1

  3

  7

 7. Here is an algorithm for entering a number and printing a sentence to the screen. If the number 21 is input, what is output?
number=input("Enter a number")
if number is greater than 20:
  print("Lovely")
else:
  print("Oh No")

  3

  21

  Oh No

  Lovely

 8. The following algorithm doesn't make any sense. Can you predict and explain why?
x=2
y=a+2
print(y)

  Because'x' has no value

  Because 'a' has no value and we are trying to add 'a' to 2

  Because adding 2 is not acceptable - we should use a bigger number

  Because it is not possible to add numbers together

 9. Here's a harder question. If firstnumber = 2 and secondnumber = 10, what will the output be?
INPUT firstnumber
INPUT secondnumber
if firstnumber is greater than secondnumber then 
print "Greater"
else:
print "Smaller"

  Greater

  Longer

  Smaller

  Nothing

 10. And even harder one, predict the output of this python code.
x=3
y=2
x=x+y
y=x
z=y+2
print(z)

  3

  7

  8

  5