# education

## Oral examinations — C/Unix

Filed Under:

In the process of sorting through archives and old stuff, I found a collection of sticky notes that colleagues and I used five years ago to evaluate students at EPITA. These were oral examinations with no computer, only pen and paper or whiteboard. As I am recycling the paper, here is the transcript for archival.

- each page of the Unix User Manual belongs to one of its sections. Give the title of each of the first three sections.
- given two C++ strings
`s1`

and`s2`

representing two large numbers expressed in base`b`

(each character is a digit), write an algorithm that returns the sum (as a C++ string of digits) expressed also in base`b`

. - what is the canonical mode for a terminal? Explain.
`SIGKILL`

and`SIGSEGV`

excluded, give the name of 5 signals, their meaning and their use(s).`%d`

,`%i`

and`%x`

excluded, give 5 distinct`printf`

format conversion specifiers.- give 6
`gcc`

options and explain them. Only the options properly explained are accepted. - give the library function names and data types involved in reading a Unix directory.
- given a
`make`

macro named SRC defined to an arbitrary list of Texinfo file names (e.g.`SRC = foo.texi bar.texi ...`

), write a`Makefile`

which creates PostScript and PDF output for these sources, using commands`texi2dvi`

,`texi2pdf`

and`dvips`

. - given a 2D character array (dimensions
`W`

and`H`

) with each cell set to`X`

or`O`

, representing respectively ground and water (it's a map), write an algorithm which takes the coordinates of two points and which returns true if and only if one can swim from one point to the other. - write an algorithm which takes two strings as input and returns true/false according to whether the two strings are anagrams of each other (e.g.
`abc/bca -> true`

,`aab/bba -> false`

). - given an array of zeros and ones, write an algorithm that returns the index in the array which maximizes the sum of the number of zeros on the left and the number of ones on the right (e.g.
`001101 -> 2`

). - given the expression
`printf(1["foo"])`

, comment. - given a sorted integer sequence
`s`

and an integer`n`

, write an algorithm which returns the value in`s`

which is closest to`n`

. - write an algorithm which takes a string representing an arithmetic expression as input and which returns true if and only if parentheses are properly balanced.
- write an algorithm which takes a character string as input and returns the character with the most occurrences.
- given a 2D character array (dimensions
`W`

and`H`

) with each cell set to`X`

or`O`

, representing respectively ground and water (it's a map), write an algorithm which returns the sum of the lengths of the coasts. Each cell side counts for 1. - given a directed graph structure
`G`

, an operator`V`

which for a given graph returns the set of nodes, and an operator`T`

which for a given node`n`

returns the set of nodes accessible from`n`

, write an algorithm which takes a graph as input and returns true if and only if the graph contains cycles. - to establish a connection with a client, a TCP server on Unix must call four library functions; give their name and the call order.