SolveItNCERT · CBSE Boards

CBSE 2026 · Central · Set 4 · Q29 · 3 marks

Write a Python function that counts and returns the number of digits appearing in the text file "Space.txt". For example, if the file contains : Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in $\displaystyle 1969$, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about $\displaystyle 400$ km, serves as a hub for research. With missions planned for $\displaystyle 2030$, humanity's cosmic journey continues! Then the function should return 11.

File Handling - Text FilesReading using read(), readline() and readlines()Applyshort_answer

CBSE Class 12 Computer Science past-paper question from the 2026board exam, with the answer as CBSE’s own marking scheme gives it. Where our answers come from.