Python Input and Output Quiz - 20 Interactive MCQs with Answers

🐍 Python Input and Output Interactive Quiz

Test your knowledge of Python input and output using input(), print(), formatting, escape characters, and user interaction.

What Are Input and Output in Python?

Python programs often need to communicate with users. The input() function is used to receive data from the user, while the print() function is used to display information on the screen.

This quiz covers:

  • Python input() function
  • Python print() function
  • Input data types and type conversion
  • Printing multiple values
  • String formatting
  • Escape characters
  • sep and end parameters
  • Practical input and output examples

Take this quiz to test your Python Input and Output knowledge and improve your understanding of user interaction in Python programs.

📌 Quick Summary

Python Input and Output Quiz: Test your knowledge with 20 interactive multiple-choice questions covering input(), print(), type conversion, formatting, escape sequences, and practical Python code examples.

  • 📝 20 Python Input & Output MCQs
  • ⏱ 160-second interactive quiz
  • 💡 Answer explanations included
  • 🐍 Suitable for Python beginners
  • 💻 Includes output-based questions

⏱ Time Left: 160 seconds

Q1. Which function is used to take input from the user in Python?




Q2. Which function is used to display output in Python?




Q3. What is the output?

 print("Hello Python") 



Q4. What type of value does input() return by default?




Q5. How can you convert user input into an integer?




Q6. What is the output?

 name = "Alice" print("Hello", name) 



Q7. Which parameter can be used to change the separator between multiple values in print()?




Q8. What is the output?

 print("Python", "Java", sep="-") 



Q9. Which parameter controls what print() writes at the end of its output?




Q10. What is the output?

 print("Hello", end=" ") print("World") 



Q11. Which escape sequence creates a new line?




Q12. Which escape sequence is commonly used to insert a tab?




Q13. What is the output?

 name = "Bob" age = 25 print(f"{name} is {age} years old.") 



Q14. Which symbol is used before a string to create an f-string?




Q15. What happens when this code runs?

 age = input("Enter your age: ") print(age + 5) 



Q16. Which statement correctly converts a user's input into a floating-point number?




Q17. What is the output?

 print(10, 20, 30, sep=",") 



Q18. Which statement correctly prints two strings on separate lines?




Q19. What is the output?

 x = 10 y = 20 print("Total:", x + y) 



Q20. Why is type conversion often needed with input()?






Why Are Python Input and Output Important?

Ans: Input and output are fundamental parts of interactive Python programs. The input() function allows programs to receive information from users, while print() displays results and messages.

  • Receive information from users
  • Display program results
  • Create interactive programs
  • Format text and numerical output
  • Convert user input into appropriate data types
  • Build beginner-friendly command-line applications

❓ Frequently Asked Questions About Python Input and Output

What is the input() function in Python?

The input() function is used to receive data entered by the user. The value returned by input() is a string by default.

What is the print() function in Python?

The print() function is used to display text, variables, calculations, and other values on the screen.

Why does input() return a string?

Python's input() function returns the user's entered data as a string. If a program needs a number, the input can be converted using functions such as int() or float().

What are sep and end in Python print()?

The sep parameter controls the separator placed between multiple values, while the end parameter controls what is written after the output.

How do you print variables in Python?

Variables can be passed directly to print() or included in formatted strings. For example, print("Age:", age) displays the value stored in the age variable.

What is an f-string in Python?

An f-string is a convenient way to format strings by placing an f before the string and putting variables or expressions inside curly braces, such as f"Hello {name}".


📚 Continue Learning and Testing Your Python Knowledge Step by Step:

Featured Post

Python Input and Output Quiz - 20 Interactive MCQs with Answers

🐍 Python Input and Output Interactive Quiz Test your knowledge of Python input and output using input() , print() , formatting, escape ch...

Popular Posts