PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Python Input and Output Quiz

Python Input and Output Quiz

Updated on: August 24, 2022 | 6 Comments

This Python Input and Output Quiz provides Multiple Choice Questions(MCQ) to get familiar with built-in functions print() and input() to perform input and output tasks in Python. Also, we will practice file handling in Python.

Also, Solve Python Input and Output Exercise

  • The quiz contains 12 Questions. Solve 8 correct to pass the test.
  • You will have to read all the given answers and click over the correct answer.

Read the below tutorials to solve this quiz

  • Python Input and Output
  • Python File Handling

1. Which of the following is incorrect file handling mode in Python

 
 
 
 

2. What will be displayed as an output on the screen

x = float('NaN')
print('%f, %e, %F, %E' % (x, x, x, x))
 
 
 

3. What is the output of  print('%x, %X' % (15, 15))

 
 
 
 

4. What is true for file mode x

Hint: Create File in Python

 
 
 

5. Use the following file to predict the output of the code

test.txt Content:

aaa
bbb
ccc
ddd
eee
fff
ggg

Code:

f = open("test.txt", "r")
print(f.readline(3))
f.close()

Hint: Read file in Python.

 
 
 
 

6. Which of the following is incorrect file handling mode in Python.

Hint: File handling in Python.

 
 
 
 

7. What is the output of print('[%c]' % 65)

 
 
 
 

8. In Python 3, which functions are used to accept input from the user

 
 
 
 

9. What is the output of the following print() function

print('%d %d %.2f' % (11, '22', 11.22))

 
 
 

10. In Python3, Whatever you enter as input, the input() function converts it into a string

 
 

11. What is the output of the following print() function

print(sep='--', 'Ben', 25, 'California')

 
 
 
 

12. What is the output of the following code

print('PYnative ', end='//')
print(' is for ', end='//')
print(' Python Lovers', end='//')
 
 
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python Basics Python Quizzes

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Posted In

Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • Python Quizzes Home
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our Terms Of Use, Cookie Policy, and Privacy Policy.

Copyright © 2018–2023 pynative.com