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)

JAVA DATA STRUCTURES EXAM QUESTIONS AND ANSWERS

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
28-07-2025
Written in
2024/2025

JAVA DATA STRUCTURES EXAM QUESTIONS AND ANSWERS

Institution
DATA STRUCTURES
Course
DATA STRUCTURES

Content preview

JAVA DATA STRUCTURES EXAM
QUESTIONS AND ANSWERS



In Java, all arguments are passed to methods by value, except for objects and arrays. -
Correct Answers -True

Every Java class is a subclass of either another Java class or the Object class. -
Correct Answers -True

Java allows programmers to perform operations on reference values - Correct Answers
-False

In Java, multiple class inheritance is possible since a new subclass can directly inherit
the attributes (i.e. data and methods) of more than one class, including the Object class.
- Correct Answers -False

Files in Java can grow in size as needed, whereas arrays have a fixed size. - Correct
Answers -True

Which of the following is a precondition for a method that accepts a number n and
computes the nth Fibonacci number? - Correct Answers -n is a positive integer

When you solve a problem by solving two or more smaller problems, each of the
smaller problems must be ______ the base case than the original problem. - Correct
Answers -either farther from or the same "distance" from

A recursive binary search algorithm always reduces the problem size by half at each
recursive call. - Correct Answers -True

A recursive solution can have more than one base case. - Correct Answers -True

Typically, a directly recursive method requires a while or for loop. - Correct Answers -
True

A recursive method always calls itself. - Correct Answers -False

What is the effect of the following recursive Java method, assuming that N is a positive
integer?

, public static int Mystery (int N)
{
if (N > 0)
return 1 + Mystery(N / 10);
else
return 0;
} - Correct Answers -It computes the number of decimal digits in N

In the box trace for a recursive method, a new box (i.e. activation record) is created
each time: - Correct Answers -the method is called

Consider the following Java program. What is output by the program?

public static void main( void )

{

int a, b, result;

a = 3;

b = 4;

result = value( a, b );

System.out.printf("%d\n",result);

}

public static int value( int x, int n )

{

if ( n > 0 )

return x * value( x, n - 1 );

else

return 1;

} - Correct Answers -81

During the specification phase of the life cycle of software, the programmer should
indicate what enhancements to the program are likely in the future. - Correct Answers -
True

Written for

Institution
DATA STRUCTURES
Course
DATA STRUCTURES

Document information

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

Subjects

$12.49
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.
millyphilip West Virginia University
Follow You need to be logged in order to follow users or courses
Sold
2921
Member since
4 year
Number of followers
1958
Documents
44307
Last sold
9 hours ago
white orchid store

EXCELLENCY IN ACCADEMIC MATERIALS ie exams, study guides, testbanks ,case, case study etc

3.6

551 reviews

5
239
4
87
3
104
2
32
1
89

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