Exam PCAP All QuestionsBrowse all questions from this exam
Question 37

You are going to read just one character from a stream called s. Which statement would you use?

    Correct Answer: D

    To read just one character from a stream called 's', the correct statement to use is 'ch = s.read(1)'. The method 's.read(1)' instructs the stream to read exactly one character from it, which is the expected behavior. This method call is standard in many programming languages including Python, where 's' is a file or any input stream object.

Discussion
ArulkumarOption: D

reader = open("odd_even.txt") ch=reader.read(1) print(ch) Ans : D

666_mOption: D

D. ch= s.read (1)---> correct

macxszOption: D

answer" D. ch=s.read(1)