Flashcards
OOP Phase Test (Summer)
Flashcards do conjunto (18)
- 1What is dynamic memory allocation?Dynamic memory allocation is used to create variables or instances on the heap, at run-time.
- 2In Dynamic Memory Allocation, the new and delete keywords are used but is it a good idea to use them?No, as new and delete is a keyword that is commonly used but the danger of using new and delete is that the system cannot check the memory allocation of new and delete.
- 3What are virtual functions?Virtual function is a function that can be overwritten within a inherited class by a function with the same signature
- 4What is upcasting?Upcasting is an automatic type of conversion in C++ from the derived class into a base class type. It implements the prinple of object compatibility. It happens when the instance of a derived class is used where an instance of the base class in executable.
- 5If instance x of X knows about instance y of Y, is x a private data class member?No, because making x a private data class member will not allow y know the existence of x
- 6Does this code work: void showDate(const Date& d) const { cout << d.getDay() << " " << d.getMonth() << " " << d.getYear(); }No unless const is remove after showDate()
- 7Which is called first? trl.deleteGivenTransaction(trl.getLastTransactionForDate(d));trl.getLastTransactionForDate(d)
Note the brackets! - 8What is this Pair defined as? templateClass Templete
- 9Does this code call a copy constructor? Pair x(12, 3);No
- 10Assuming that all the parameters are set up correctly, does this code work? ca.updateBalance(12.0)No because although the the paramiters are correct, it doesn't take in a literal value
- 11In what class is Abstraction is only designed to be used in?Abstract class is only designed to be used in the base class.
- 12If im making a abstract class, what must my function be?Abstract class must be a pure virtual function!
- 13What kind of relationship would the following be: Player* player = p_player;Direct Association
- 14When is Dynamic Binding obtained?It is obtained when a virtual function is called
- 15What does a base class and derived class look like in Dynamic Binding?Base Class:
class BankAccount{ //... };
Derived Class:
class CurrentAccount : public BankAccount { //... }; - 16True or False: In class derivation, Static binding is a mechanism that allows the compiler to decide which (version of the) code to invoke for a member function depending on the type of the handle?True
- 17In Abstract Base Classes, what keyword is needed to make a class abstract?Virtual
(this will become a pure virtual function) - 18What is a singleton class?A singleton class whole number of instances that can be instantiated is limited to one is called a singleton class. Only 1 instance can exist - no more!
Informações
- Descrição
- Set of questions for revision purposes!
- Criado por
- b3014292
- Visualizações
- 205
- Tags
- Avaliação