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
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

CSCI 2010 FINAL QUIZ 6 – 10 QUESTIONS AND VERIFIED ANSWERS

Document preview thumbnail
Preview 2 out of 5 pages

CSCI 2010 FINAL QUIZ 6 – 10 QUESTIONS AND VERIFIED ANSWERS

Content preview

CSCI 2010 FINAL QUIZ 6 – 10 QUESTIONS AND
VERIFIED ANSWERS



The merger sort algorithm contains only one recursive call. - Answers - False

Which of the following best describes the merge sort algorithm? - Answers - The array
is split in half, the two halves are sorted recursively, then the two halves are combined
to put in all items in the correct order.

What is a recursive method? - Answers - A method that calls itself.

Which of the following is NOT required for the correct implementation of a recursive
method? - Answers - Only one branch may contain a recursive call.

Java treats a recursive method call differently from an ordinary method call - Answers -
False

What is the output of the following code?
public static void main(String[] args)
{
System.out.println(getMysteryValue(3));
}
pubic static int getMysteryValue(int n)
{
if (n <= 1)return 1;
else
return getMysteryValue(n - 1) + n;
} - Answers - 6

Which of the following best describes the binary search algorithm? - Answers - A sorted
array is searched starting in the middle. If the middle element is smaller than the search
item, the right half is searched recursively. If the middle element is larger than the
search item, the left half is searched recursively. The search continues until the search
item is found or no items are left.

For large arrays, binary search is much faster than sequential search. - Answers - True

A recursive method must contain a base case, otherwise it will not terminate. - Answers
- True

When does a stack overflow occur? - Answers - When the data structure used to keep
track of recursive calls becomes to large to be stored in available memory.

, Given an sorted array containing the following numbers: 1 3 7 10 12 17 19, what
numbers are compared with the search item by a binary search for the number 12 -
Answers - 10, 17, 12

Which of the following best describes the steps taken by the merge sort algorithm when
sorting the array containing the following numbers: 4 3 2 1. - Answers - 4 3 2 1
3421
3412
1234

QUIZ 7 - Answers -

Which Java class is the preferred class to use for reading from a text file? - Answers -
Scanner

What is the difference between an input stream and an output stream? - Answers - An
input stream reads data from a file or console and sends it to a program. An output
stream takes data from a program and writes it to a file or console.

What is the difference between a full path name and a relative path name? - Answers -
A full path name starts at the root directory while a relative path name starts at the
directory in which the program is running.

What is the difference between a text file and a binary file? - Answers - A text file stores
a sequence of characters while a binary file uses some other encoding of data.

Data in a file remains after program execution ends. - Answers - True

Which Java class is the preferred class to use for writing to a text file? - Answers -
PrintWriter

Which of the following statements open s a text file called "myfile.txt" so that new text
can be appended to the existing contents of file? - Answers - outputStream = new
PrintWriter(new FileOutputStream("myfile.txt", true));

A statement opening a text file for reading or writing may generate a
FileNotFoundException - Answers - True

Which of the following is not a method of the File class? - Answers - close()

Which of the following is the correct way to open a text file called "myfile.txt" for
reading? - Answers - inputStream = new Scanner(new File("myfile.txt"));

A comma-separated values for CSV file is a simple text format used to store a list of
record. - Answers - True

Document information

Uploaded on
June 10, 2026
Number of pages
5
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.
GEEKA
3.8
(361)
Sold
2138
Followers
1448
Items
58688
Last sold
1 day 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