OOP for Scientific Computing First Exam

points:

1 2 3 4 5 \(\Sigma\)
15 20 10 10 10 65

Following was asked in the exam:

  1. Explain following aspects of C++ :

    1. class vs struct?
    2. namespace. What is it, when & why is it used?
    3. private vs protected?
    4. copy elision?
    5. header guards. What, why?
    6. rule of five vs fule of zero?
    7. temporaries? literals?
    8. how does a shared pointer work?
    9. SFINAE?
    10. SOLID?
  2. Short code snippets were given and asked to explain & extend. With following topics:

    1. default function args
    2. concepts
    3. template parameters, default template parameters
    4. Constructor, copy constructor, copy assignment operator, move constructor, move assignment operator, overloaded constructor.
    5. Lambda expression, functional programming
    6. Compile time branching
    7. CRTP
    8. Inheritence. How to improve the given implementation
  3. Horner Schema: Variadic templates, recursion with templates(?), template metaprogramming

  4. An incomplete implementation of an OOP system was given that was supposed to implement a simulation a prey-predator dynamic system, modeled by the Lotka-Volterra differential equations:

    \[\begin{align*} &\frac{dx}{dt} = \alpha x - \beta xy, \\ &\frac{dy}{dt} = \gamma y - \delta xy \end{align*}\]

    The incomplete OOP system had the following basic structure:

    Lotka-Volterra OOP System
    1. Implement the PreyPredatorData Simulate(int steps, double dt) that creates a PreyPredatorData object, populates its members with the simulation data based on the Lotka-Volterra difference equations and returns the object:

    \[\begin{align*} &X_{n + 1} = X_n + \Delta t (\alpha x_n - \beta x_ny_n) \\ &Y_{n + 1} = Y_n + \Delta t (\delta x_ny_n- \gamma y_n) \end{align*}\]

    1. ?
  5. ?