100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSC 102 Exam 2 Questions with All Correct Answers Updated

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
19-09-2024
Written in
2024/2025

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 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

Show more Read less
Institution
CSC 102
Course
CSC 102









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSC 102
Course
CSC 102

Document information

Uploaded on
September 19, 2024
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

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];

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Scholarsstudyguide nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
780
Member since
3 year
Number of followers
475
Documents
15129
Last sold
2 days ago
NURSING

Here you will find everything you need in nursing Assignments, EXAMS AND TESTBANKS. For students who want to see results twice as fast. I strive for my content to be of the highest quality. Always leave a review after purchasing any document so as to make sure our customers are 100% satisfied.

3.9

163 reviews

5
87
4
21
3
25
2
6
1
24

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions