WorksheetsPython Definitions
Total questions: 12
Worksheet time: 6mins
What term is used to describe data passed into a definition?
Variable
Loop
Constant
Parameter
How do you correctly call this function definition?
def(1)
x=square( )
defSquare(4)
x=square(5)
Which of the following keywords marks the begining of the function block?
Func
define
def
function
What is a variable defined outside (i.e. in the main code) all the definitions referred to as?
A static variable
A global variable
A local variable
An automatic variable
What is a variable defined inside a definition referred to as?
A static variable
A global variable
A local variable
An automatic variable
What will be PRINTED?
nothing
5
6
an error message
When writing a definition, it must occur before it is called.
true
false
What would the output be from the program shown here? (assuming that the user enters "John" and "Smith")
John
Smith
John Smith
Error
What is the difference between a procedure and a function?
They are the same thing
A procedure passes values back out to the program, a function does not
A function passes values back out to the program, a procedure does not
A function can run without being called
What will be the output of this program if the user enters "Han" and then "Solo"?
there will be an error
HanSolo
first surname
Han Solo
Which of the following statements is NOT true?
Definitions are examples of reusable code
Definitions are always appropriate in programs
Using definitions make it easier to "deconstruct" a problem into smaller pieces
Definitions can make programs easier to read and understand
What would the output be for the following program if the user enters 4 and 6?
10
14
16
there will be an error
