• 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 7 pages
Exam (elaborations)

Data Structures Exam 1 Questions & Answers

Document preview thumbnail
Preview 2 out of 7 pages

DATA STRUCTURES EXAM 1 QUESTIONS & ANSWERS

Content preview

DATA STRUCTURES: EXAM 1
QUESTIONS & ANSWERS

Classes - Correct Answers -Blueprints for our data, structure allows for encapsulation of
data and operations of new type together.

Data Abstraction - Correct Answers -Concept that says the user of the class knows the
nature of the data and the public methods, but not the implementation details.

Protected - Correct Answers -Declaration keyword that means data is only accessible
within a class and subclass within the same package.

Static - Correct Answers -Declaration keyword that means the data or method is part of
the class rather than instance; shared by all instances.

Final - Correct Answers -Declaration keyword that means the data cannot be assigned
(variables), overridden (methods) or subclassed (classes).

Dynamically - Correct Answers -All objects in Java are allocated ______. Memory is
allocated using the new operator. Once allocated, objects exist for an indefinite period
of time.

Composition - Correct Answers -Method by which we build new classes using
components (instance variables) that are from previously defined classes. "Has a"
relationship between new class and old classes.

Inheritance - Correct Answers -Method by which we build a new class(subclass) by
extending a previously defined class (superclass). Subclass has all the properties (data
and methods) defined in the superclass.
"is a" relationship between the subclass and superclass.
Subclass is a superclass, and subclass objects can be assigned to superclass
variables.
Foo f1;
SubFoo;
f1=new Foo //fine
f1=new subFoo//fine
f1.subfoometh //NO!
-need to cast
s1=new subFoo/ fine
s1.subfoomethod//fine
s1.foomethod//fine

, s1=new Foo() illegal

Polymorphism - Correct Answers -Concept implemented through method overriding and
dynamic (or late) binding. Allows for access collections of mixed data types consistently.

Method overriding - Correct Answers -Polymorphism idea that involves:
A method defined in a superclass is redefined in a subclass with an identical method
signature.
Since the signatures are identical, rather than overloading the method (ad hoc
polymorphism), it is instead overring the method.
(superclass version can still be accessed via the super reference).

Ad Hoc polymorphism - Correct Answers -Overloading method signatures but keeping
the method title the same

Dynamic or late binding - Correct Answers -Polymorphism idea that includes:
Code executed for a method call is associated with the call during RUN-TIME
The actual method executed is determined by the TYPE of the object, not the type of
reference

Abstract classes - Correct Answers -A class that is like an interface but comes with
partial implementation. No objects of the class will ever be defined. But the instance
data and methods will still be inherited by all subclasses.

Interfaces - Correct Answers -A named set of methods with no instance data. Used as a
contract.
No static constants are allowed or instance data.
Instance methods have no bodies and not interfaces will be instantiated.
A given class can implement multiple interfaces.
ONLY INTERFACE METHODS ARE ACCESSIBLE THROUGH THE INTERFACE
REFERENCE

Abstract Data Types - Correct Answers -Data types that require only understanding the
nature of the data without a need for knowing how it is implemented.
Functionality is separated from its implementation.
Classes are the language specific implementations of ADTs

Bags - Correct Answers -ADT that has:
no rule for how many items to put in
no rule for order
duplicates can happen
number of items is tracked.

Recursion - Correct Answers -Idea:
Some problem P is defined in terms of one or more subP problems, which are identical
in nature to P but smaller in size

Document information

Uploaded on
March 26, 2026
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

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.
millyphilip
3.7
(560)
Sold
2991
Followers
1963
Items
46798
Last sold
4 days 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