Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Data Structures Exam Questions and Answers

Rating
-
Sold
-
Pages
8
Grade
A+
Uploaded on
29-07-2025
Written in
2024/2025

Data Structures Exam Questions and Answers data structure - Answer- a collection of data organized in some fashion data structure - Answer- supports for accessing and manipulating the data data structure - Answer- an object that stores other objects, referred to as data or elements True or False to define a data structure is to essentially define a class - Answer- True To create a list to store integers, use A. ArrayListObject list = new ArrayList(); B. ArrayListInteger list = new ArrayList(); C. ArrayListint list = new ArrayListint(); D. ArrayListNumber list = new ArrayList(); - Answer- B. ArrayListInteger list = new ArrayList(); Suppose ListString list = new ArrayListString(). Which of the following operations are correct? (new Integer(100)); (new ArrayList()); ("Red"); (new .Date()); - Answer- ("Red"); Which of the following is a correct statement to sort the elements in a list called lst ? C(lst) A(lst) new LinkedList(new String[]{"red", "green", "blue"}) () - Answer- C(lst) Given the following statement, what is the best way to find a maximum object in an array of strings ? String[] names = {"red", "green", "blue"}) C(names) A(names) C(AList(names)) A(names) - Answer- C(AList(names)) True or False: A recursive call can result in many more recursive calls, because the method keeps on dividing a subproblem into new subproblems. - Answer- True Which of the following statements are characteristics of recursive methods ? The method is implemented using an if-else or a switch statement that leads to different cases.

Show more Read less
Institution
Data Structures Dsa
Course
Data structures dsa

Content preview

data structure - Answer- a collection of data organized in some fashion

data structure - Answer- supports for accessing and manipulating the data

data structure - Answer- an object that stores other objects, referred to as data or
elements

True or False to define a data structure is to essentially define a class - Answer-
True

To create a list to store integers, use
A. ArrayList<Object> list = new ArrayList<>();
B. ArrayList<Integer> list = new ArrayList<>();
C. ArrayList<int> list = new ArrayList<int>();
D. ArrayList<Number> list = new ArrayList<>(); - Answer- B. ArrayList<Integer> list
= new ArrayList<>();

Suppose List<String> list = new ArrayList<String>().
Which of the following operations are correct?
ist.add(new Integer(100));
list.add(new ArrayList());
list.add("Red");
list.add(new java.util.Date()); - Answer- list.add("Red");

Which of the following is a correct statement to sort the elements in a list called lst ?
Collections.sort(lst)
Arrays.sort(lst)
new LinkedList(new String[]{"red", "green", "blue"})
lst.sort() - Answer- Collections.sort(lst)

Given the following statement, what is the best way to find a maximum object in an
array of strings ?
String[] names = {"red", "green", "blue"})
Collections.max(names)
Arrays.max(names)
Collections.max(Arrays.asList(names))
Arrays.sort(names) - Answer- Collections.max(Arrays.asList(names))

True or False: A recursive call can result in many more recursive calls, because the
method keeps on dividing a subproblem into new subproblems. - Answer- True

Which of the following statements are characteristics of recursive methods ?
The method is implemented using an if-else or a switch statement that leads to
different cases.

, One or more base cases (the simplest case) are used to stop recursion.
Every recursive call reduces the original problem, bringing it increasingly closer to a
base case until it becomes that case.
All of these are characteristics of a recursive method - Answer- All of these are
characteristics of a recursive methods

True or False: Any problem that can be solved recursively can be solved non
recursively with iterations. - Answer- True

Recursive methods need _____________ time and memory to execute than non
recursive methods. - Answer- more

True or False: Any recursive method can be converted into a non recursive method.
- Answer- True

Recursive programs can run out of memory, causing a _________
logic error
syntax error
end of file error
stack overflow error - Answer- Stack flow error

_________________ occurs when method 1 invokes method 2, which in turn
invokes method 1 - Answer- Indirect recursion

What lets you parameterize types? - Answer- Generics

True or False: The motivation for using Java generics is to detect errors at compile
time. - Answer- True

True or False: A generic type can be defined for a class or interface. A concrete type
must be specified when using the class to create an object or using the class or
interface to declare a reference variable. - Answer- True

To declare a generic method, you place the _________________ immediately after
the keyword static in the method header.
instances
generic type <E>
actual type
subtype - Answer- generic type <E>

True or False: A generic type can be defined for a static method. - Answer- True

You can use _________________ wildcards, bounded wildcards, or lower-bound
wildcards to specify a range for a generic type. - Answer- Unbounded

The information on generics is used by the compiler but is not available at runtime. -
Answer- type erasure

Written for

Institution
Data structures dsa
Course
Data structures dsa

Document information

Uploaded on
July 29, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$15.99
Get access to the full document:

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

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.
Freshy Oxford University
Follow You need to be logged in order to follow users or courses
Sold
60
Member since
2 year
Number of followers
4
Documents
6987
Last sold
1 week ago

3.6

10 reviews

5
3
4
4
3
1
2
0
1
2

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

Working on your references?

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

Working on your references?

Frequently asked questions