Input and Output Operations in Python

Beschreibung

Coding Python Quiz am Input and Output Operations in Python, erstellt von PathaPadha Support am 27/10/2020.
PathaPadha Support
Quiz von PathaPadha Support, aktualisiert more than 1 year ago
PathaPadha Support
Erstellt von PathaPadha Support vor mehr als 3 Jahre
876
0

Zusammenfassung der Ressource

Frage 1

Frage
What is the output of the following print() function print(sep='--', 'Ben', 25, 'California')
Antworten
  • Syntax Error
  • Ben–25–California
  • Ben 25 California

Frage 2

Frage
What is the output of the following print() function ? print('%d %d %.2f' % (11, '22', 11.22))
Antworten
  • 11 22 11.22
  • TypeError
  • 11 ’22’ 11.22

Frage 3

Frage
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()
Antworten
  • bbb
  • Syntax Error
  • aaa
  • aa

Frage 4

Frage
What will be displayed as an output on the screen x = float('NaN') print('%f, %e, %F, %E' % (x, x, x, x))
Antworten
  • nan, nan, NAN, NAN
  • nan, NaN, nan, NaN
  • NaN, NaN, NaN, NaN,

Frage 5

Frage
What is the output of print('[%c]' % 65)
Antworten
  • 65
  • A
  • [A]
  • Syntax Error

Frage 6

Frage
In Python3, Whatever you enter as input, the input() function converts it into a string
Antworten
  • True
  • False

Frage 7

Frage
What is the output of print('%x, %X' % (15, 15))
Antworten
  • 15 15
  • F F
  • f f
  • f F

Frage 8

Frage
Which of the following is incorrect file handling mode in Python
Antworten
  • wb+
  • ab
  • xr
  • ab+

Frage 9

Frage
Which of the following is incorrect file handling mode in Python
Antworten
  • r
  • x
  • t+
  • b

Frage 10

Frage
What is the output of the following code print('PYnative ', end='//') print(' is for ', end='//') print(' Python Lovers', end='//')
Antworten
  • PYnative / is for / Python Lovers /
  • PYnative // is for // Python Lovers //
  • PYnative // is for // Python Lovers//
  • PYnative / is for / Python Lovers/

Frage 11

Frage
What is true for file mode x
Antworten
  • create a file if the specified file does not exist
  • Create a file, returns an error if the file exists
  • Create a file if it doesn’t exists else Truncate the existed file

Frage 12

Frage
In Python3, which functions are used to accept input from the user
Antworten
  • input()
  • raw_input()
  • rawinput()
  • string()
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Python Quiz
karljmurphy
Think Python
tsilvo2001
Basic Python - Print Formatting
Rebecca Noel
What is Python?
Daniel Ingram
Python
54671
Know your Python!
educ8ict
Basic Python - Strings
Rebecca Noel
Study on IoT systems design
Tomasz Cieplak
Python
Kirstie Wu
OpenSource Programming
Faheem Ahmed
Basic Python - Lists
Rebecca Noel