Question: 1. Interface [answer] describes methods for writing primitive types to an output stream. 2. Adding the services of one stream to another is known as

1. Interface [answer] describes methods for writing primitive types to an output stream.

2. Adding the services of one stream to another is known as ________.

a. Adding

b. Wrapping

c. Sequencing

d. chaining

3.

Which expression(s) are an exact match to the regular expression p*pkk*kk*?

Choose Yes or No for each string of characters

ppp ( y or n)

kkkkk (y or n)

pk (y or n)

pkk (y or n)

ppkk ( y or n)

4. Assume the following statement:

String question = "What is the sound of one hand clapping?";

Executing the statements below with result in which values for i and j?

String i = question.substring (8); String j = question.substring(26);

a. i=sound of one hand clapping? and j=hand clapping?

b. i=the sound of one hand clapping? and j=and clapping?

c. i=the sound of one hand clapping and j=hand clapping

d. i=he sound of one hand clapping? and j=nd clapping?

5. Assume that a character named chArray has been initialized with 20 characters. Which statement is a valid call to a String constructor?

a. Byte arrays

b. new String = charArray[020];

c. String s = charArray[5, 10];

d. String s = new String (charArray, 5, 10);

6. What happens if a newly specified length of a StringBuilder object is greater than the number of characters currently in the object?

a. A new StringBuilder object is created with the specified length.

b. Null characters are added until the specified length is reached

c. An out of bounds exception is thrown

d. The length of the StringBuilder object remains as is

7. The variable name stores names as last name and first name separated by a comma. For example: Jones, Sharon

Complete the code to store the first name and last name in separate variables and then print a line with first name and last name separated by a space. Assume all variables are declared and initialized.

commaPosition = name.indexOf(); lastName = name.substring(, ); firstName = name.substring(commaPosition + , name.length()); System.out.println();

8. Assume three String variables named student1, student2, and student3 that have been initialized with students last names. A Stringvariable first has also been declared.

Complete the code fragment that will result in first containing the student last name that is first alphabetically.

first = student1; if(student2.compareTo(first) > 0) { } if(student3.compareTo( > 0) { }

9.

Suppose you have declared a String object Happy. Sadly, you know that youll never be able to _____ Happy because it is ______.

a. Clone; dynamic

b. Instantiate; inherited

c. Modify; immutable

d. Display; private

10. What is one valid way to declare and initialize a StringBuilder object buf with the value Spring has Sprung!

str = Spring has sprung!;

buf = new StringBuilder(str.copy);

buf = new StringBuilder();

str = Spring has sprung!;

buf = new StringBuilder(str 32);

buf = new StringBuilder(Spring has sprung!);

11. What will be the value of the variable display after the code below executes?

String basics = "abc_123"; String display = "";

for (int i = basics.length() - 1; i >= 0; i--) display += basics.charAt(i) + " ";

a. abc_123

b. abc

c. 321_cba

d. 321_

12. A(n) ________ path starts from the directory in which the application began executing.

a. Parallel

b. Absolute

c. Comparative

d. Relative

13. Class ________ provides static methods for common file and directory manipulations, including methods for copying files; creating and deleting files and directories; getting information about files and directories; reading the contents of files; getting objects that allow you to manipulate the contents of files and directories; and more.

a. FilesAndDirectories

b. File

c. FileAndDirectory

d. Files

14. Assume that symbol is a char variable has been declared and already given a value. Write an expression whose value is true if and only if symbol is alphanumeric, that is either a letter or a decimal digit.

(symbol choose answer<<===>>=&&|| 'A' choose answer<<===>>=&&|| symbol choose answer<<===>>=&&|| 'Z') choose answer<<===>>=&&|| (symbol choose answer<<===>>=&&|| 'a' choose answer<<===>>=&&|| symbol choose answer<<===>>=&&|| 'z') || (symbol choose answer<<===>>=&&||'0' choose answer<<===>>=&&|| symbol choose answer<<===>>=&&|| '9')

15. Assume the following declaration:

String major = cybersecurity;

The statements:

Int i = major.indexOf(y);

Int j = major.lastIndexOf(r);

Will result in which values for i and j?

a. i=1 and j=9

b. i=2 and j=16

c. i=4 and j=16

d. i=2 and j=10

16. The fundamental building blocks of Java source programs are ______.

a. integers

b. characters

c. strings

d. objects

17. StringBuilder objects should be used in place of String objects when the _____.

a. Date values are constants

b. String size may grow

c. Memory is an issue

d. Data is static

18. The ________ abstract classes are Unicode character-based streams.

a. Unicode and UnicodeWrite

b. CharArrayReader and CharArrayWriter

c. BufferedReader and BufferedWriter

d. Reader and Writer

19. Which of the following statements is false?

a. The static method get of class Paths converts a String representing a file's or directory's location into a Path object.

b. Path objects open files and provide file-processing capabilities

c. Class Path is used to get a Path object representing a file or directory location

d. A Path represents the location of a file or directory

20. Which of the following statements is false?

a. Character-based input and output can be performed with classes Scanner and Formatter

b. Every file or directory on a disk drive has he same root directory in its path

c. A relative path contains all the directories, starting with the root directory, that lead to a specific file or directory

d. A DirectoryStream enables a program to iterate through the contents of a directory

21. What interface must a class implement to indicate that objects of the class can be output and input as a stream of bytes?

a. Deserialization

b. Synchronize

c. Serializable

d. ObjectOutput

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!