OOP Phase Test (Summer)

Beschreibung

Set of questions for revision purposes!
b3014292
Karteikarten von b3014292, aktualisiert more than 1 year ago
b3014292
Erstellt von b3014292 vor mehr als 9 Jahre
134
0

Zusammenfassung der Ressource

Frage Antworten
What is dynamic memory allocation? Dynamic memory allocation is used to create variables or instances on the heap, at run-time.
In 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.
What are virtual functions? Virtual function is a function that can be overwritten within a inherited class by a function with the same signature
What 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.
If 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
Does this code work: void showDate(const Date& d) const { cout << d.getDay() << " " << d.getMonth() << " " << d.getYear(); } No unless const is remove after showDate()
Which is called first? trl.deleteGivenTransaction(trl.getLastTransactionForDate(d)); trl.getLastTransactionForDate(d) Note the brackets!
What is this Pair defined as? template <typename T1, typename T2> Class Templete
Does this code call a copy constructor? Pair<int, int> x(12, 3); No
Assuming 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
In what class is Abstraction is only designed to be used in? Abstract class is only designed to be used in the base class.
If im making a abstract class, what must my function be? Abstract class must be a pure virtual function!
What kind of relationship would the following be: Player* player = p_player; Direct Association
When is Dynamic Binding obtained? It is obtained when a virtual function is called
What does a base class and derived class look like in Dynamic Binding? Base Class: class BankAccount{ //... }; Derived Class: class CurrentAccount : public BankAccount { //... };
True 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
In Abstract Base Classes, what keyword is needed to make a class abstract? Virtual (this will become a pure virtual function)
What 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!
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Historical Development of Computer Languages
Shannon Anderson-Rush
Useful String Methods
Shannon Anderson-Rush
Flvs foundations of programming dba 2
mariaha vassar
Mapa Conceptual - Arreglos
ciroivan94
Vector
Ariel Sanchez
C++ Syntax Keyword
Ariel Sanchez
CSC160 Final Project - Mastermind in C++
jsmith303
Data Types
Jacob Sedore
Python Quiz
karljmurphy