Python Basics

Section 1 / 1  ยท  4 Questions

English
0 / 4 Answered
Q1 Easy

What is the output of: print(type(3.14))?

โœ… Correct Answer: B โ€” <class 'float'>
๐Ÿ’ก Explanation: 3.14 is a floating-point number in Python, so type() returns <class float>.
Q2 Easy

Which keyword is used to define a function in Python?

โœ… Correct Answer: C โ€” def
๐Ÿ’ก Explanation: In Python, the def keyword is used to define a function. Example: def my_function():
Q3 Easy

What data structure does Python use for key-value pairs?

โœ… Correct Answer: D โ€” Dictionary
๐Ÿ’ก Explanation: Dictionary (dict) stores key-value pairs. Example: {"name": "Alice", "age": 25}
Q4 Easy

What is the output of: print(2 ** 3)?

โœ… Correct Answer: B โ€” 8
๐Ÿ’ก Explanation: ** is the exponentiation operator in Python. 2 ** 3 = 2ยณ = 8.
โ† Previous Next โ†’