Writing Exams

by bhagenlo and skienzle

Hi!

Ready for your first (or next) exam? Excited yet? Here's what you need to know (so that you don't waste time during one.)

Just like during the piscine, make sure to subscibe to event and project on intra.

In general, (at least at 42Heilbronn), in an Exam you have to do the following:

(Don't worry, it's all explained with an overlay over the wallpaper, too – it's just that nervous people make mistakes :))

  1. Log in onto the system.
    Username: exam
    Password: exam
  2. Start up a shell. Execute kinit <intraname>
    With that, you should be up and running.
  3. There, you can see the Exam shell.
    You'll mostly need the commands grademe and status which both do the obvious things.
  4. To open VSCode open the MACOS search bar (keybord shortcut: command + space) and type Visual Studio Code.
  5. Start working in the ~/rendu folder. Before even starting to write code, make completely sure the folder structure is exactly right. Really.
  6. Don't forget to save your work (e.g. by enabling auto save in VSCode) before testing and always compile with the flags -Wall -Werror -Wextra.
  7. Lastly please remember to commit and push everything before starting grademe in the examshell.

#Exam 02

Consists of 4 levels, each with different functions you have to code.

The subject descriptions & solutions are here. But really, I don't think you need those.

Just make sure you know how to:

  • Bitshift
  • Allocate memory
  • Write a functioning loop
  • Construct strings out of numbers, and numbers out of strings (Yep, that is the hard one.)

#Exam 03

Is either ft_printf or get_next_line. Although get_next_line has gotten suspiciously rare lately.

For ft_printf, it's only the conversions %s, %d and %x.

#Exam 04

Is microshell, a dumbed down version of minishell.

You only have to handle the pipe | and semicolon ; tokens, as well as the cd builtin.
Also the commands are supplied through the argv, so no fancy readline() logic is required.

Whether you want reuse the logic you used during minishell or come up with something new like here is up to you. Either way, make sure not to leak file descriptors.

#Exam 05

Its goal is to test your knowledge of object orientation through the use of C++ and the structure is similar to the last exercise of CPP Module 04, divided into 3 seperate levels.

Therefore, make sure to know how to work with:

  • Classes, Abstract classes and Interfaces
  • virtual and pure virtual methods
  • inheritance and polymorphism
  • the C++ Standard Template Libary, especially the member functions of either std::vector or std::map. Starting to work on ft_containers before doing the exam is definitely helpful, but not required

Also you will have to create a lot of files and write a lot of classes during the exam, so here are a few tips to save some time:

  1. All the classes of one exercise can be reused in the next one, but might need to be modified slightly.
  2. There are multiple classes that are structurally similar, so copy & paste + change all occurences will be your friend.
  3. Most of the implementations can be written directly into the .hpp files, but don't forget to create .cpp files and include the .hpp files in them!
  4. Use the c++ -Wall -Werror -Wextra *.cpp command in your current exercise folder to avoid typing all filenames by hand.

Lastly, always mark a member function as const if it doesn't alter the instance of a class - even if it's not requred by the subject - and check for NULL when dealing with pointers. This might save you unneccessary and hard to debug grademe fails.

#Exam 06

Is a morphed abomination between ft_irc, webserv and the C programming language (yep, it's C again), where you have to implement a chat server that broadcasts messages to all connected clients.

Before going into the exam you should know how to:

  • work with sockets (see below).
  • use select for I/O-multiplexing, as it is the only allowed option during the exam.
  • write data to a buffer using the sprintf function.
  • launch the nc program on a specific port, as you can test you server by using multiple instances of nc as clients.

In the subject folder you will find a main.c with some functions that may (or may not) be useful for your implementation, but it will give you a heads up if you need help in working with sockets.

← Finding Memory leaks

Found something to improve? Edit this page on Github!

Fighting the Norm (and C) →