wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

python

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

(2*3)+12/3*(5-1) มีค่าเท่ากับเท่าไร

a)

7

b)

22

c)

0

d)

24

2.

ถ้า a=5 , b =2 แล้วเงื่อนไข a+2>b*5 เป็นจริงหรือเป็นเท็จ

a)

จริง

b)

เท็จ

3.

ตัวดำเนินการทางคณิตศาสตร์ข้อใดมีความสำคัญมากที่สุด

a)

*

b)

-

c)

/

d)

()

4.

a=24

b=5*a

c=b/3

print (c)


ผลลัพธ์ที่ได้เท่ากับข้อใด

a)

24

b)

40

c)

60

d)

120

5.

a=8

b=6

c=a*b-6

print (c)


ผลลัพธ์ที่ได้เท่ากับข้อใด

a)

42

b)

48

c)

14

d)

36

6.

หากต้องการคอมเมนต์บรรทัดเดียว จะต้องใช้เครื่องหมายใด

a)

*

b)

\

c)

//

d)

#

7.

หากต้องการกำหนดตัวแปร n ให้เป็นชนิด integer ที่มีค่าเท่ากับ 5 จะต้องประกาศตัวแปรอย่างไร

a)

n=5

b)

n='5'

c)

n="5"

d)

n = int(5)

8.

หากต้องการแปลงชนิดข้อมูลตัวแปร a ให้เป็นข้อมูลชนิดตัวเลข (Integer) จะต้องใช้คำสั่งใด

a)

StringToInt(a)

b)

int(a)

c)

integer(a)

d)

StringToInteger(a)

9.

ในภาษาไพทอน ฟังก์ชั่นใดใช้ในการรับค่า

a)

come()

b)

enter()

c)

input()

d)

income()

10.

ข้อใดคืือไฟล์นามสกุลของโปรแกรม Python

a)

*.Ly

b)

*.Py

c)

*.Doc

d)

*.xls

11.

คำว่า Syntax ที่ปรากฏขึ้นเมื่อเขียนโปรแกรม ข้อใดกล่าวภูกต้อง

a)

ใช้งานไม่ได้

b)

เกิดข้อผิดพลาด

c)

ค่าพารามิเตอร์ ที่ส่งให้คำสั่ง ปริ้น เอาไปใช้

d)

การเขียนโครงสร้างคำสั่ง / กฎ หรือรูปแบบผิดกฎของการเขียนโปรแกรมนั้น

12.

เมื่อเขียนโปรแกรมด้วยคำสั่ง print(“Hello World) คำตอบคือข้อใด

a)

Hello World

b)

"Hello World"

c)

SyntaxError: invalid syntax

d)

SyntaxError

13.

one = 1

two = 2

three = one + two

print(three)

a)

three

b)

3

c)

one

d)

1

14.

one = 1

two = 2

three = one + two

print('three')

a)

three

b)

3

c)

2

d)

two

15.

one = 1

two = 2

three = one + two

three = three + two

print(three)

a)

3

b)

4

c)

5

d)

6

16.

print(hello world)

a)

print

b)

hello world

c)

'hello world'

d)

Error

17.

7//4 มีค่าเท่ากับข้อใด

a)

3

b)

1.7

c)

1

d)

1.777

18.

หากต้องการแปลงชนิดข้อมูลตัวแปร a ที่เป็นชนิด String ให้เป็น Integer จะต้องใช้คำสั่งใด

a)

int(a)

b)

StringToInt(a)

c)

integer(a)

d)

StringToInteger(a)

19.

หากต้องการหาเศษที่ได้จากการหาร จะต้องใช้เครื่องหมายใด

a)

%

b)

/

c)

//

d)

\

20.

ข้อใดคือตัวดำเนินการที่หมายถึงยกกำลังในภาษา Python

a)

***

b)

^

c)

*

d)

**