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.

  False

  True

 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

  Charles Babbage

  Jon Von Neumann

  Jon Von Babbage

  Alan Neumann

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

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

  a low level program language (similar to binary)

  a high level programming language

  an app that has been created (like facebook)

  a type of system's architecture

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

  print

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

  Hello

  print Hello

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

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

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

  There is no syntax error. This is correct.

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

 8. A variable is also called a/an:

  function

  constant

  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.

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

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

  There are no errors

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

  binary bit

  distant electric current

  switch

  memory location

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



def quiz():
  print("Quizzing")
  

login()

  Three functions

  Two functions

  One function

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

  It will print "AI is here"

  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

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

  There should be speech marks around the word 'chat'. 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 we have not indented properly

  It will run!

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

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

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

  A missing set of brackets

  No error

  A missing colon

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

 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 2 should not be indented

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

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

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

 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 program is checking to see if the name entered matches the word 'name'

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

  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 Turing Test

  The Neumann Test

  The AI 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()

  Line 5 uses a variable that is nonsensical and line 4 uses an undeclared variable

  The code will run, but it is poorly structured and the indentation could be improved.

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

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