A program stored in a file (usually one that will be interpreted).
Give this one a try later!
script
What will the output of this python program be?
def test_function( length, width, height):
print ("the area of the box is ",lengthwidthheight)
return lengthwidthheight
l = 12.5
w=5
h=2
test_function(l, w, h)
a. The area of the box is 125
b. The area of the box is 125.0
,c. The area of the box is 120
d. 125.0
Give this one a try later!
b. The area of the box is 125.0
The meaning of a program.
Give this one a try later!
semantics
What output will the following code produce?
n = 10
while n != 1:
print (n,end=' ')
if n % 2 == 0: # n is even
n = n // 2
else: # n is odd
n=n*3+1
a. 10 5 16 8 4 2
b. None an error will be displayed
c. 8 4 2
d. 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2
Give this one a try later!
a. 10 5 16 8 4 2
, If you assign the result a void function to a variable in Python, you get:
a. an empty string
b. the value -1
c. the value 0
d. the special value None
e. an exception
Give this one a try later!
d. the special value None
Handling an exception with a try statement is called throwing an exception.
True
False
Give this one a try later!
False
A property of a program that can run on more than one kind of computer.
Give this one a try later!
portability
What is the output of the following statements?
pi = int(3.14159)
Give this one a try later!
script
What will the output of this python program be?
def test_function( length, width, height):
print ("the area of the box is ",lengthwidthheight)
return lengthwidthheight
l = 12.5
w=5
h=2
test_function(l, w, h)
a. The area of the box is 125
b. The area of the box is 125.0
,c. The area of the box is 120
d. 125.0
Give this one a try later!
b. The area of the box is 125.0
The meaning of a program.
Give this one a try later!
semantics
What output will the following code produce?
n = 10
while n != 1:
print (n,end=' ')
if n % 2 == 0: # n is even
n = n // 2
else: # n is odd
n=n*3+1
a. 10 5 16 8 4 2
b. None an error will be displayed
c. 8 4 2
d. 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2
Give this one a try later!
a. 10 5 16 8 4 2
, If you assign the result a void function to a variable in Python, you get:
a. an empty string
b. the value -1
c. the value 0
d. the special value None
e. an exception
Give this one a try later!
d. the special value None
Handling an exception with a try statement is called throwing an exception.
True
False
Give this one a try later!
False
A property of a program that can run on more than one kind of computer.
Give this one a try later!
portability
What is the output of the following statements?
pi = int(3.14159)