Question
2) Review the way in which const variables and references can be initialized in a class constructor. 6) Review the definition of a default assignment
2) Review the way in which const variables and references can be initialized in a class constructor. 6) Review the definition of a default assignment operator.
7) Review the definition of the this pointer.
8) What is a const member function? How is it declared?
9) 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.
10)Review the logic and syntax of try / catch blocks.
13) Write a class representing points in the x-y plane. Implement an overloaded operator+.
14) Read and understand the reason why the class Penguin cannot be simply derived from the class Bird in the lecture notes (Lecture 8).
16) What is Run-Time Type Identification (RTTI)? Give an example using the dynamic_cast operator.
19) Review the definitions of the STL sequential and associative containers discussed in the lecture notes.
24) Write a program that reads strings from stdin, inserts them in a set container, and prints them sorted on stdout.
27) Express the cost of finding an element in a balanced binary search tree, as a function of the number N of elements in the tree.
29) Understand where to add an element in a binary search tree.
30)Write a range-based for loop to print on stdout all the elements of a list declared as list a;
20) Assuming that a vector 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started