Console Input/Output Questions and Answers
Python Programming - Console Input/Output Questions with Answers teach how to take user input and display output efficiently. These Python Input Output Questions are often asked in SSC, RRB, TCS, and Accenture exams for programming fundamentals
Console Input/Output
Showing 10 of
25 questions
21. How to format a number to 2 decimal places in output?
- Using round() function
- Using f-string with .2f
- Using format() with {:.2f}
- All of the above
22. What is the difference between print and return?
- Both are same
- print outputs to console, return gives function result
- return outputs to console, print gives function result
- print is for numbers, return is for strings
23. How to read password input without displaying it?
- Using input(hidden=True)
- Using getpass.getpass()
- Using password_input()
- Using secure_input()
24. What does the file parameter in print() do?
- Specifies filename to read
- Redirects output to file
- Formats file content
- Encodes the output