Python3 Data Types Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

การแปลงข้อมูลชนิดใดให้อยู่ในรูปของ Boolean ใน Python?

  • float
  • int (correct)
  • complex
  • string

ข้อใดเป็นการกำหนดค่าตัวแปรแบบ multiple assignment ใน Python?

  • name = 'John'
  • value = float('5.2')
  • number = 10
  • x, y = 1, 2 (correct)

ฟังก์ชันใดใช้สำหรับแปลงชนิดของข้อมูลใน Python?

  • cast()
  • conv()
  • type() (correct)
  • transform()

ข้อใดเป็นตัวอย่างของ explicit conversion ใน Python?

<p>int(3.8) (C)</p> Signup and view all the answers

อะไรจะเกิดขึ้นเมื่อค่าของตัวแปร int, float หรือ complex ถูกกำหนดเป็นศูนย์ใน Python?

<p>คืนค่า False (D)</p> Signup and view all the answers

การใช้ฟังก์ชัน input() เพื่อรับค่าจากผู้ใช้และเก็บไว้ในตัวแปรที่กำหนด เป็นตัวอย่างของ?

<p>'input processing' (B)</p> Signup and view all the answers

การกำหนดค่าตัวแปรใดต่อไปนี้จะทำให้ได้ผลลัพธ์เป็น False ใน Python?

<p>a = True &gt;&gt;&gt; b = False &gt;&gt;&gt; a and b (C)</p> Signup and view all the answers

ใน Python, ประเภทข้อมูลใดไม่สามารถมีขนาดไม่จำกัด?

<p>int (จำนวนเต็ม) (A)</p> Signup and view all the answers

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

<p>type() (A)</p> Signup and view all the answers

การกำหนดค่าตัวแปรใดต่อไปนี้จะทำให้ได้ผลลัพธ์เป็น True ใน Python?

<p>a = False &gt;&gt;&gt; b = True &gt;&gt;&gt; a or b (A)</p> Signup and view all the answers

สำหรับหมายเลข 2.5e2 ใน Python, ค่ามันคืออะไร?

<p>$2.5 x 10^2 = 250$ (C)</p> Signup and view all the answers

ถ้าต้องการสร้างตัวแปรชื่อ 'num' และกำหนดค่าให้เป็นจำนวนเต็ม 42, คำสั่งที่ถูกต้องคือ?

<p>num = int(42) (D)</p> Signup and view all the answers

ถ้ามีการกำหนดค่าตัวแปร a และ b ดังนี้ a = 5, b = 7 และทำการพิมพ์ค่า type(a, b) ลงบนหน้าจอ ผลลัพธ์จะเป็นอย่างไร?

<p>(A)</p> Signup and view all the answers

ถ้ามีการกำหนดตัวแปร x = 'Hello' และทำการพิมพ์ค่า type(x) ลงบนหน้าจอ ผลลัพธ์จะเป็นอย่างไร?

<p>(C)</p> Signup and view all the answers

ถ้ามีการกำหนดค่าตัวแปร y = (1, 2, 3) และทำการพิมพ์ค่า type(y) ลงบนหน้าจอ ผลลัพธ์จะเป็นอย่างไร?

<p>(D)</p> Signup and view all the answers

ถ้ามีการกำหนดค่าตัวแปร z = {1: 'apple', 2: 'banana'} และทำการพิมพ์ค่า type(z) ลงบนหน้าจอ ผลลัพธ์จะเป็นอย่างไร?

<p>(C)</p> Signup and view all the answers

ถ้ามีการกำหนดค่าตัวแปร m = True และทำการพิมพ์ค่า type(m) ลงบนหน้าจอ ผลลัพธ์จะเป็นอย่างไร?

<p>(C)</p> Signup and view all the answers

ถ้ามีการกำหนดค่าตัวแปร n = 10.5 และทำการพิมพ์ค่า type(n) ลงบนหน้าจอ ผลลัพธ์จะเป็นอย่างไร?

<p>(B)</p> Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

Python Data Types and Conventions
36 questions
Python Data Types Quiz
37 questions

Python Data Types Quiz

SolicitousHeliotrope2966 avatar
SolicitousHeliotrope2966
Data Types in Python
8 questions

Data Types in Python

PoliteRealism3121 avatar
PoliteRealism3121
Python Data Types and Conversions
38 questions
Use Quizgecko on...
Browser
Browser