WorksheetsPython Programming - I B.Sc CS quiz
Total questions: 50
Worksheet time: 24mins
What will be the output?
name = "Dave"
print (name)
Dave
name
"Dave"
(name)
What will be the output?
name = "Dave"
print (name)
Dave
name
"Dave"
(name)
What is a input?
To plug in something
A function that allows us to ask the user to enter some data
Data displayed on a screen
A routine
A variable must have been assigned (given) a value before that value is referenced (used).
True
False
The correct way to convert user input is:
birth_year = number(input())
birth_year = int(input())
birth_year = (input(int))
birth_year = int(input)
To display the following on screen Hello World! the following command should be used:
print(Hello World!)
print("Hello World" + !)
print("Hello World!")
print"(Hello World!)"
You assign a value to a variable with which symbol
@
==
=
*
The code you use to receive and input from the keyboard
enter()
add()
receive()
input()
Program statements are executed in sequence, one after the other...
True
False
if you receive a NameError when you run your program it means....
A variable has been assigned before it has been referred to
An incorrect name has been chosen
A variable has been referred to before it has been assigned
A language key word has been used
If the coding steps are in the incorrect order, the computer can still execute the program.
True
False
guess=input()
guess=input()
guess=input()
guess=input()
Which word completes this sentence: "Iteration makes code more ___________"
Complex
Efficient
Simple
Straightforward
A FOR loop is....
A COUNT controlled loop
A CONDITION controlled loop
A WHILE loop is....
A COUNT controlled loop
A CONDITION controlled loop
What will the output be for the code shown here?
3,2,1,0
0,1,2,3
3,2,1
1,2,3
What would the output be for the code shown here?
0,1,2,3,4,5,6,7,8,9
1,2,3,4,5,6,7,8,9,10
0,2,4,6,8,10
0,2,4,6,8
Anil is writing a "rock, scissors, paper" program. He wants the game to repeat until the user doesn't want to play anymore. What loop should he use?
a FOR loop
a WHILE loop
Clara is writing a program that will print out the first ten numbers of a times table (chosen by the user). Should she use....
a FOR loop
a WHILE loop
Tara has written a "Hide and Seek Simulator" - what will happen when she runs it?
It will print "1,2,3,4,5,6,7,8,9,10 Coming ready or not!"
The program will not run
It will print "1,2,3,4,5,6,7,8,9,11 Coming ready or not!"
It will print ("10 Coming ready or not!")
name = 'Dave'
print (name)
Returns the remainder from division.
DIV
MOD
A data type consisting of numbers with decimals.
integer
float / real
string
boolean
What function is used to output a message in python?
print ("")
print = ("")
Print ("")
What is the word (command) used to display output within Python?
input
output
display
What is a variable?
A box(memory location) where you store values
A box(memory location) where you store multiple values
Data type
A static memory value
Which of these would work as a piece of code in Python?
IF answer == "Yes":
if answer == "Yes"
if answer == "Yes":
if answer = "yes":
What syntax would you use to create a name variable in Python?
name=input()
input=name
name=input{}
name=INPUT
If you want multiple options for your code, what should you use (after if)?
elif
else
if
A data type consisting of whole numbers.
integer
float / real
string
boolean
A data type consisting of a single character.
integer
character
string
boolean
Why was Python (TM) developed?
To go back to the old way of programming
To create a programming language for students in grade school
To make it easier to learn Java
Python was developed by accident
Python (TM) is owned and managed by
Microsoft (c)
Sun Microsystems (c)
Python (TM) is open source and free to use
Google (c)
Python is ___________ level programming language and is ___________.
High, compiled
High, interpreted
Low, compiled
Low, interpreted
Generally speaking, a low level programming language is easier to read, write and maintain over a high level programming language
True
False
The syntax in Python (TM) is one of the main advantages over other high level programming languages.
True
False
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
A block is
a statement including elements of a command
the structure and form of the code
source code that is grouped together
meaning assigned to symbols, characters and words
What symbol comes before a comment?
$
>>
#
!
An exception is
the structure of form of the code
the meaning of the characters and words in the code
the statement that is missing from the instructions
an event occurring during execution of a program which disrupts the flow of the program's instructions
Debugging is
how characters are arranged in a statement
detecting or removing errors from a program
removing viruses from a computer
the meaning of each of the characters and symbols in the program
A disadvantage of Python is it is harder to debug than other higher level programming languages.
True
False
In programming, a (n) _______________ is a value that can change, depending on conditions or on information passed to the program
string
block
instruction
variable
Generally speaking Python (TM) would run _____________ than C++ and take ____________ time to create
faster, less
faster, more
slower, less
slower, more
Since Python (TM) is open source,
Support for using Python (TM) is easy to find
It is free
There is a large catalog of supporting documents
it is a less powerful programming languange
A statement in programming
Expresses an action to be carried out
Always returns results like expressions
Rules controlling how components in a program are combined
An instruction to perform a task, usually one word
