Вы находитесь на странице: 1из 2

ECS40

Final study guide


Note: the following is indicative only. Actual questions on the exam may or may not be
included in the list of topics below.
Topics covered: Ch 1-18, Lecture 1-16 (without the section on hash tables)

1) Review all the ways in which a parameter can be passed to a function in C++, including the
use of the const keyword to ensure that the function cannot modify the parameter.

2) Review the way in which const variables and references can be initialized in a class
constructor.

3) Review the accessibility of a base class data member from a member function of a derived
class (consider the situation where the data member is public, protected or private).

4) Review the definitions of different constructors.

5) Review the definition of a default assignment operator.

6) Review the definition of the this pointer.

7) What is a const member function? How is it declared?

8) Write a code fragment that allocates an array of double of size 10 using new and
initializes a pointer. Include the declaration of the pointer. Write the statement that frees the
memory allocated above.

9) Review the logic and syntax of try / catch blocks.

10)Understand the role and syntax of functions declared as friend of a class.
11) Write a class representing points in the x-y plane. Implement an overloaded operator+.
12) Read and understand the reason why the class Penguin cannot be simply derived from the
class Bird in the lecture notes (Lecture 8).

13) What is polymorphism?

14) What is Run-Time Type Identification (RTTI)? Give an example using the dynamic_cast
operator.

15) What is the role of a factory member function? Why should it be a static function?

16) What is generic programming?

17) Review the definitions of the STL sequential and associative containers discussed in the
lecture notes.

18) Assuming that a vector<int> contains the numbers {1,2,3,4,5}, write a statement using
the insert function so that the element 6 is placed between 3 and 4 (i.e. the resulting vector
contains {1,2,3,6,4,5}. Write a short program containing your statement and run it to check
that it does what you expect.

19) What is a function object?

20) Write a while loop that reads integers from standard input and prints them on standard
output separated by spaces until the end of file on standard input is encountered.

21) Define a binary tree. Define a binary search tree.

22) Write a program that reads strings from stdin, inserts them in a set container, and
prints them sorted on stdout.

23)Write a program that does the same as in problem 22 but using a vector container.

24) What is a binary tree?

25) What is a binary search tree?

26) What is a binary heap?

27) Understand where to add an element in a binary search tree.

Вам также может понравиться