Important Python Mcqs

To read two characters from a file object infile, we use _

a) infile.read(2)

b) infile.read()

c) infile.readline()

d) infile.readlines()

Answer:

a) infile.read(2)

Explanation:

The read(2) method reads exactly 2 characters from a local file into a python object.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?