100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSC 102 Exam 2 |Questions with 100% Correct Answers $11.49   Add to cart

Exam (elaborations)

CSC 102 Exam 2 |Questions with 100% Correct Answers

 1 view  0 purchase
  • Course
  • CSC102
  • Institution
  • CSC102

CSC 102 Exam 2 |Questions with 100% Correct Answers

Preview 2 out of 8  pages

  • October 19, 2024
  • 8
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CSC102
  • CSC102
avatar-seller
Examcheatcode
CSC 102 Exam 2 |Questions with 100% Correct
Answers
if an object containing a pointer pointing to a dynamically allocated array goes out of scope,
that array is deleted automatically. t/f - ✔️✔️no.. this is a memory leak



fix this - ✔️✔️ptrMemberVarType::~ptrMemberVarType()

{
delete [] p;
}



copy constructor is defined by __ and the two objects in question are of the ___ - ✔️✔️the
compiler... same type.



copy constructor automatically executes in three situations - ✔️✔️-when an object is declared
and initialized by using the value of another object
-when, as a parameter, an object is passed by value
-when the return value of a function is an object.



initialization due to the copy constructor is called __ and list its syntax - ✔️✔️default member-
wise initialization.


ptrMemberVarType objectTwo(objectOne);



the default initialization of the copy constructor leads to __ copy - ✔️✔️shallow



fix this to be deep syntax - ✔️✔️properly define the copy constructor

, className(const className& otherObject);



3 things normally done for classes with pointer member variables - ✔️✔️-include the destructor
in the class
-overload the assignment operator for the class
-include the copy constructor



can you pass an object of a derived class to a formal parameter of the base class? - ✔️✔️yes



static binding - ✔️✔️necessary code to call a specific function generated by the compiler... static
or early binding



dynamic binding - ✔️✔️compiler does not generate code to call a specific function; it generates
information to enable run-time system to generate specific code for the function call. (aka late
binding)



virtual functions have __ binding - ✔️✔️binding occurs at program execution time, not at compile
time.... dynamic


regardless of whether the object is passed by ref or val, if a derived class object is passed to a
formal parameter of the base class type, the destructor of __ executes - ✔️✔️the base class



solution: - ✔️✔️use a virtual destructor in the base class


the virtual destructor of a base class automatically makes the destructor of a ___ class __ -
✔️✔️derived... virtual



after executing the destructor of the derived class.. - ✔️✔️the destructor of the base class
executes

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Examcheatcode. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

76799 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.49
  • (0)
  Add to cart