Examplary
Start for free
Oak ComputingTest · Computing

Creating an XOR function

The starter and exit quiz of the lesson “Creating an XOR function”, from the unit “Programming: subroutines” (Year 10 Computing) by Oak National Academy.

Free to use. Edit it, share it and hand it out to your students.

Oak National Academy

10 questions

  1. What will be the output when this program is run?num1 = 5num2 = 10if num1 < 6 and num2 > 8: print("That is True")else: print("That is False")
  2. What will be the output when this program is run?num1 = 5num2 = 10if num1 == 5 or num2 > 11: print("That is True")else: print("That is False")
  3. Match the definition to the keyword.
  4. What will be the output when this program is run?def divide(a, b): answer = a / b return answerdivide(8, 2)print(answer)
  5. Which of the following are reasons why global variables should be avoided?
  6. ___ passing is the process of passing data into a subroutine and can be used as an alternative to global variables.
  7. Which of the following are built-in operators in Python?
  8. What will this code output?one = 4 == 4two = 2 != 2print(xor_function(one, two))
  9. What will this code output?one = 4*2 == 32/4two = 2 == 2print(xor_function(one, two))
  10. Which logic gate symbol is used to represent XOR?

License: OGL

Creating an XOR function · Examplary