• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

CS 170 Test 3: Objects and Classes || Already Graded A+.

Document preview thumbnail
Preview 2 out of 8 pages

In terms of organization, what do object classes provide? correct answers They are a way to organize a large number of variables required and/or the relationship between them Broad answer: What do objects hold/"encapsulate"? correct answers unrelated components that will be used into more broader programs What kind of visual are objects compared to? correct answers software "black boxes" List 2 bad things that can happen if we do not separate the pieces of code that deal with unrelated components (AKA, if we don't have objects) correct answers - fixing one error can create another one somewhere else - makes it harder to re-use code from one project to project Systems Programmers correct answers - make the building blocks of a program (object classes and such) that will be used for people's projects - relevant to hardware and software Application Programmers correct answers - use the building blocks to create their programs (don't care about building blocks) - can also pull apart some things in one object class and put it into another object class (just would work on a higher level of abstraction than a normal application programmer) - most of what we've been doing End users correct answers - only concerned with using the program - you when you use your email, your browser, your operating system object-oriented programming correct answers programming using objects What is the formal definition of an object? correct answers It's an entity that you can manipulate in your programs (a variable type). Specific: What do objects consist of? correct answers Data fields (instance variables) and methods (instance methods) What do instance variables do for an object? correct answers They define the state of the object What do instance methods do for an object? correct answers They provide instructions that accesses or modifies the state of an object What is a class? correct answers - a construct that defines objects of the same type (a set of objects with the same properties and a set of actions that they can perform) - code that tells you how to build an object of a type of class (the blueprint) - EVERY OBJECT IS TIED TO SOME CLASS

Content preview

CS 170 Test 3: Objects and Classes || Already Graded A+.
In terms of organization, what do object classes provide? correct answers They are a way to
organize a large number of variables required and/or the relationship between them

Broad answer: What do objects hold/"encapsulate"? correct answers unrelated components that
will be used into more broader programs

What kind of visual are objects compared to? correct answers software "black boxes"

List 2 bad things that can happen if we do not separate the pieces of code that deal with unrelated
components (AKA, if we don't have objects) correct answers - fixing one error can create another
one somewhere else
- makes it harder to re-use code from one project to project

Systems Programmers correct answers - make the building blocks of a program (object classes
and such) that will be used for people's projects
- relevant to hardware and software

Application Programmers correct answers - use the building blocks to create their programs
(don't care about building blocks)
- can also pull apart some things in one object class and put it into another object class (just
would work on a higher level of abstraction than a normal application programmer)
- most of what we've been doing

End users correct answers - only concerned with using the program
- you when you use your email, your browser, your operating system

object-oriented programming correct answers programming using objects

What is the formal definition of an object? correct answers It's an entity that you can manipulate
in your programs (a variable type).

Specific: What do objects consist of? correct answers Data fields (instance variables) and
methods (instance methods)

What do instance variables do for an object? correct answers They define the state of the object

What do instance methods do for an object? correct answers They provide instructions that
accesses or modifies the state of an object

What is a class? correct answers - a construct that defines objects of the same type (a set of
objects with the same properties and a set of actions that they can perform)

- code that tells you how to build an object of a type of class (the blueprint)
- EVERY OBJECT IS TIED TO SOME CLASS

, - includes definitions for all the instance fields of an object (properties of the associated objects)

- includes definitions for all of the instance methods associated with an object (the "actions" that
can be taken by the associated objects)

What is trash? correct answers Me: Miley at the VMAs
Me: Stop shaming her!
Me: But it's true!
Me: You don't know what she's been through! LEAVE MILEY ALONE
Me: Plz get some tea and stop being crazy

What are objects in regards to a class? correct answers a specific instance of a class (use it in
another class by calling it by its name); an actual/realized version of a class (In a non-
programming context, you could think of "dog" as a class and your particular dog as an instance
of that class) ---> (think of a class as your formal parameter and your object as your actual
argument)

What do instance fields/variables define? correct answers - properties of the associated objects

What do instance methods define? correct answers The actions that can be taken by the
associated object

What is a constructor? correct answers - used to construct and initialize objects from the class
- special methods that are called when you create an object

Does a constructor have a return type? Why or why not? correct answers No, because you are
creating an object from a class (the equivalent of creating an array); you don't need to put "void"
because Java already knows that a constructor will not return anything

How does Java know a method is a constructor? correct answers They MUST share the same
name as their class

Can you use method overloading with constructors? correct answers Yes (very common)

Can you declare a class without a constructor? correct answers Yes

What happens when you DON'T declare a constructor? correct answers A no-argument (no
parameter) default constructor with an empty body (one that doesn't do much) gets IMPLICITLY
declared in the class

What does a main method tell the Java Virtual Machine? correct answers - when to start
executing code

Why do coders like to write a main method when you're dealing with objects? correct answers
To test a class and make sure it does what it claims it does

What does it mean to declare a reference variable of an object? correct answers To declare an
instance of the Circle class (or really to declare the object variable)

Document information

Uploaded on
March 25, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
SirAnton
3.7
(118)
Sold
811
Followers
438
Items
40316
Last sold
1 week ago




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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions