A text file song .txt contains the following contents in it: Life goes on as…

PYQ Bihar STET 2025Modified — slightly modified from the official paper; see the solution

A text file song .txt contains the following contents in it:

Life goes on as it never ends

What will be the output of the following code snippet?

f1 = open ("song.txt", "r")
s1 = f1. read (5)
s2 = f1. readline (4)
s3 = f1. read (3)
print (s1, s3, sep = "#")
  1. A.

    goes # on

  2. B.

    Life #goes # on

  3. C.

    Life # on

  4. D.

    Error

Attempted by 942 students.

Sign up free to check your answer

Sign up free

Explore the full course: Bihar Stet Computer Science Complete Course

Loading lesson…