This course has already ended.
Exam: preparing for the exam and questions¶
The exam will focus on the course core learning outcomes from the point of view of the theoretical content. There will be no actual coding needed as the IDE is not available in the Exam classrooms.
Example Exam¶
- The name of the course is Programming 3: Techniques. Explain why, based on the central learning outcomes of the course. 6 points
- Explain how the paired terms are related together. Note that there might be several ways how they are related. 2 points each
- Class hierarchy — Interface classes
- Polymorphism — Inheritance hierarchy
- Abstract base class — Localization principle
- Interface documentation for interface class ICity is attached. What do the concepts in the documentation mean? What does the documentation require from you as a caller of the interface? What things do you need to take into account when implementing the interface?
- Write (with words or with mathematical formulae, however, as exact as possible) pre- and postcondition for function. 2 points
void func( string& s )
{
s.clear();
}
- True/False statements, e.g. 1 point each
- An abstract base class defines both interface functions and their (base class) implementation.
- The purpose of class hierarchies is to show, which classes use the services of which other classes.
- Dynamic binding means that when calling a member function, the code to be called is chosen only at run time.
- Which exception guarantee does each member function below provide? Justify your answer carefully.
class VectorInt
{
public:
VectorInt();
~VectorInt();
int front() const;
int& operator[](int location);
int& at(int location);
void push_back(int element);
void swap(VectorInt& v);
void insert(int location, int element);
void insert(int location, VectorInt& values);
private:
int* datablock_; // This pointer will point to an array of integers allocated with new
int blocksize_; // Size of the allocated array
int elementamount_; // size of the area used from array
};
Posting submission...