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

Exam (elaborations)

CSC 102 Exam 2 Questions with All Correct Answers Updated

 0 view  0 purchase
  • Course
  • CSC 102
  • Institution
  • CSC 102

CSC 102 Exam 2 Questions with All Correct Answers Updated 3 things normally done for classes with pointer member variables - Answer--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 ...

[Show more]

Preview 2 out of 5  pages

  • September 19, 2024
  • 5
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CSC 102
  • CSC 102
avatar-seller
Scholarsstudyguide
CSC 102 Exam 2 Questions with All
Correct Answers Updated 2024-2025

3 things normally done for classes with pointer member variables - Answer--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? -
Answer-yes

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

Dynamic binding - Answer-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 - Answer-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 -
Answer-the base class

Solution: - Answer-use a virtual destructor in the base class

The virtual destructor of a base class automatically makes the destructor of a ___ class
__ - Answer-derived... virtual

after executing the destructor of the derived class.. - Answer-the destructor of the base
class executes

the destructor of the derived class does not execute if it is not - Answer-virtual

if a base class contains virtual functions, make the destructor of the base class -
Answer-virtual

syntax for pure virtual functions - Answer-set them equal to 0

abstract class contain one or more ___ virtual functions - Answer-pure

, difference between virtual and pure virtual - Answer-pure virtual do not need to define
definition in base class.

the only built-in operations on classes are - Answer-assignment
member selection


is the statement int* p; equivalent to int *p; or int * p; - Answer-yes

in the stament int* p, q; both are pointers t/f - Answer-false

this is valid int *p, *q; - Answer-yes

* refers to the ___ to which its ___ points - Answer-object... operand

can you make a pointer that points to an object of another type like a struct - Answer-
yes

dot operator has a ___ precedence than dereferencing operator... solve this - Answer-
higher...
(*studentPtr).gpa = 3.9;

member access operator also in another form - Answer-->

syntax for accessing a class member using the operator is - Answer-
pointrVariableName->classMemberName

thus - Answer-Thus,
(*studentPtr).gpa = 3.9;
is equivalent to:
studentPtr->gpa = 3.9;

t/f Pointer variables must be initialized if you do not want them to point to anything -
Answer-true

a null pointer - Answer-p = 0; or p = NULL;

the number __ is the only number that can be directly assigned to a pointer variable -
Answer-0

new ___ and returns __ - Answer-allocates memory and returns a pointer to it's (starting
address)

create a pointer pointing to an array of 5 dynamically allocated chars called name. -
Answer-char *name;
name = new char[5];

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 Scholarsstudyguide. 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)

76669 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