wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

python iteration

Total questions: 20

Worksheet time: 40mins

Name
Class
Date
1.
a)

1

2

3

b)

1

2

3

4

c)

2

3

4

d)

ไม่มีข้อถูก

2.

ทำไมการเขียนโปรแกรมแบบวนซ้ำจึงมีความสำคัญ?

a)

ใช้ทำงานในโปรแกรมแบบวนซ้ำ

b)

ลำดับของคำสั่งจะแสดงออกมา

c)

ใช้ตัดสินการให้คะแนน

d)

ใช้ทดสอบโปรแกรมว่าทำงานได้จริง

3.

ทำไมการเขียนโปรแกรมแบบวนซ้ำจึงมีความสำคัญ

a)

ตัดสินใจดำเนินการตามคำแนะนำ

b)

เพื่อให้โปรแกรมทำงานง่าย โดยใช้การทำซ้ำ

c)

ยอมให้โปรแกรมทำงานหลายอย่างร่วมกัน

d)

เพื่อให้แน่ใจว่าโปรแกรมทำงานได้ถูกต้อง

4.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
5.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
6.
a)
5
4
3
2
1
b)
5  4  3  2  1
c)
4
3
2
1
0
d)
4  3  2  1  0
7.
a)
10  8  6  4  2
b)
10
8
6
4
2
c)
2  4  6  8  10
d)
10  9  8  7  6  5  4  3  2  1
8.
a)
12  9  6  3  0
b)
0  3  6  9  12
c)
9  6  3  0
d)
0  3  6  9
9.
a)
12  17   22
b)
5
c)
12
d)
5  10
10.
a)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
b)
Hello world!
c)
Hello world!
break              
d)
Error
11.
a)
Hello world!
b)
Error
c)
Hello world!
False
d)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
12.

จากโปรแกรมต่อไปนี้จะแสดงผลลัพธ์อย่างไร

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,1,2,3,4,5,6,7,8,9,10,11,12

c)

1,2,3,4,5,6,7,8,9,10,11,12,13

d)

0,1,2,3,4,5,6,7,8,9,10,11,12,13

13.

จากโปรแกรมต่อไปนี้จะแสดงผลลัพธ์อย่างไร

a)

1,2,3,4

b)

1,2,3,4,5

c)

counter,counter,counter,counter,counter

d)

0,1,2,3,4,5

14.

จากโปรแกรมต่อไปนี้จะแสดงผลลัพธ์อย่างไร

a)
b)
c)
d)

1,2,3,4

15.

หากต้องการสิ้นสุดการทำงานของ loop ต้องทำอย่างไร

a)

ไปที่จุดสิ้นสุดของ loop

b)

ใส่เครื่องหมาย #

c)

สร้างเว้นวรรคเพื่อปิด loop

16.

ประเภทของ loop แบบใหนที่เราทราบจุดสิ้นสุด

a)
A WHILE Loop
b)
An IF function
c)
A FOR Loop
d)
A Variable
17.

WHILE loops คืออะไร

a)

loops ที่ทำงานโดยไม่ทราบกำหนด

b)

loops ที่ทำงานตามเวลาที่ทำงานตามที่กำหนด

c)

เหมือนกับประโยคทำงาน

d)

ไม่ใช่ส่วนหนึ่งของการเขียนโปรแกรม

18.

โปรแกรมจะแสดงผลอย่างไร

word= "computer"  

for num in range(1,6):    

  print(word)

a)
5
b)
6
c)
1
d)
0
19.

โปรแกรมใหนจะแสดงผล 10 บรรทัด

a)

for i in range(10):

print("hi")

b)

for i = 1 to 10:

print("hi")

c)

for i in 1 - 10:

print("hi")

d)

for i from 0 to 9:

print("hi")

20.

โปรแกรมใดจะแสดงผลแบบนี้

3

5

7

9

a)

for i in range(3, 10, 2):

print(i)

b)

for i in range(3, 9, 2):

print(i)

c)

for i in range(9):

print(i)

d)

for i in range(3,9):

print(i)