• 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 3 out of 18 pages
Exam (elaborations)

INSY 4305 Final UPDATED ACTUAL Exam Questions and CORRECT Answers

Document preview thumbnail
Preview 3 out of 18 pages

INSY 4305 Final UPDATED ACTUAL Exam Questions and CORRECT Answers 1. Streams that input bytes from and output bytes to files are known as ________. a. bit-based streams b. byte-based streams c. character-based streams d. Unicode-based streams - CORRECT ANSWER 2. Which of the following statements is false? a. A Path represents the location of a file or directory. - b. byte-based stream

Content preview

INSY 4305 Final UPDATED ACTUAL
Exam Questions and CORRECT Answers
1. Streams that input bytes from and output bytes to files are known as ________.
a. bit-based streams
b. byte-based streams
c. character-based streams

d. Unicode-based streams - CORRECT ANSWER - b. byte-based streams


2. Which of the following statements is false?
a. A Path represents the location of a file or directory.
b. Path objects open files and provide file-processing capabilities.
c. Class Paths is used to get a Path object representing a file or directory location.
d. The static method get of class Paths converts a String representing a file's or directory's
location into a Path object - CORRECT ANSWER - b. Path objects open files and provide
file-processing capabilities.


3. A(n) ________ path starts from the directory in which the application began executing.
a. absolute
b. relative
c. parallel

d. comparative - CORRECT ANSWER - b. relative


4. Path method ________ returns the String name of a file or directory without any location
information.
a. getStringName
b. getFileOrDirectoryName
c. getDirectoryName

d. getFileName - CORRECT ANSWER - d. getFileName

,5. Files static method ________ receives a Path and returns a boolean indicating whether that
Path represents a directory on disk.
a. isDiskDirectory
b. isDirectory
c. isFileDirectory

d. isPath - CORRECT ANSWER - b. isDirectory


6. What does the following statement do?

Scanner scanner = new Scanner(Paths.get("test.txt")); - CORRECT ANSWER - c. Opens a
text file for input.


7. String objects are immutable. This means they ________. - CORRECT ANSWER - c.
cannot be changed


8. The length of a string can be determined by ________.
a. the String method length()
b. the String instance variable length
c. the String method strlen()

d. All of the above. - CORRECT ANSWER - a. the String method length()


9. The statement
s1.equalsIgnoreCase(s4)
is equivalent to which of the following?
a. s1.regionMatches(true, 0, s4, 0, s4.length());
b. s1.regionMatches(0, s4, 0, s4.length());
c. s1.regionMatches(0, s4, 0, s4.length);

d. s1.regionMatches(true, s4, 0, s4.length); - CORRECT ANSWER - a.
s1.regionMatches(true, 0, s4, 0, s4.length());

, 10. The statement
s1.startsWith("art")
has the same result as which of the following?
a. s1.regionMatches(0, "art", 0, 3);
b. s2 = s1.getChars(0, 3);
s2.equals("art");
c. s1.regionMatches(true, 0, "art", 0, 3);

d. All of the above - CORRECT ANSWER - d. All of the above


11. For
String c = "hello world";
The Java statements
int i = c.indexOf('o');
int j = c.lastIndexOf('l');

will result in: - CORRECT ANSWER - c. i = 4 and j = 9.


12. Given the following declaration:
StringBuilder buf = new StringBuilder();
What is the capacity of buf?
a. 0
b. 10
c. 16

d. 20 - CORRECT ANSWER - c. 16


13. Given the following declarations:
StringBuilder buffer = new StringBuilder("Testing Testing");
buffer.setLength(7);

Document information

Uploaded on
September 6, 2025
Number of pages
18
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.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.
STANFORDGRADESS
4.0
(239)
Sold
1606
Followers
108
Items
115164
Last sold
3 hours 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