Five days of exam prep - kevshouse/exam_quest GitHub Wiki
5-Day Revision Schedule for 42 School Common Core Exam
This schedule is designed to help you solidify your understanding of core C concepts and reliably implement the expected functions for the 42 School Common Core exam.
Day 1: Foundations & Basic Character/String Functions
Focus: Re-establish C basics, character manipulation, and simple string operations.
- Morning (3-4 hours): C Fundamentals Review
- Review C syntax: variables, data types, operators, control flow (if/else, switch, loops).
- Pointers: Declaration, dereferencing, basic pointer arithmetic.
- Function prototypes and definitions.
main
function arguments (argc
,argv
).
- Afternoon (3-4 hours): Level 0/1
libft
Practice- Implement and test:
ft_strlen
(string length)ft_strcpy
(string copy)ft_strcmp
(string compare)ft_swap
(swap two integers using pointers)ft_putchar
(print char)ft_putstr
(print string)ft_is_alpha
,ft_is_digit
,ft_isalnum
,ft_isascii
,ft_isprint
(character classification)ft_toupper
,ft_tolower
(case conversion, using ASCII offset logic)
- Self-check: Can you explain the logic for each function without looking at the code?
- Implement and test:
Day 2: String Manipulation & Simple Ciphers
Focus: Deeper string manipulation, handling arguments, and applying specific logical shortcuts.
- Morning (3-4 hours): Argument Handling & Ciphers
- Practice
aff_a
(find first 'a' in argument string). - Practice
aff_last_param
(print last argument). - Implement and test:
rotone
(rotate by 1, handle wrap-around 'z'->'a')rot13
(rotate by 13, using the+13/-13
logic)
- Self-check: Are you confident in handling
argc
andargv
? Do you fully understand the+13/-13
logic?
- Practice
- Afternoon (3-4 hours):
ft_atoi
&ft_itoa
- Implement and test:
ft_atoi
(string to integer: handle whitespace, sign, overflow/underflow withINT_MAX
/INT_MIN
).ft_itoa
(integer to string: handle negative numbers,INT_MIN
special case, memory allocation).
- Self-check: Can you trace
ft_atoi
andft_itoa
with edge cases like " -2147483648" or0
?
- Implement and test:
Day 3: Mathematical Algorithms
Focus: Implementing common number theory algorithms.
- Morning (3-4 hours): Primality & Factorials
- Implement and test:
is_prime
(handle edge casesn <= 1
,n == 2
, even numbers, loop up tosqrt(n)
).ft_factorial
(iterative, uselong long
for result, handle0!
).
- Self-check: Do you understand why
sqrt(n)
is the limit foris_prime
? Are you aware of factorial overflow?
- Implement and test:
- Afternoon (3-4 hours): GCD, LCM & Fibonacci
- Implement and test:
ft_gcd
(Euclidean algorithm, iterative).ft_lcm
(usingft_gcd
to prevent overflow).ft_fibonacci
(iterative, handle base casesF(0)
,F(1)
).
- Self-check: Can you explain the Euclidean algorithm step-by-step? Do you remember the LCM formula?
- Implement and test:
Day 4: Advanced String/Array & Edge Case Mastery
Focus: Tackling the more complex problems and ensuring robust handling of all inputs.
- Morning (4-5 hours):
ft_split
Deep Dive- Implement and test
ft_split
(split string by whitespace into an array of strings). - Break it down:
- Helper to count words.
- Helper to get word length.
- Main function: allocate array of pointers, allocate memory for each word, copy, null-terminate.
- Self-check: This is a tough one. Can you draw out the memory allocation for
ft_split
? What happens ifmalloc
fails?
- Implement and test
- Afternoon (3-4 hours): Comprehensive Edge Case Review
- Go back through all the functions you've implemented.
- For each, list all possible edge cases (empty string,
NULL
pointer,0
,1
,INT_MIN
,INT_MAX
, negative numbers, strings with only whitespace, etc.). - Manually trace or write small test cases to ensure your functions behave correctly for these edge cases.
Day 5: Timed Practice & Final Review
Focus: Simulating exam conditions and identifying last-minute weak spots.
- Morning (3-4 hours): Mock Exam Simulation
- Find a set of practice problems (e.g., from online 42 resources or previous Piscine exams if available).
- Set a timer (e.g., 2-3 hours, depending on typical exam length).
- Solve as many problems as you can, as if it were the real exam.
- Crucially, do not use external resources during this time.
- Afternoon (3-4 hours): Review & Refine
- Review your solutions from the mock exam.
- Identify any functions you struggled with or got wrong.
- Re-implement those specific functions.
- Go over any remaining concepts that feel shaky.
- Ensure your development environment (compiler, basic commands) is ready.
- Get some rest! A clear mind is crucial for the exam.
General Tips for Each Day:
- Compile Frequently: Don't write a whole function and then compile. Compile small chunks of code to catch errors early.
- Use
man
pages: For standard C functions, refer to theirman
pages to understand expected behavior and prototypes. - Write Your Own Main: For each function, write a small
main
function to test it thoroughly with various inputs. - Understand, Don't Memorize: Focus on the logic and principles. The exam might have slight variations.
- Take Breaks: Avoid burnout. Step away from the screen regularly.