menu

Python Input and Output


1. Which of the following is used to write data to a cell in an Excel sheet using openpyxl?

sheet.cell()

sheet.write()

sheet.append()

D. sheet.update()


2. Which function is used to read a JSON file in Python?

json.read()

json.load()

json.write()

D. json.dump()


3.

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

input()

print()

read()

scanf()


4. Which method is used to write a string to a file in Python?

write()

read()

readline()

D. readlines()


5. Which of the following is used to append binary data to a file in Python?

'rb'

'wb'

'ab'

'xb'


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

input()

display()

print()

D. show()


7. Which method is used to check if a file exists in Python?

exists()

isfile()

isdir()

D. both A and B


8. Which function is used to open a CSV file in Python?

csv.reader()

csv.writer()

csv.open()

D. csv.read()


9. Which of the following is used to read a binary file in Python?

'rb'

'wb'

'ab'

'xb'


10. Which function is used to read a PDF file in Python?

PyPDF2.read()

PyPDF2.load()

PyPDF2.open()

D. PyPDF2.extract()