Programming - Strings
You Are Here :: Home > JAVA > Strings - General Questions
1.
The Java platform provides the __________ class to create and manipulate strings.
A.
Character
B.
String
C.
integer
D.
float
Answer: Option B
Explanation:
The Java platform provides the String class to create and manipulate strings.
2.
The String class has thirteen constructors that allow you to provide the initial value of the string using different sources, such as an _________.
A.
arrays
B.
characters
C.
array of characters
D.
strings
Answer: Option C
Explanation:
The String class has thirteen constructors that allow you to provide the initial value of the string using different sources, such as an array of characters
3.
The String class is immutable.
A.
immutable
B.
mutable
C.
both a and b
D.
all the above
Answer: Option A
Explanation:
The String class is immutable, so that once it is created a String object cannot be changed.
4.
Methods used to obtain information about an object are known as __________________.
A.
methods
B.
accessor methods
C.
both a and b
D.
none
Answer: Option B
Explanation:
Methods used to obtain information about an object are known as accessor methods.
5.
One accessor method that you can use with strings is the ___________ method.
A.
strcpy()
B.
strcmp()
C.
length()
D.
all the above
Answer: Option C
Explanation:
One accessor method that you can use with strings is the length() method, which returns the number of characters contained in the string object.
6.
The String class includes a method for concatenating two strings:
A.
string1.concat(string2);
B.
string1.copy(string2);
C.
both a and b
D.
none
Answer: Option A
Explanation:
The String class includes a method for concatenating two strings string1.concat(string2);
next »