wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

บทที่ 7 : Function

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.


หากเปรียบเทียบฟังก์ชันกับ 'เครื่องจักร' สิ่งที่ใส่เข้าไปในเครื่องเพื่อให้เครื่องทำงานเรียกว่าอะไร?

If we compare a function to a 'machine,' what is the input that makes the machine work called?

a)

Separated by symbols:

b)

Parameter (Input)

c)

ใช้ [ ....]

2.

ประโยชน์ที่สำคัญที่สุดของการใช้ฟังก์ชันคืออะไร?

What is the most important advantage of using functions?

a)

ลดการเขียนโค้ดซ้ำและนำกลับมาใช้ใหม่ได้

Reduce code repetition and increase reuse.

b)

เริ่มฟังก์ชันใหม่

Restart function

c)

ตรวจสอบฟังก์ชัน

Check function

3.

หากต้องการสร้างฟังก์ชันชื่อ 'square' เพื่อวาดรูปสี่เหลี่ยม ข้อใดคือการตั้งชื่อที่ถูกต้องตามไวยากรณ์ Python

If you want to create a function named 'square' to draw a square, which of the following is a grammatically correct naming convention in Python?

a)

def square

b)

def square[]:

c)

def square():

4.

จากโค้ดต่อไปนี้ ส่วนใดคือ 'การเรียกใช้ฟังก์ชัน' (Function Call)?

def say_hi():

print('Hello')

say_hi()

a)

def say_hi():

b)

say_hi()

c)

def my_function():

print(“Hello World”)

5.

คำสำคัญที่ใช้กำหนดฟังก์ชัน คือ?

What are the keywords used to define a function?

(a)  

6.

ฟังก์ชัน คืออะไร?

What is function?

a)

โครงสร้างการวนซ้ำ

Loop structure

b)

โค้ดที่จะทำงาน เมื่อถูกเรียกใช้

Code that will execute when called.

c)

แอพพลิเคชัน

Applications

7.

หากฟังก์ชันเปรียบเสมือน 'สูตรอาหารในสมุด' การเรียกใช้ฟังก์ชัน (Call) เปรียบได้กับอะไร?

If a function is like a 'recipe in a book,' what does a function call represent?

a)

การสูตรเพิ่ม

Add a recipe

b)

การลงมือทำอาหารตามสูตรนั้น

Start cooking according to the recipe.

c)

คิดค้นสูตรอาหารใหม่

Invent new food recipes

8.

หากต้องการสร้างฟังก์ชันชื่อ say_hello เพื่อให้แสดงคำว่า "สวัสดีจ้า" นักเรียนต้องเติมคำในช่องว่าง [1]

To create a function called say_hello that displays the words "Hello", students must fill in the blanks [1].

__1__say_hello():

print("python")

# การเรียกใช้งาน

____2____

(a)  

9.

หากต้องการสร้างฟังก์ชันชื่อ say_hello เพื่อให้แสดงคำว่า "สวัสดีจ้า" นักเรียนต้องเติมคำในช่องว่าง [2]

To create a function called say_hello that displays the words "Hello", students must fill in the blanks [2].

__1__say_hello():

print("python")

# การเรียกใช้งาน

____2____

(a)  

10.
  • Define: เหมือนการเขียนสูตรอาหารลงสมุด

  • Call: เหมือนการเริ่มลงมือทำตามสูตร

  • Define: Like writing a recipe in a notebook.

    Call: Like starting to cook according to the recipe.

a)

true

b)

false