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

Can inner classes be reused?

a. True b. False c. True in some cases Answer: c. True in some cases Explanation Regular inner class holds a reference to an object

Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?