42 Exam 05 (often referred to as Rank 05) is a significant milestone in the 42 network curriculum, marking the transition from C to advanced C++. It primarily focuses on the concepts introduced in the C++ Modules (05-08) , specifically Exceptions Containers (STL) Core Topics Covered The exam generally draws from the following modules: Exceptions (Module 05): Handling runtime errors using
. You will likely need to create custom exception classes inheriting from std::exception Casts (Module 06): Understanding and implementing C++ casts like dynamic_cast static_cast reinterpret_cast const_cast Templates (Module 07): Writing generic functions and classes. STL Containers & Algorithms (Module 08):
Utilizing the Standard Template Library, including containers like std::vector , as well as algorithms like std::for_each Common Exercises & Patterns Based on student repositories like RinatMambetov/exam05-42school , the exam typically includes: The "Warlock" / "Spellbook" Exercise:
A classic Rank 05 problem involving multiple classes (Warlock, Spell, Target) where you must manage a collection of spells using a
or similar container and handle exceptions when spells are unknown or targets are invalid. ASpell / ATarget Abstract Classes:
You will often be asked to implement abstract base classes and concrete subclasses (e.g., ) to demonstrate polymorphism. Memory Management:
Even in C++, you must ensure no leaks occur when your classes are destroyed. Exam Preparation Tips Standard Headers:
Memorize which headers are needed for different tools (e.g.,
Always implement the Orthodox Canonical Class Form (Default constructor, Copy constructor, Copy assignment operator, Destructor) unless the subject specifically says otherwise. Simulation Tools: Use student-made tools like the 42_examshell to practice under time pressure. Practice Repositories: Review community-contributed guides and solutions on to see different implementation styles. Actionable Resources Study Guides: Explore the 42-common-core
repository for detailed notes on the C++ modules leading up to the exam. Forum Discussions:
The room smelled of old coffee, stressed silence, and the faint electrical hum of forty-two monitors. It was 8:42 AM. Exam 05 at 42 school had begun.
Lena stared at her screen. The subject line of the prompt was deceptively simple: ft_irc. Build a basic IRC server. Handle multiple clients. Authenticate. Parse commands. Broadcast messages. No crashes. No memory leaks. And above all… be fast.
Her fingers hovered over the keyboard. She had trained for this. Two weeks of sleeping on a worn-out couch in the 42 dormitory. Fifty-seven cups of vending machine espresso. A thousand compile errors.
Tick. The first client connected. A terminal window opened beside her code. nc localhost 6667. She typed NICK lena, then USER lena 0 * :Lena. The server responded: :localhost 001 lena :Welcome.
She exhaled. The foundation held.
Then came the real test: multiple clients. She spawned another terminal. nick pierre. USER pierre 0 * :Pierre. They needed to talk. She typed PRIVMSG pierre :Hello? from her first client. Nothing happened. The message vanished into the void.
Her heart rate spiked. A bug in the channel lookup. She dived into her hash table logic. Index off by one. Fixed. Recompiled. Restarted. Now the message appeared. Pierre’s client showed :lena!~lena@localhost PRIVMSG pierre :Hello?. He typed back: PRIVMSG lena :Ça va?.
It worked. A tiny, fragile victory.
But exam 05 had a cruelty built into its core: the operational security segment. Halfway through, the exam system injected chaos. A simulated network split. A malformed packet. A client sending QUIT without a proper disconnect. Her server, as written, would segfault on a null pointer when parsing the empty QUIT reason. 42 exam 05
She watched in horror as her server process died. The exam timer showed 00:47 remaining.
Forty-seven minutes to fix the unfixable.
Her mind went blank. Then she remembered a line from the school's philosophy: "The only way to fail is to stop trying." She reopened the code. The crash was in the handle_quit function. She added a guard clause: if the argument was null, treat it as an empty string. Recompiled. Restarted. The client connected. The crash didn't happen.
She added a PART command. JOIN. TOPIC. KICK for channel operators. With seventeen minutes left, she implemented the MODE command — but only +i (invite-only) and +t (topic restricted). The exam spec only required those two. Perfectionism would kill her time.
At 00:03, she ran the final test suite: the school's automatic "moulinette" program. It spawned 20 clients simultaneously. They joined channels. Sent private messages. Left abruptly. The server held. No memory leaks. No double frees. No segmentation faults.
The moulinette printed: [42 EXAM 05] ft_irc: PASS (100/100)
She didn't scream. She didn't cry. She simply leaned back, pulled her hoodie over her head, and listened to the rain against the glass wall of the lab. Around her, other students were still typing furiously — some swearing, some laughing, one staring at a core dump like it had murdered his family.
Exam 05 was the gatekeeper between the intermediate circle and the advanced projects. It had broken better coders than her. But today, it broke against her.
She closed her laptop, walked out into the wet cobblestone street, and for the first time in two weeks, called her mother.
"Maman… I think I'm going to make it."
The 42 Exam Rank 05 tests your proficiency in Object-Oriented Programming (OOP) using C++, with recent updates occasionally including an optional or separate C component. The exam typically follows a multi-level structure focusing on class design, polymorphism, and algorithm implementation. C++ Stream (Core Subjects)
This is the most common version of the exam, where you must implement specific classes using the Orthodox Canonical Form (default constructor, copy constructor, assignment operator, and destructor).
cpp_module00 (Warlock Basics): Create a basic Warlock class with a name, title, and introduction methods. cpp_module01 (Spells and Targets):
Warlock: Add the ability to learn, forget, and launch spells.
ASpell / ATarget: Implement abstract base classes with clone() methods.
Specific Spells/Targets: Create concrete classes like Fwoosh and Dummy. cpp_module02 (Spell Management):
SpellBook: A class to store and manage the Warlock's learned spells. TargetGenerator: A class to manage and create target types.
Advanced Spells: Implement more complex spells like Fireball, Polymorph, and targets like BrickWall. Alternative/New Subjects (C & C++) 42 Exam 05 (often referred to as Rank
Some newer versions of the exam split the rank into two levels or offer different algorithmic challenges: Task Description Level 1 BigInt
Implement an arbitrarily large integer class with operator overloading (arithmetic, comparison). Level 1 Vect2
Create a 2D mathematical vector class with basic arithmetic and indexing. Level 1 Polyset Implement collection classes like SearchableBag and Set. Level 2 BSQ Find the largest possible square in a given map/grid. Level 2 Life Implement Conway's Game of Life (cellular automaton). Key Technical Requirements flmarsou/42nice-exam05: New 42 Exam 05 Subjects/Solutions
If you're looking at or preparing for Exam 05 from 42, here are a few general suggestions on how to approach it:
On a scale of 1 to 10 (where Exam 00 is a 2 and Exam Final is a 9.5), 42 exam 05 ranks as a 7.5. It is harder than the algorithmic exams because concurrency is non-deterministic. A bug might not appear until the 100th run, but Moulinette will find it.
However, it is not impossible. Thousands of students have passed it before you. The ones who fail are those who:
man CommandYou cannot Google "how to use strcmp." You must do:
man strcmp
Practice reading man pages for:
malloc / freewriteqsort (for advanced merges)Is Exam 05 hard? Yes. Is it fair? Absolutely. Is it worth the gray hairs? Definitely.
Now go get your grade. Good luck, cadet.
Have you taken Exam 05? Did you suffer more or less than I did? Let me know in the comments—or cry with me on the 42 Slack.
The 42 Exam Rank 05 is a key milestone in the 42 School Common Core curriculum, primarily focused on C++ Object-Oriented Programming (OOP) and complex system design. Core Objectives
C++ Proficiency: Mastery of advanced C++ concepts, particularly focusing on the CPP Module 05 to CPP Module 09 projects.
OOP Concepts: Deep understanding of classes, inheritance, polymorphism, and templates.
Resource Management: Efficient use of constructors, destructors, and member functions to prevent memory leaks. Exam Structure & Rules Duration: Typically 3 hours (180 minutes).
Norminette: Usually OFF for this rank, allowing more flexibility in code formatting compared to earlier C projects.
Submission System: Like other 42 exams, it uses an automated examshell for real-time grading.
Flexible Completion: Unlike some earlier exams, Rank 05 may allow you to complete part of the exam, leave, and resume remaining exercises in a subsequent session without restarting from the first one. Common Subject Themes The room smelled of old coffee, stressed silence,
Warlock and Spells: A recurring theme in many versions of Exam 05 involves implementing a Warlock class that interacts with various ASpell and ATarget objects.
Vector Operations: Exercises may include creating 2D mathematical vector classes (vect2) with operator overloading for arithmetic and comparisons.
Choice of Language: Recent reports suggest that some campuses might allow students to choose between C (focusing on algorithms) and C++ at the start of the exam. Preparation Resources
Based on the filename/identifier "42 exam 05", this refers to Exam Rank 05 of the École 42 curriculum.
In the "Classic" 42 curriculum (Common Core), Exam Rank 05 is generally considered the easiest of the advanced ranks. It focuses on Object-Oriented Programming (OOP) in C++.
Here is a comprehensive guide to preparing for and passing Exam 05.
I failed my first attempt. Spectacularly. My program compiled, but I had a segmentation fault because I forgot to check if a Form was signed before executing it. That is how sensitive this exam is.
Here is the strategy I used to finally pass:
freeIn Exam 05, the malloc protected exercises require you to free every node in a tree, even if you are returning NULL. If you leak memory on an error condition, the automated tests (like -fsanitize=address) will flag you.
The Fix: Write your free_all function first. Even before you write the logic. Adopt the mantra: "If I malloc it, I free it."
During the exam, the automated grading system (Moulinette) is strict. Here are the common reasons for failure:
nullptr (use NULL), auto keyword, range-based for loops, std::to_string, <chrono>.-Wall -Wextra -Werror. Your code must not throw any warnings.#ifndef, #define, #endif in header files will cause compilation errors if files are included multiple times.delete anything you new. Using tools like valgrind during practice is essential.Week 1–2: Fundamentals
Week 3: Data structures
Week 4: Algorithms
Week 5: Systems and I/O
Week 6: Concurrency and robustness
Week 7: Mock exams
Week 8: Polish and review