Preview

1 - Introduction to CS and Programming

 1. Before you start, please watch and work through the video. True or False? I have watched and worked through the video.

  True

  False

 2. The first task assigned to the Los Alamos _________ was to perform more precise and extensive calculations of the thermonuclear process.

  Mark III

  Mark I

  Maniac

  Enigma

 3. What was the name of the man who was behind the architecure described below?
Written by _______________________?

First Draft of a Report on the EDVAC
=====================================
This document describes a design architecture 
for an electronic digital computer with these components:

-A processing unit that contains an arithmetic logic unit and 
processor registers

-A control unit that contains an instruction register and program 
counter

-Memory that stores data and instructions

-External mass storage

-Input and output mechanisms

  Jon Von Neumann

  Jon Von Babbage

  Alan Neumann

  Charles Babbage

 4. What is the first name of the inventor/creator of the python programming language?

 5. Python is?..........

  an app that has been created (like facebook)

  a type of system's architecture

  a high level programming language

  a low level program language (similar to binary)

 6. What does the following code output to the screen?
print Hello

  print Hello

  Hello

  print

  A syntax error. It should be print("Hello") to output "Hello"

 7. Spot the syntax error in the following code.
PRINT("Hello")

  There is no syntax error. This is correct.

  "Hello" should not be in speech marks. It should be print(Hello)

  There should be a colon at the end of the command.PRINT("Hello"):

  PRINT should not be in capitals. It should be "print"

 8. A variable is also called a/an:

  constant

  function

  identifier

  boxable

 9. How many variables can you spot in this code?
def chat():
  name="Ruth"
  age="21"
  movie="Snoopy"
  address=input("Enter your address:")
  
chat()

  4

  1

  3

  2

 10. Play around with the following code. Where did you spot the error?
def robot():
  print("I am a Robot")
  name=input("Who are you?")
  print("Nice to meet you,"robot)

robot()

  Line 4 is referring to a variable 'robot' that does not exist.

  There are no errors

  Line 1 should not have a colon after the command 'def robot'

  Line 3 should have the variable 'name' at the end of the command, not at the start.

 11. A variable is a _______________ in which values are stored. These values can change.

  switch

  distant electric current

  memory location

  binary bit

 12. How many functions can you spot in the following code?
def login():
  print("Welcome - please login")



def quiz():
  print("Quizzing")
  

login()

  One function

  Two functions

  Three functions

  There are no functions

 13. What will be printed to the screen if you run the following program?
def chatbot():
  print("----AI is here----")

  Nothing - the chatbot() function has not been called!

  It will print "AI is here"

  It will print "chatbot"

  It will print the print command itself

 14. Can you spot the error in the code on line 1?
def chat()
  print("---Chat Now----")
  name=input("Enter name:")
  print("Hello there,"name)
  


chat()

  Missing full stop at the end. It should be def chat().

  There are no errors

  There should be speech marks around the word 'chat'. def "chat"

  Missing colon at the end. It should be def chat():

 15. In the first instance, why will the following program fail to run?
def artificialintelligence():
  print("---I'm a Robot----")
  name=input("Enter name:")
  print("Hello there,"name)
  


chat()

  Because there should not be brackets after the chat on line 8.

  It will run!

  Because we are calling (on line 8) the 'chat' function that doesn't exist!

  Because we have not indented properly

 16. What error can you spot on line 2 of this code?
def boo():
print("Boo")
boo()

  A missing set of brackets

  Incorrect indentation - it should be inside the function 'boo'

  A missing colon

  No error

 17. Can you spot the error that prevents this code from being correctly run?
def chat():
  print("Hello there")
  name=input("What is your name?")
  print("Nice to meet you,"name)


chat()

  Line 1 should be: def chat("Hello")

  Line 2 should not be indented

  Line 4 should be: print("Nice to meet you,",name)

  Line 4 should be indented further in so it is not on the same line as the previous line.

 18. In the following program, how would you describe what is happening on line 3?
def chat():
  print("Hello there")
  name=input("What is your name?")
  print("Nice to meet you,",name)


chat()

  A variable 'name' is being called and executed

  The user is being asked for input. They must enter their name which is stored in a variable

  The program is checking to see if the name entered matches the word 'name'

  The user enters their name and it is stored in the function 'chat'

 19. _______ is a test of a machine's ability to exhibit intelligent behaviour equivalent to, or indistinguishable from, that of a human.

  The Babbage Test

  The AI Test

  The Neumann Test

  The Turing Test

 20. Analyse the following code carefully. Which of the following statements is most correct?
def robot():
  print("I am a Robot")
  name=input("Who are you?")
  print("Nice to meet you,",robot)
  name2=input("So how old are you?")

robot()

  The code will not run: it is poorly structured and the indentation could be improved.

  The code will not run as there is an error on line 5.

  The code will run but there is a variable on line 4, robot, that does not exist.

  The code will not run because the variable for age on line 5 is name2, and should be 'age'