Java string MCQ - Set-1

MCQ 1:

Which method splits this string into an array using specified delimiter?

A. codePointAt()
B. contains()
C. charCount()
D. split()
E. startsWith()


MCQ 2:

When converting a given character sequence to its corresponding Unicode value, which Java String class method
would you use for the first such conversion from an instance?

A. codePointAt()
B. contains()
C. charCount()
D. substring()
E. valueOf() (for single characters)


MCQ 3:

Which String method checks if this string starts with a specified sequence of characters without considering case
differences?

A. toCharArray()
B. endsWith()
C. contains()
D. startsWith()
E. substring()


MCQ 4:

To convert all alphabetical letters within an instance into their uppercase forms, which String method would you
use?

A. codePointAt()
B. charCount()
C. toLowerCase()
D. toUpperCase()
E. trim()


MCQ 5:

Which of the following methods creates a new character array representing all characters from this instance string
with no other modifications done on it directly?

A. codePointAt()
B. contains()
C. charCount()
D. toCharArray()
E. trim()
F. substring()


MCQ 6:

This method returns the value of a given String object as its corresponding representation.

A. startsWith()
B. isEmpty()
C. trim()
D. codePointAt()
E. toString()
F. toLowerCase()
G. endsWith()


MCQ 7:

Which method in the String class would you use if your goal was solely converting a given string instance into
its lower case form?

A. contains()
B. startsWith()
C. isEmpty()
D. toLowerCase()
E. endsWith()
F. trim()


MCQ 8:

The following String method would return all Unicode values (code points) for each character in the instance:

A. codePointAt()
B. toUpperCase()
C. contains()
D. substring()
E. toCharArray()
F. isEmpty()


MCQ 9:

Which of these methods would create a new string that represents only part (subsequence) from this instance,
without altering the original?

A. startsWith()
B. toString()
C. valueOf()
D. codePointAt()
E. substring()
F. trim()


MCQ 10:

Which method in Java’s String class converts all characters within a given string into their uppercase equivalents
only if they are already lowercase letters?

A. toUpperCase()
B. contains()
C. charCount()
D. endsWith()
E. substring()
F. trim()