COP 3330 EXAM 1 WITH CORRECT ACTUAL
QUESTIONS AND CORRECTLY WELL
DEFINED ANSWERS LATEST 2024 – 2025
ALREADY GRADED A+
how can you suppress a type conversion in a constructor - ANSWERS-in .h file
explicit Fraction(double d); // will NOT be used for automatic conversions
everywhere const is applied it... - ANSWERS-expresses an intent on the part of the
programmer, which the compiler enforces (something is not allowed to change
within some scope)
what does a class consist of - ANSWERS-declaration and definition (split into two
files)
what does a struct consist of and how is it different than objects - ANSWERS-
name-the variable name we give it
attributes-data stored inside the struct
,In C data and functions are separate, but in C++ you can build objects that
encapsulate data and functions together
what are the parts of an object - ANSWERS-Name-the variable name we give it
Attributes-(member data)-the data that describes what the object is
Behavior-(member functions)-behavior aspects of the object (functions that
describe what the object does)
what is a class - ANSWERS-"BLUEPRINT FOR OBJECTS"(you can create many
objects from the same class type, in much the same way you can make many
houses from the same blueprint) -user defined type that describes what a certain
type of object will look like
DDU design - ANSWERS-Declare -- Declaration of class in header file
Define -- Definition of class members in implementation file
Use -- Usage of class by building objects
interface - ANSWERS-what the user sees while the implementation details are
hidden
how can you declare members of a class as - ANSWERS-public (can be accessed
from inside or outside the project) interface
private-can only be used by the object itself
, reasons for dating hiding - ANSWERS--makes interface simpler for user
-principle of lease priveledge (need to know)
-more secure-less chance for misuse (accidental or malicious)
-class implementation easy to change without affecting other modules that use it
class declaration format - ANSWERS-class <className>
{
public:
(public member data and functions go here)
private:
(private member data and functions go here)
};
what are the primary categories of member functions - ANSWERS-mutators-
member functions that can change the state (the member variables inside) of an
object
accessors-member functions that dont change state, aka const member functions
and ARE NOT PERMITTED TO CHANGE THE OBJECT
The benefits of buying summaries with Stuvia:
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
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
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 NurseLNJ. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $14.99. You're not tied to anything after your purchase.