wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

USM-Micron Python Basic Introductory Workshop

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

1.Which of the following is the coding rule of Python Programming?

a)

A. Case sensitive

b)

B. Indentation

c)

C. Punctuation

d)

D. All of above

2.

2.What is the output of the code below?

a)

A. 3

b)

B. 5

c)

C. a=3

d)

D. A=5

3.

3.What is the correct syntax to output “My name is John” in Python?

a)

A. print(“My name is John”)

b)

B. input(“My name is John”)

c)

C. print(My name is John)

d)

D. input(My name is John)

4.

4,How do you insert Comments in Python?

a)

A. //This is a comment

b)

B. /*This is a comment*/

c)

C. **This is a comment

d)

D. #This is a comment

5.

5. What is the data types of the variable, name = “John”?

a)

A. Integer

b)

B. String

c)

C. Float

d)

D. Bool

6.

6. What is the data types of the variable, x = input(“number1:”) ?

a)

A. Integer

b)

B. Float

c)

C. String

d)

D. Bool

7.

7. What is the output of the code below?

x = 5.7859

y = int(x)

print(y)

a)

A. 5.78

b)

B. 5.7859

c)

C. 5.0000

d)

D. 5

8.

8. How do we perform floor division in Python?

a)

A. 7+5

b)

B. 8//5

c)

C. 9%6

d)

D. 7/2

9.

9. What is the output of the code below?

num1 = 9

num2 = 2

ans = num1// num2

print(ans)

a)

A. 4.5

b)

B. 4.0

c)

C. 4

d)

D. 5

10.

10. What is the output of the following code?

a)

A. 3

b)

B. 0

c)

C. 6

d)

D. 9

11.

11. Is the following statement true?

1==5 and 7>3

a)

A. True

b)

B. False

12.

12. Is the following statement true?

8>4 or 7<2

a)

A. True

b)

B. False

13.

13. How do you write an if statement in Python?

a)

A. if x>y

b)

B. if (x>y)

c)

C. if x>y then

d)

D. if x>y:

14.

14. What is the error of the code below?

a)

A. Expect Indentation before ‘if’

b)

B. Expect Indentation before ‘print’

c)

C. Letter ‘p’ of ‘print’ should be Capital Letter

d)

D. All of above

15.

15. What should be filled in the blank to print “True” when a is greater than b?

a)

A. if  ,  <

b)

B. else  ,  <

c)

C. if  ,  >

d)

D. else ,  >