Chapter 7

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The creators of Java chose ____ characters as the "extra" length for a StringBuilder object. a. 12 b. 16 c. 36 d. 48

16

To convert a String to an integer, you use the ____ class, which is part of java.lang and is automatically imported into programs you write. a. StringBuilder b. Integer c. Convert d. String

Integer

You can tell that the equals() method takes a ____ argument because parentheses are used in the method call. a. Null b. String c. Boolean d. Double

String

Which of the following correctly declares and initializes a String object? a. new String = Hello b. String greeting = "Hello"; c. String new = "Hello" d. String greeting == "Hello";

String greeting = "Hello";

A ____ is a class for storing and manipulating changeable data that is composed of multiple characters. a. String b. Character c. StringBuilder d. StringVariable

StringBuilder

A literal string is a(n) ____ object. a. named b. anonymous c. class d. lost

anonymous

A StringBuilder object contains a memory block called a _____, which might or might not contain a string. a. capacity b. reference c. buffer d. thread

buffer

When the String class ____ method is used to compare two Strings, it provides additional information to the user in the form of an integer value. a. compareTo() b. toString() c. equalsIgnoreCase() d. equals()

compareTo()

System.out.println("Your name is " + yourName); The above statement is an example of ____, which is used to join Strings. a. parsing b. buffering c. referencing d. concatenation

concatenation

The String class ____ method evaluates the contents of two String objects to determine if they are equivalent. a. charAt() b. toString() c. equals() d. replace()

equals()

Strings and other objects that can't be changed are known as ____. a. immutable b. garbage c. accessor methods d. string constants

immutable

The Character class ____ from java.lang.Object. a. calls b. inherits c. spawns d. refers

inherits

The ____ method lets you add characters at a specific location within a StringBuilder object. a. insert() b. charAt() c. append() d. setCharAt()

insert()

The ____ method returns the length of a String. a. size() b. length() c. getSize() d. getLength()

length()

A(n) ____ comparison is based on the integer Unicode values of the characters. a. lexicographical b. symbol c. character d. integer

lexicographical

String oneStr = "Welcome Jim" String twoStr = "Welcome Joe" Given the lines of code above, which of the following regionMatches() expressions will result in a value of true? a. oneStr.regionMatches(0, twoStr, 8, 3) b. oneStr.regionMatches(8, twoStr, 8, 3) c. oneStr.regionMatches(8, twoStr, 0, 3) d. oneStr.regionMatches(0, twoStr, 0, 7)

oneStr.regionMatches(0, twoStr, 0, 7)

The ____ method takes a String argument and returns its double value. a. parseDouble() b. returnDouble() c. parseInt() d. parseString()

parseDouble()

The method header of the equals() method within the String class is ____. a. public boolean equals(Strings) b. public boolean equals(String s) c. private boolean equals(String s) d. public boolean equals(Character s)

public boolean equals(String s)

A(n) ____ is a variable that holds a memory address. a. Character b. buffer c. reference d. immutable

reference

The ____ method allows you to replace all occurrences of some character within a String. a. replace() b. substring() c. replaceCharacter() d. toString()

replace()

To alter just one character in a StringBuilder, you can use the ____ method, which allows you to change a character at a specified position within a StringBuilder object. a. append() b. insert() c. setCharAt() d. charAt()

setCharAt()

The methods of the Character class that begin with ____ return a character that has been converted to the stated format. a. in b. to c. for d. is

to

The ____ method converts any object to a String. a. substring() b. replace() c. convertString() d. toString()

toString()

When you declare a variable of a basic, primitive type, such as int x = 10;, the memory address where x is located holds the ____. a. reference to 10 b. value of 10 c. location in memory of 10 d. memory address of 10

value of 10

Besides Double and Integer, other wrapper classes such as Float and Long also provide ____ methods that convert Strings to the wrapper types. a. parseDouble() b. parseString() c. toWrapper() d. valueOf()

valueOf()


संबंधित स्टडी सेट्स

PSYC 167: CH 9 & 10 Intellectual and neuropsychological assessment / Personality Assessment and Behavioral Assessment

View Set