StringsPage-8 Section-1
StringsPage-8 Section-1
StringsPage-8 Section-1
(https://www.examveda.com/) Login
(https://www.exam
url=https%3A%2F%
program%2Fpract
mcq-question-
on-
strings%2F%3Fpa
DI (https://www.examveda.com/mcq-question-on-data-interpretation/) GK (https://www.examveda.com/mcq-question-on-general-knowledge/)
Section 1 (https://www.examveda.com/java-program/practice-mcq-question-on-strings/?section=1)
Section 2 (https://www.examveda.com/java-program/practice-mcq-question-on-strings/?section=2)
StringBuffer s1 = "one";
StringBuffer s2 = s1.append("two")
A. one
B. two
C. onetwo
D. twoone
Answer: Option C
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/what-will-s2-contain-after-
following-lines-of-java-code-221660/)
Powered By (https://vdo.ai/contact?
utm_medium=video&utm_term=examveda.com&utm_source=vdoai_logo)
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 1/7
11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1
72. Which of this method of class StringBuffer is used to concatenate the string representation to the
end of invoking string?
A. concat()
B. append()
C. join()
D. concatenate()
Answer: Option B
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/which-of-this-method-of-class-
stringbuffer-is-used-to-concatenate-the-string-representation-to-the-end-of-invoking-string-221661/)
73. What is the value returned by function compareTo() if the invoking string is less than the string
compared?
A. zero
Answer: Option B
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 2/7
11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1
74. What is the value returned by function compareTo() if the invoking string is greater than the string
compared?
A. zero
Answer: Option C
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/what-is-the-value-returned-by-
function-compareto-if-the-invoking-string-is-greater-than-the-string-compared-221663/)
class String_demo
{
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}
A. a
B. b
C. c
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 3/7
11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1
D. abc
Answer: Option D
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/what-will-be-the-output-of-the-
following-java-program-221664/)
76. Which of this method of class StringBuffer is used to get the length of the sequence of characters?
A. length()
B. capacity()
C. Length()
D. Capacity()
Answer: Option A
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/which-of-this-method-of-class-
stringbuffer-is-used-to-get-the-length-of-the-sequence-of-characters-221665/)
77. Which of these method of class String is used to extract a single character from a String object?
A. CHARAT()
B. chatat()
C. charAt()
D. ChatAt()
Answer & Solution
Answer: Option C
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 4/7
11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1
class output
{
public static void main(String args[])
{
String s1 = "one";
String s2 = s1 + " two";
System.out.println(s2);
}
}
A. one
B. two
C. one two
D. compilation error
Answer: Option C
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/what-will-be-the-output-of-the-
following-java-program-221667/)
79. Which of this method of class String is used to extract a substring from a String object?
A. substring()
B. Substring()
C. SubString()
Answer & Solution
Answer: Option A
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 5/7
11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1
80. Which of these method of class String is used to extract more than one character at a time a String
object?
A. getchars()
B. GetChars()
C. Getchars()
D. getChars()
Answer: Option D
No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/which-of-these-method-of-
class-string-is-used-to-extract-more-than-one-character-at-a-time-a-string-object-221669/)
(https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=7)
1 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/)
2 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=2)
3 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=3)
4 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=4)
5 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=5)
6 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=6)
7 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=7) 8
9 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=9)
10 (https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=10)
(https://www.examveda.com:443/java-program/practice-mcq-question-on-strings/?page=9)
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 6/7
11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1
Each Section contains maximum 100 MCQs question on Strings. To get more questions visit other sections.
(https://www.tw
(https://ww
(http
Contact Us (https://www.examveda.com/contact-us/)
https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 7/7