Exam preparation · A level · OCR H446 2.2.1, AQA 7517 4.4.1.2, Eduqas A500QS 1.8 · about 45 min
What each command word asks for, how extended answers are marked in levels, and a marker that levels answers with regular expressions.
[1 mark]What does the command word evaluate require that describe does not?
[1 mark]How is an extended answer marked by levels of response?
[1 mark]Which sentence explains, rather than describes?
[1 mark]Which of these usually move an extended answer up a level?
Tick every answer that is true.
[1 mark]This regular expression finds developed points. What does the code print?
import re sentences = ["It is fast, so staff save time.", "It is also cheap.", "Sometimes it helps because it is quiet."] print(sum(1 for s in sentences if re.search(r"\b(because|so)\b", s)))
Four students answered the face recognition question. Write a program that levels each answer using these rules. It is a crude model of a real examiner, but the rules are exactly defined.
- Split an answer into sentences with re.split(r"(?<=[.!?])\s+", answer.strip()).
- A sentence is the conclusion if it begins with On balance, Overall or In conclusion, ignoring capitals. A conclusion sentence is not counted as a point.
- Any other sentence is a point if it contains a word from FOR_WORDS or AGAINST_WORDS, ignoring capitals (a word counts if it appears anywhere in the sentence).
- A point is developed if it also contains because or so as a whole word, ignoring capitals. A developed point is on the for side if it contains a word from FOR_WORDS, and on the against side if it contains one from AGAINST_WORDS (it can be both).
Write analyse(answer), returning a tuple (points, developed, both_sides, conclusion): two whole numbers, then True if the developed points include both sides, then True if there is a conclusion.
Write level_and_mark(points, developed, both_sides, conclusion), returning a tuple (level, mark):
- level 3 if developed is at least 3, both_sides is true and there is a conclusion; the mark is 7 + min(2, developed - 3);
- otherwise level 2 if developed is at least 2; the mark is 4 + min(2, developed - 2);
- otherwise level 1 if points is at least 1; the mark is min(3, points);
- otherwise level 0 and 0 marks.
For each answer in order, print <name>: level <level>, <mark> marks (<points> points, <developed> developed). The robot stays still.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
import re
FOR_WORDS = ["benefit", "advantage", "helps"]
AGAINST_WORDS = ["risk", "drawback", "harm"]
answers = [
("Ada", "A benefit is that parcels reach the right teacher, because the robot recognises them. "
"A risk is that faces are biometric data, so the school must have a lawful basis and keep the data secure. "
"Another risk is bias, because a detector trained mostly on adults may fail for younger students. "
"On balance the school should use a PIN instead, because it gives the benefit without storing faces."),
("Bolt", "One benefit is speed, so staff save time. Another benefit is accuracy, because no parcel goes to the wrong room. "
"There is a risk to privacy."),
("Cog", "Face recognition is a benefit. It is also a risk."),
("Dot", "Robots are interesting and schools are busy places."),
]Plan your program here, then type it in and press Run.