Web Services Development MCQs with Answers
Practice important Web Services Development MCQs with answers and explanations.
Multiple Choice Questions
Q111: Which method is used to compare the content of two strings in Java?
- A: compareTo()
- B: equals()
- C: ==
- D: operator!=
View Answer
B
Q112: What is the result of comparing two strings using the '==' operator?
- A: Compares the string content
- B: Compares the string length
- C: Compares the object references
- D: Compares the ASCII values
View Answer
C
Q113: Which method is used to concatenate two strings in Java?
- A: append()
- B: concat()
- C: join()
- D: add()
View Answer
B
Q114: The compareTo() method in Java returns which data type?
- A: boolean
- B: int
- C: float
- D: char
View Answer
B
Q115: In Java, which operator checks if two object references point to the same instance?
- A: =
- B: ==
- C: !=
- D: <>
View Answer
B
Q116: The 'charAt()' method in Java returns the character at which of the following?
- A: Starting index
- B: Ending index
- C: Specified index
- D: Any index
View Answer
C
Q117: The 'length()' method in Java returns what?
- A: The number of bytes
- B: The number of characters
- C: The memory size
- D: The length in pixels
View Answer
B
Q118: Which of the following creates a new String object in Java?
- A: String str = "Hello";
- B: String str = Hello;
- C: String str = new "Hello";
- D: String str = new String("Hello");
View Answer
D
Q119: When a new String is created using a literal, it is stored where?
- A: Heap memory
- B: Stack memory
- C: String pool
- D: Temporary memory
View Answer
C
Q120: The String class in Java uses which character set?
- A: ASCII
- B: ISO-8859-1
- C: UTF-8
- D: Unicode
View Answer
D