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.

  FALSE

  TRUE

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

  The car may turn red.

  It would work just perfectly!

  The person driving the car may turn into jelly!

  It may not work as intended.

 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?

  2

  3

  1

  0

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

  5

  3

  7

  1

 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")

  Oh No

  21

  3

  Lovely

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

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

  Because'x' has no value

  Because it is not possible to add numbers together

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

 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"

  Smaller

  Longer

  Nothing

  Greater

 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)

  5

  3

  8

  7