wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Init Me 3.1-1

Total questions: 13

Worksheet time: 8mins

Name
Class
Date
1.

What is the correct Python expression to compute the following mathematical expression?

2πn(ne)n\sqrt{2\pi n}(\frac{n}{e})^n  

a)

(2*math.pi*n)**0.5*((n/math.e)**n

b)

math.sqrt(2*math.pi*n)*n**(n/math.e)

c)

2*math.pi*n**0.5*math.pow(n/math.e,n)

d)

((2*math.pi*n)**0.5)*n/math.e**n

e)

math.sqrt(2*math,pi*n)*n**(n/math.e)

2.

Which choice has a different result from the expression

a)

not (50 >= 14)

b)

3+8 >= 15 or 5 <= 3

c)

3-4 <= 10 and 3 > 3

d)

14/7 < 1 or not (9 < 4)

3.

Give the following variable assignments

Which of the following expressions has the value of False?

a)

(a > 0) or not (b != "Yes")

b)

(a < c**2) and (c > a+d) and not False

c)

False or (c**2 == (d+1)**2)

d)

not (True and c < d and c > b)

e)

None of the above choices is correct.

4.

What is the output of the following code fragment?

a)

Step one.

b)

Step two.

c)

Step three.

d)

Step one.

End game.

e)

None of the above choice is correct.

5.

What will be displayed on the screen after running the following code fragment?

a)

x

b)

30

c)

True

d)

False

e)

The program contains an error on line 4.

6.

What is the output of the following program?

a)

a = 20,

b = 9.32,

c = 2

b)

a = 30,

b = 9.32,

c = 10

c)

a = 30,

b = 9.32,

c = 2

d)

a = 20.68,

b = 9.32,

c = 2

e)

a = 20.68,

b = 2,

c = 2

7.

What gets printed?

a)

1

b)

2

c)

3

d)

4

e)

ERROR, this code will not run.

8.

Which statement causes an error?

a)

True = 1

b)

Python = 1

c)

math = 1

d)

pi = 1

e)

All of the above choices.

9.

Which command causes an error?

a)
b)
c)
d)
e)
10.

Which line of code fragment causes an error?

a)

lines 1 and 2

b)

line 3

c)

line 4

d)

line 5

e)

line 6

11.

Which Boolean expression is NOT equivalent to the statement

"i is an even number"

a)

i%2 < 1

b)

i%2 == 0

c)

not (i%2 > 0)

d)

not (i%2 != 1)

12.

Which of the following choices does not contain Python reserved words (keywords)?

a)

elif/if/else

b)

import/from

c)

def/return

d)

true/false

e)

not/and/or

13.

คนที่สอนวันนี้ชื่อว่าอะไร (คะแนน x2)

a)

พี่โบ๊ท

b)

พี่บอส

c)

พี่จิตรทัศน์

d)

พี่บาส