Community resourceWorksheet

1CP2-CT-5.7 Merge sort file handling and authentication checkpoint

Part 7 of 7 · 1CP2-CT-5 · Merge sort, files and authentication

The checkpoint for the whole series, sampling merge sort, file modes and authentication in one sitting.

Students will:

  • identify the first pairwise merge stage of a list
  • explain why a merge needs remainder handling
  • explain why a converted field calculates rather than concatenates
  • distinguish write mode from append mode with a suitable use of each
  • write an authentication routine and choose tests that grant and deny

Inside: 4 explanation cells, 3 multiple-choice questions, 1 Python task, 1 fill-in-the-blanks cell and 4 written answers. 20 marks, about 45 minutes.

Series: 1CP2-CT-5 · Merge sort, files and authentication, part 7 of 7.

Shared by Coding PathwayVerified teacher

  • 13 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

1CP2-CT-5 checkpoint

This checkpoint assesses merge-sort understanding, CSV file handling, string processing and authentication programming. It introduces no new content and remains independent of the principles series.

Fill in the blanks4 marks
Merge sort repeatedly gap 1 then gap 2. File mode gap 3 preserves content and adds at the end. Authentication requires an ID gap 4 password match.
  • AND
  • appends
  • divides
  • merges
  • "a"
Multiple choice1 mark

Which is the first pairwise merge stage for [8, 2, 5, 1]?

  • A`[2, 8]` and `[1, 5]`
  • B`[1, 2]` and `[5, 8]`
  • C`[8, 2]` and `[5, 1]`
  • D`[1, 2, 5, 8]`
Written answer2 marks

Explain why a merge algorithm needs remainder handling after its comparison loop.

Refer to the loop condition and unused items.

Students type their answer here.

File processing stimulus

line = "Mara,17\n"
fields = line.strip("\n").split(",")
age = int(fields[1])
print("{} {}".format(fields[0], age + 1))
Multiple choice1 mark

What is printed?

  • A`Mara 171`
  • B`Mara 18`
  • C`17 1`
  • D`Mara,17 18`
Written answer1 mark

Explain why the program calculates 18 rather than producing the text 171.

Follow the type of `fields[1]` before and after conversion.

Students type their answer here.

Written answer3 marks

Explain the difference between file modes "w" and "a", including one suitable use of each.

State what happens to existing content.

Students type their answer here.

Authentication task

Complete a lookup over the supplied records. Both credentials must match the same row. Print the Boolean result.

Coding task4 marks
accounts = [["u1", "pine"], ["u2", "lake"]]
entered_id = "u2"
entered_password = "lake"
authenticated = False
# Search the records and print authenticated.
Written answer3 marks

Give one test that should grant access and two tests that should deny access, with expected outcomes.

Make the failure cases different.

Students type their answer here.

Multiple choice1 mark

Why is close() used after file operations?

  • ATo sort the file
  • BTo release the file resource and complete buffered writes
  • CTo convert all fields to strings
  • DTo authenticate the user

Checkpoint complete

You have demonstrated the 1CP2-CT-5 sequence: tracing merge sort, processing CSV text, choosing file modes and implementing an ID-and-password lookup.