wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ภาษาไพธอน

Total questions: 10

Worksheet time: 3mins

Name
Class
Date
1.

ในภาษาไพทอน ฟังก์ชันใดใช้ในการแสดงข้อความออกทางจอภาพ

a)

echo()

b)

Output()

c)

print()

d)

printf()

2.

ข้อใดต่อไปนี้ไม่เป็นความจริง

a)

ไวยากรณ์ของ Python มีลักษณะคล้ายกับ PHP

b)

Python สามารถใช้สำหรับการพัฒนาเว็บ

c)

Python สามารถทำงานได้หลายแพลตฟอร์ม

d)

Python สามารถใช้เพื่อสร้างหน้าเว็บแบบไดนามิก

3.

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

a)

var n = 5;

b)

int n = 5:

c)

n = 5

d)

variable n = 5

4.

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

a)

StringToInt(a)

b)

int(a)

c)

integer(a)

d)

StringToInteger(a)

5.

คำสั่งในการวนลูป For ของภาษาไพทอนในข้อใดถูกต้อง

a)

for(a = 0; a < 3 ; a++)

b)

for a in range(3)

c)

for a loop 3 :

d)

for a in range(1, 3) :

6.

ข้อใดเป็นคำสั่งที่ถูกต้องในการวนลูป While ในภาษา Python

a)

while loop a < 10

b)

while a < 10 :

c)

while(a < 10)

d)

while loop a < 10 :

7.

หากพิมพ์คำสั่ง “print(‘%.2f’ % 256.345)” จะได้ผลลัพธ์ตามข้อใด

a)

256.34

b)

256.35

c)

256

d)

45

8.

ไฟล์ Source Code ของไพทอนจะมีนามสกุลไฟล์แบบใด

a)

.py

b)

.pyc

c)

.pyx

d)

.ppy

9.

จากคำสั่งต่อไปนี้บริเวณที่ขีดเส้นใต้ควรเติมข้อความใดเข้าไปให้สมบูรณ์ถูกต้อง

name=……………………………………………………

print("Hello!!! %s " %(name))

a)

int(input("Enter name : "))

b)

float(input("Enter name : "))

c)

char(input("Enter name : "))

d)

input("Enter name : ")

10.

ถ้าต้องการรับข้อมูลเก็บไว้ในตัวแปร number ที่ใช้เก็บข้อมูลตัวเลขจำนวนเต็ม ควรใช้คำสั่งในข้อใด

a)

number = input("Number : ")

b)

number = int(input("Number : ")

c)

number = float(input("Number : ")

d)

number = str(input("Number : ")