Free · no sign-up · no AI cost

Prompt lab: prompt engineering for hiring tests

Campus and graduate hiring tests (on platforms like HackerRank) now include a prompt engineering question: write one prompt that gets an AI to give the exact right answer on hidden test inputs. Learn the six things that make prompts pass, then practise on 25 real-style tasks with 108 test cases. Run your prompt in your own AI (ChatGPT, Claude, Gemini…), paste the reply back, and see “3 / 5 test cases passed” just like the real test.

🧪 Start a task 📖 Read the guide (5 min) 🎯 Quick-fire questions

The guide: how to write prompts that pass hidden tests

1How these questions work

In tests like HackerRank, you do not chat with the AI. You write one prompt with a {input} placeholder. The system puts in hidden test inputs, runs an AI, and checks that each reply matches the expected answer exactly, like a coding test. “Sure! The answer is Dune,7” fails. So does “Dune, 7” with a space.

2The six parts of a strong prompt

Most passing prompts have the same parts. Not every prompt needs a role, but the other five are almost always needed.

WhoOptional: “You are a careful data checker.”
TaskWhat to do, in one clear sentence.
InputWhat the data looks like, and where it is: {input}.
RulesRepeats, ties, capitals, empty input, rounding: the things hidden tests check.
OutputThe EXACT format, and “reply with ONLY the answer”.
ExampleOne small worked example.

3Say exactly what the output looks like

Copy the required format into your prompt word for word, then add: “Reply with ONLY the answer, nothing else.” Add one tiny example. Mention spaces, capitals, decimals and separators if they matter, and say “no code block” when the answer is JSON or code-like.

4Think like the hidden tests

The sample cases are easy; the hidden ones are not. Before you submit, ask: what if an item appears twice? What if two items tie? What if the input is empty? Different capitals, extra spaces, punctuation, a $ sign, a single item, a boundary value (exactly 75, exactly midnight)? Give a rule for each one that could happen.

5Describe the input, then put it last

Tell the AI what each line looks like (“each line is <Book> - Borrowed <n> times”), then put the data at the very end after a label such as Records: and {input}. Clear markers stop the AI mixing your instructions with the data.

6Let the AI think, but show only the answer

For counting or calculating, you can say “work it out carefully step by step, but reply with only the final answer”. Short, plain sentences beat long clever ones. Test with tricky inputs of your own before you submit.

Practice tasks

Start with the Easy ones. Each task has 2 sample cases you can see and more cases like the hidden ones. Your prompts and results are saved on this device.

Count and total

Extract data

Reformat

Classify

Validate

Reason

Also practise

Prompt engineering quick-fire questions (spot the problem, pick the better prompt, which test fails?) · A full campus-test style mock · Aptitude, reasoning and data