Practice: test strategy drill
45 min · Beginner
Need help? Ask a tutor on WhatsApp (opens in a new tab)Test strategy only helps if the numbers come to you in seconds, under a clock. This drill puts the whole module to work: guess maths, time budgets, proctoring rules and a broken Java submission.
Guess value in one formula
Expected value is the average marks of a guess: p × m - (1 - p) × penalty, where p is your chance of being right and m is the marks for a right answer. The break-even chance is penalty / (m + penalty).
Guess only when your chance is above the break-even point. The example below prints the value of a blind guess for five marking schemes.
Example 1 · Guess value for five schemes
public class FiveSchemesDemo { static void show(String name, int options, double marks, double penalty) { double p = 1.0 / options; double value = p * marks - (1 - p) * penalty; double breakEven = penalty / (marks + penalty); System.out.printf("%-26s value %.4f, break-even %.1f%%%n", name, Math.abs(value) < 1e-9 ? 0.0 : value, breakEven * 100); }
public static void main(String[] args) { show("A: 4 options, +1/-0.25", 4, 1, 0.25); show("B: 4 options, +1/-1/3", 4, 1, 1.0 / 3); show("C: 4 options, +2/-0.5", 4, 2, 0.5); show("D: 5 options, +1/-0.25", 5, 1, 0.25); show("E: 4 options, +3/-1", 4, 3, 1); }}A: 4 options, +1/-0.25 value 0.0625, break-even 20.0% B: 4 options, +1/-1/3 value 0.0000, break-even 25.0% C: 4 options, +2/-0.5 value 0.1250, break-even 20.0% D: 5 options, +1/-0.25 value 0.0000, break-even 20.0% E: 4 options, +3/-1 value 0.0000, break-even 25.0%
What this code does
- Scheme C doubles both marks and penalty of a +1/-0.25 test, so the break-even stays at 20% and the value doubles. Schemes B, D and E make a blind guess worth exactly zero on average.
doublearithmetic can leave a tiny error such as -0.00000000000000003 where the exact answer is 0. Printed as is, it would show -0.0000, so values this close to zero are printed as 0.
With the usual m = 1 this becomes penalty / (1 + penalty). Some tests give 2 or 3 marks per question with larger penalties, so always use the real numbers from the instructions screen.
Revise: Negative marking, sectional cut-offs and time management (opens in a new tab)
Predict the output
Predict the guess value
Read each program and pick what it prints.
Round 1 of 2
Time budgets for different patterns
A test pattern is the list of sections, question counts and times of a test. For every MCQ section the budget is minutes × 60 / questions; for coding it is minutes / problems.
Keep about 10% of each MCQ section for review. The example below prints budgets for three sample patterns.
Example 2 · Budgets for three sample patterns
public class PatternBudgetDemo { static void mcq(String name, int questions, int minutes) { double each = minutes * 60.0 / questions; System.out.printf(" %-18s %5.1f s each, %5.1f s with buffer%n", name, each, each * 0.9); }
static void coding(int problems, int minutes) { System.out.printf(" %-18s %5.1f min per problem%n", "Coding", minutes / (double) problems); }
public static void main(String[] args) { System.out.println("Pattern A"); mcq("Quant", 20, 20); mcq("Reasoning", 20, 20); mcq("Verbal", 20, 15); System.out.println("Pattern B"); mcq("Mixed MCQs", 60, 60); coding(2, 45); System.out.println("Pattern C"); mcq("Technical MCQs", 30, 30); coding(3, 90); }}Pattern A Quant 60.0 s each, 54.0 s with buffer Reasoning 60.0 s each, 54.0 s with buffer Verbal 45.0 s each, 40.5 s with buffer Pattern B Mixed MCQs 60.0 s each, 54.0 s with buffer Coding 22.5 min per problem Pattern C Technical MCQs 60.0 s each, 54.0 s with buffer Coding 30.0 min per problem
What this code does
- Verbal in pattern A is the tightest section at 45 seconds a question, so practise it with a timer.
- Pattern B gives 22.5 minutes per coding problem: enough for a brute force and one improvement, not for a long struggle with one problem.
Work out the budgets the night before, from the pattern in the drive notice, and write them on your rough sheet in the first minute of the test.
Order of execution
Prepare the night before
Put these preparation steps in order.
Rules of a proctored test, in one view
A violation is any action the test rules do not allow. Most come from three places: another person or device, leaving the test window, and anything not listed as allowed.
The table below pairs common violations with the correct action. When there is a technical problem, stay in frame, note the time, contact support and inform the TPO.
Violation Correct actionPhone on the desk Off and out of reach; use the on-screen timerSomeone talking in the room Take the test alone; tell family or roommates in advanceOpening another tab to search Stay in the test tab; skip and mark insteadSwitching device after a freeze Stay on the same device; contact support and the TPOIf you are unsure whether something is allowed, treat it as not allowed and ask the TPO or support before the test, not during it.
Find the bug
Spot the violation
One line in each plan is a violation or a bad reaction. Tap it.
A plan for test day.
Round 1 of 2Fixing a coding submission
A submission is one version of your code sent to the judge. When it fails, the idea is often right: the cause is usually the output format, a type bug or slow input.
Fix a failing submission in this order: output format first, then types and division, then input and output speed. The example shows a broken submission and its fix.
Example 3 · A broken submission and its fix
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;
// Task: read n, then n marks on one line. Print the number of marks >= 40,// then the average with two decimals.// Broken version: print("Enter n: ") ... println("Passed: " + pass) ... println(sum / n)public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine().trim()); StringTokenizer st = new StringTokenizer(br.readLine()); long sum = 0; int pass = 0; for (int i = 0; i < n; i++) { int m = Integer.parseInt(st.nextToken()); sum += m; if (m >= 40) pass++; } System.out.println(pass); System.out.printf("%.2f%n", (double) sum / n); }}3 50.80
What this code does
- For the sample input
5and35 72 40 88 19, the broken version printedEnter n: Passed: 3and50: a prompt, a label and anintaverage. Each one alone makes the answer wrong. - The fix prints only the two values, casts to
doublebefore dividing (254 / 5 = 50.80) and formats two decimals with%.2f. BufferedReader keeps it fast for large n.
Common causes: a prompt or label in the output, slow Scanner input on huge data, int division where decimals are needed, an int that overflows, or a missing decimal format. A format error fails every test, while a speed problem fails only the large ones.
Predict the output
Predict the broken output
Read each program and pick what it prints.
Round 1 of 2
What's next
You finished the preview of Placement Process & Test Formats
Java Programming has 26 sections, 252 modules and 1949 lessons. An account opens every lesson and saves your progress.
Next step
Check your understanding
12 quick questions