1) What does print do in most programming languages like Python? a) Sends data to a file b) Reads a value from the user c) Displays text d) Creates a new variable 2) Which of the following is a valid variable name in Python? a) 1stValue b) name-1 c) name_1 d) full name 3) What is the value of x after this code runs? x = 5 , x = x + 3 a) 15 b) 3 c) 8 d) 5 4) Which operator is used to compare two values, rather than assign one? a) = b) == c) < d) > 5) What will this code output? for i in range(3): print("Hello") a) Prints “Hello” forever b) Prints “Hello” three times c) Prints “Hello” twice d) Prints “Hello” once 6) What is the main purpose of an if statement in a program? a) As Reusable functions b) To repeat a task a fixed number of times c) To execute code only when certain conditions are met d) To display output to the user 7) What will this code print? x = 10, if x > 5: print("A"); else: print("B"); a) A b) B c) Nothing d) Crashout 8) What is the output of this code? x = 2, y = 3, print(x ** y) a) 5 b) 6 c) 8 d) 9 9) What is the output of this code? x = 10, y = 5, print( x // y + x % y ) a) 2 b) 4 c) 10 d) 11 10) Which statement correctly defines a function that returns the square of a number? a) def square(x): print ( x * x ) b) def square(x): return x * x c) def square(): return x * x d) square = lambda: x * x
0%
Programming 101
แชร์
แชร์
แชร์
โดย
Sy41
แก้ไขเนื้อหา
สั่งพิมพ์
ฝัง
เพิ่มเติม
กำหนด
ลีดเดอร์บอร์ด
แสดงเพิ่มขึ้น
แสดงน้อยลง
ลีดเดอร์บอร์ดนี้ตอนนี้เป็นส่วนตัว คลิก
แชร์
เพื่อทำให้เป็นสาธารณะ
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานโดยเจ้าของทรัพยากร
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานเนื่องจากตัวเลือกของคุณแตกต่างสำหรับเจ้าของทรัพยากร
แปลงกลับตัวเลือก
แบบทดสอบ
เป็นแม่แบบแบบเปิดที่ไม่ได้สร้างคะแนนสำหรับลีดเดอร์บอร์ด
ต้องลงชื่อเข้าใช้
สไตล์ภาพ
แบบ อักษร
ต้องสมัครสมาชิก
ตัวเลือก
สลับแม่แบบ
แสดงทั้งหมด
รูปแบบเพิ่มเติมจะปรากฏเมื่อคุณเล่นกิจกรรม
เปิดผลลัพธ์
คัดลอกลิงค์
คิวอาร์โค้ด
ลบ
คืนค่าการบันทึกอัตโนมัติ:
ใช่ไหม