how a program determines it has reached the end of the file when reading line by line.
Loading subject…
Practice IB Computer Science (First Exam 2027) Topic B2 Programming with authentic exam-style questions for both SL and HL students. This question bank focuses on the exact syllabus content for B2 Programming and mirrors Paper 1, 2 style where relevant.
Get instant solutions, detailed explanations, and build confidence with questions aligned to IB examiner expectations.
how a program determines it has reached the end of the file when reading line by line.
A fossil collection is ordered by repeatedly comparing each pair of neighbouring specimens and exchanging them when they are in the wrong order. the name of this sorting algorithm.
A national park trail counter adds a new line to a log file each time a walker passes, keeping every earlier line. the file access mode the program must use.
A wind tunnel test rig runs the code shown, which is intended to count down from 8 to 1.
count = 8
while count > 0:
print(count)
why this code does not terminate.
A conveyor belt buffer holds part numbers in a 1D list, where the front of the buffer is at index 0. two functions. The function add_part is passed the list and a part number and adds it to the back. The function take_part is passed the list, removes the part at the front and returns it, or returns None if the buffer is empty.