CBSE Class 12 Computer Science Question 61 of 136

Data File Handling — Question 26

Back to all questions
26
Question

Question 26

For storing numeric data in a text file, it needs to be converted into ............... using ............... function.

  1. integer, int()
  2. integer, float()
  3. string, int()
  4. string, str()
Answer

string, str()

Reason — For storing numeric data in a text file, it needs to be converted into a string using the 'str()' function. This is because text files store data in the form of characters, and converting numeric data to a string allows it to be written to the file as a sequence of characters.