Console Input/Output Questions and Answers

Take Exam

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
Show Answer Report

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
Show Answer Report

23. How to read password input without displaying it?

  • Using input(hidden=True)
  • Using getpass.getpass()
  • Using password_input()
  • Using secure_input()
Show Answer Report

24. What does the file parameter in print() do?

  • Specifies filename to read
  • Redirects output to file
  • Formats file content
  • Encodes the output
Show Answer Report

25. How to display a backslash character in string?

  • \
  • \\
  • /
  • //
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test