wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quizz Python Revision

Total questions: 21

Worksheet time: 11mins

Name
Class
Date
1.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

program

The order in which instructions are carried out

c)

A decision point in a program

d)

Testing a program to make sure it works

2.

Which two statements are used to implement iteration/Repetition)?

a)

IF and WHILE

b)

ELSE and WHILE

c)

FOR and WHILE

d)

IF and ELS

3.

Which type of loop iterates until instructed otherwise?

a)

FOR loop

b)

A count-controlled loop

c)

Repeat-once loop

d)

WHILE loop

4.

The condition for a while loop to continue could include which of the following?

a)

While something equals something

b)

While something is True

c)

While something is greater than something

d)

All of these

5.

Which of the following symbols is used in Python to mean "Not equal to"?

a)

==

b)

!=

c)

<>

d)

><

6.
a)


5
4
3
2
1

b)


4
3
2
1
0

c)

5  4  3  2  1

d)


4  3  2  1  0

7.
a)

Hello world!

b)

Hello world

c)

Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
......(repeated continuously)

d)


Error

8.

Which of these codes is correct for creating a list of numbers?

a)

num = ('10','29','37','109')

b)

num = ['10','29','37','109']

c)

num == ('10','29','37','109')

d)

num = ['10 29 37 109']

9.

What is the index number for 'Spain'?

['England','Brazil','Spain','France']

a)

0

b)

1

c)

2

d)

3

10.

What does the '#' allow you to do?

a)

Repeat code

b)

Print code

c)

Comment on code

d)

End code

11.

Trong Python, khi muốn thay thế một từ hoặc cụm từ bằng từ hoặc cụm từ khác thì ta sử dụng hàm nào sau đây?

a)

upper()

b)

find()

c)

len()

d)

replace()

12.

Trong Python, cho xâu a=”Trường PT Hermann Gmeiner Đà Nẵng” và xâu b=’Hermann’ để tìm ra vị trí xuất hiện của xâu b có trong xâu a ta sử dụng câu lệnh nào sau đây?

a)

print(a)

b)

k=len(a)

c)

k=len(b)

d)

k=a.find(b)

13.

Cách nào sau đây là cách hợp lệ để bắt đầu định nghĩa hàm trong Python?

a)

def some_function()

b)

function some_function()

c)

function some_function():

d)

def some_function():

14.

Chương trình sau in ra kết quả gì?

a)

8

b)

5

c)

21

d)

18

15.

Chương trình sau in ra kết quả gì?

a)

13

b)

21

c)

5

d)

Không in gì

16.

Lệnh gọi hàm nào sau đây là đúng?

a)

x=square( )

b)

x=Square(4):

c)

x=square(5)

d)

print(square())

17.

Câu lệnh return dùng để?

a)

Kết thúc vòng lặp

b)

Trả lại giá trị

c)

Kết thúc hàm và trả lại giá trị

d)

Kết thúc vòng lặp và trả lại giá trị

18.

Chọn những phát biểu sai về chương trình con trong các phát biểu dưới đây

a)

Chương trình được tạo thành từ các chương trình con dễ đọc, dễ hiểu, dễ hiệu chỉnh và phát triển.

b)

Tham số của chương trình con bắt buộc phải có

c)

Các lệnh của chương trình con có lệnh thụt vào so với từ khóa def

d)

Chương trình con cần được xây dựng trước khi sử dụng

19.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

20.

What output will this code produce?

a)

blue

b)

green

c)

red

d)

error

21.

What is the result

a)

You can buy some chocolate

b)

You are rich!

c)

Get a job!

d)

You almost have enough
Get a job!

Similar Resources on Wayground