GoConqr has a new look! Let us know what you think.

Flashcards

OOP Phase Test (Summer)

b3014292 English 18 cards

Cards in this deck (18)

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

Information

Description
Set of questions for revision purposes!
Created by
b3014292
Views
205
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?