💻
Programming Easy

Python for Beginners

Easy Python programming questions for those just starting to code!

10 Questions
25s Per Question
0+ Plays
← All Programming Quizzes 📚 Study Guide for this category →
💡 Create account to save scores & earn XP
📋 View All 10 Questions & Answers

1. What is the result of 10 % 3 in Python?

  • A. 3
  • C. 2
  • D. 1 ✓

💡 The % operator gives the remainder of division. 10 ÷ 3 = 3 remainder 1. So 10 % 3 = 1.

2. Which keyword starts a conditional statement in Python?

  • A. when
  • B. check
  • C. case
  • D. if ✓

💡 Python uses "if" to start a conditional statement: if condition: do something.

3. What is the Python keyword to exit a loop early?

  • A. exit
  • B. stop
  • C. end
  • D. break ✓

💡 The "break" keyword terminates a loop immediately when executed.

4. How do you start a for loop in Python to repeat 5 times?

  • A. for i in 5:
  • B. loop 5 times:
  • C. repeat(5):
  • D. for i in range(5): ✓

💡 range(5) generates numbers 0-4. "for i in range(5):" loops exactly 5 times.

5. Which of these is a valid Python string?

  • A. Hello
  • B. "Hello" ✓
  • C. (Hello)
  • D. [Hello]

💡 Strings in Python are enclosed in single or double quotes: "Hello" or 'Hello'.

6. What is the correct way to print "Hello" in Python?

  • A. echo "Hello"
  • B. console.log("Hello")
  • C. printf("Hello")
  • D. print("Hello") ✓

💡 Python uses the print() function to display output: print("Hello")

7. What does len("Python") return?

  • A. 5
  • B. 6 ✓
  • C. 7
  • D. 8

💡 len() returns the number of characters in a string. "Python" has 6 characters.

8. How do you create a variable named "age" with value 25 in Python?

  • A. var age = 25
  • B. age := 25
  • C. int age = 25
  • D. age = 25 ✓

💡 In Python, variables are created by simply assigning a value: age = 25. No type declaration needed.

9. What does type(42) return in Python?

  • A. <class "number">
  • B. <class "integer">
  • C. <class "int"> ✓
  • D. <class "float">

💡 type(42) returns <class "int"> because 42 is an integer in Python.

10. Which keyword is used to define a function in Python?

  • A. function
  • B. define
  • C. void
  • D. def ✓

💡 In Python, the "def" keyword is used to define a function: def my_function():

More Programming Quizzes

View all Programming quizzes →