NEW
Font size
S
M
L
XL
WorksheetsPython quiz
Total questions: 29
Worksheet time: 28mins
Name
Class
Date
1.
What is
def greeting(name):
print 'hello ' + name
print greeting('Daddy')
answer
def greeting(name):
print 'hello ' + name
print greeting('Daddy')
answer
a)
name
b)
Daddy
c)
hello Daddy
d)
hello name
2.
What is
def adder(x, y):
print x + y
print greeting(1, 2)
answer
def adder(x, y):
print x + y
print greeting(1, 2)
answer
a)
y + x
b)
x + y
c)
3
d)
4
3.
What is
x = 67
if x != 67:
print "x is not equal to 67"
else:
print 'x is equal to 67'
answer
x = 67
if x != 67:
print "x is not equal to 67"
else:
print 'x is equal to 67'
answer
a)
x is not equal to 67
b)
x is equal to 67
c)
print "x is equal to 67"
d)
print 'x is not equal to 67'
4.
What is
x = 345
if x != 345:
print 'x is not equal to 345'
else:
print 'x is equal to 345'
answer
x = 345
if x != 345:
print 'x is not equal to 345'
else:
print 'x is equal to 345'
answer
a)
x is not equal to 345
b)
None of the above
c)
x is equal to 345
5.
What is
lamda = lambda x: x <> 4**3
lamda(64)
answer
lamda = lambda x: x <> 4**3
lamda(64)
answer
a)
True
b)
False
c)
64
d)
46
6.
When was python relesed?
a)
1991
b)
2000
c)
2013
d)
19911
7.
When was python relesed?
a)
1991
b)
2000
c)
2013
d)
19911
8.
Are some of the function in python are the same in excel?
a)
True
b)
False
c)
Yes
d)
No
9.
Are some of the function in python are the same in excel?
a)
True
b)
False
c)
Yes
d)
No
10.
What is
l = lambda x, y: x % y == 0
l(8, 2)
in a function
l = lambda x, y: x % y == 0
l(8, 2)
in a function
a)
def l(x, y):
print x % y == 0
l(8, 2)
print x % y == 0
l(8, 2)
b)
def l(x, y):
if x % y == 0:
print x
r(8, 2)
if x % y == 0:
print x
r(8, 2)
11.
What is
l = lambda x, y: x % y == 0
l(8, 2)
in a function
l = lambda x, y: x % y == 0
l(8, 2)
in a function
a)
def l(x, y):
print x % y == 0
l(8, 2)
print x % y == 0
l(8, 2)
b)
def l(x, y):
if x % y == 0:
print x
r(8, 2)
if x % y == 0:
print x
r(8, 2)
12.
What is
def hello():
print 'hello'
in a lambda expression
def hello():
print 'hello'
in a lambda expression
a)
l = lambda x: 'hello'
b)
l = lambda x: hello
13.
What is
def hello():
print 'hello'
in a lambda expression
def hello():
print 'hello'
in a lambda expression
a)
l = lambda x: 'hello'
b)
l = lambda x: hello
14.
What is
for n in range(0, 11):
print n
answer
for n in range(0, 11):
print n
answer
a)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
b)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
c)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
d)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
15.
When was python 3 released?
a)
December 3, 2008
b)
November 4, 2010
c)
January, 5, 2000
d)
March, 6, 2009
16.
when was python 2 released?
a)
8 April 2002
b)
20 July 2001
c)
21 December 2001
d)
16 January 2002
17.
when was python 2 released?
a)
8 April 2002
b)
20 July 2001
c)
21 December 2001
d)
16 January 2002
18.
What is
x = "This is a string"
def hello():
x = "hello"
print x
print hello()
print x
x in hello and x out side hello
x = "This is a string"
def hello():
x = "hello"
print x
print hello()
print x
x in hello and x out side hello
a)
This is a string and hello
b)
"hello" and "This is a string"
c)
"This is a string" and "Hello"
d)
hello and this This is a string
19.
What is
for n in range(0, 10):
if n % 2 == 0:
print 'This is not a prime number'
break
else:
print 'this is a prime number'
answer
for n in range(0, 10):
if n % 2 == 0:
print 'This is not a prime number'
break
else:
print 'this is a prime number'
answer
a)
This is not a prime number
b)
This is a prime number
20.
What is
for n in range(2, 6):
if n % 2 == 0:
print 'Not prime'
else:
print 'Prime number'
answer
for n in range(2, 6):
if n % 2 == 0:
print 'Not prime'
else:
print 'Prime number'
answer
a)
Not prime
Prime number
Not prime
Prime number
Prime number
Not prime
Prime number
b)
Not prime
c)
Prime number
d)
2
3
4
5
3
4
5
21.
What is
x = 'asa '
print x*3
answer
x = 'asa '
print x*3
answer
a)
asa asa asa 3
b)
3 asa asa asa
c)
None of the above
d)
asa asa asa
22.
What is
rev = lambda x: x[::-1]
rev('hplaR')
answer
rev = lambda x: x[::-1]
rev('hplaR')
answer
a)
Hplar
b)
ralph
c)
Ralph
d)
hplaR
23.
What is
print "Int number %i" % (12.56789)
answer
print "Int number %i" % (12.56789)
answer
a)
Int number 12.56789
b)
Int number -12.56789
c)
Int number 12
d)
Int number -12
24.
What does /n do in python?
a)
pass
b)
None of the above
c)
Moves to the next line
d)
pass
25.
What does /t do in python?
a)
puts a tab
b)
goes to the next line
c)
None of the above
d)
Nothing
26.
What does Pass Do?
a)
None of the above
b)
puts a tab
c)
goes to the next line
27.
What does Continue Do?
a)
Continues
b)
puts a tab
c)
goes to the next line
28.
What does Break Do?
a)
goes to the next line
b)
Breakes the function , while loop
c)
None of the above
29.
What does None Do?
a)
Breakes the function, while loop
b)
Continues
c)
Nothing
d)
Pass
Reset
