StringsPage-8 Section-1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

11/21/24, 12:57 PM Strings -Java Programming MCQ Questions and Answers Page-8 section-1

(https://www.examveda.com/)  Login
(https://www.exam
url=https%3A%2F%
program%2Fpract
mcq-question-
on-
strings%2F%3Fpa

Home (https://www.examveda.com/) Aptitude (https://www.examveda.com/mcq-question-on-arithmetic-ability/)

English (https://www.examveda.com/mcq-question-on-competitive-english/) Reasoning 

DI (https://www.examveda.com/mcq-question-on-data-interpretation/) GK (https://www.examveda.com/mcq-question-on-general-knowledge/)

Current Affairs (https://www.examveda.com/daily-current-affairs/) Interview (https://www.examveda.com/interview/) Engineering 

Computer  Programming  Subject  Ask Question (https://www.examveda.com/ask-question/)

Strings -Java Programming MCQ Questions and Answers


Home (https://www.examveda.com/) / Java Program (https://www.examveda.com/mcq-question-on-java-program/) / Strings

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)

71. What will s2 contain after following lines of Java code?

StringBuffer s1 = "one";
StringBuffer s2 = s1.append("two")

A. one

B. two

C. onetwo

D. twoone

Answer & Solution Discuss in Board (https://www.examveda.com/what-will-s2-contain-after-following-lines-of-java-code-221660/) Save for Later

Answer & Solution

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 & Solution

Discuss in 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/)

Save for Later

Answer & Solution

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

B. value less than zero

C. value greater than zero

D. none of the mentioned

Answer & Solution Discuss in Board (https://www.examveda.com/what-is-the-value-returned-by-function-compareto-if-the-invoking-string-is-less-than-the-string-compared-221662/)

Save for Later

Answer & Solution

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

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-less-than-the-string-compared-221662/)

74. What is the value returned by function compareTo() if the invoking string is greater than the string
compared?

A. zero

B. value less than zero

C. value greater than zero

D. none of the mentioned

Answer & Solution Discuss in Board (https://www.examveda.com/what-is-the-value-returned-by-function-compareto-if-the-invoking-string-is-greater-than-the-string-compared-221663/)

Save for Later

Answer & Solution

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/)

75. What will be the output of the following Java program?

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 & Solution Discuss in Board (https://www.examveda.com/what-will-be-the-output-of-the-following-java-program-221664/) Save for Later

Answer & Solution

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 & Solution Discuss in Board (https://www.examveda.com/which-of-this-method-of-class-stringbuffer-is-used-to-get-the-length-of-the-sequence-of-characters-221665/)

Save for Later

Answer & Solution

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 Discuss in Board (https://www.examveda.com/which-of-these-method-of-class-string-is-used-to-extract-a-single-character-from-a-string-object-221666/)

Save for Later


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

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-a-single-character-from-a-string-object-221666/)

78. What will be the output of the following Java program?

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 & Solution Discuss in Board (https://www.examveda.com/what-will-be-the-output-of-the-following-java-program-221667/) Save for Later

Answer & Solution

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()

D. None of the mentioned

Answer & Solution Discuss in Board (https://www.examveda.com/which-of-this-method-of-class-string-is-used-to-extract-a-substring-from-a-string-object-221668/) Save for Later


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

No explanation is given for this question Let's Discuss on Board (https://www.examveda.com/which-of-this-method-of-class-


string-is-used-to-extract-a-substring-from-a-string-object-221668/)

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 & Solution Discuss in 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/)

Save for Later

Answer & Solution

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

Read More Section(Strings)

Each Section contains maximum 100 MCQs question on Strings. To get more questions visit other sections.

Strings - Section 2 (https://www.examveda.com/java-program/practice-mcq-question-on-strings/?section=2)

Copyright © 2024 Examveda.com (https://www.examveda.com/)   

(https://www.tw
(https://ww
(http

About Us | (https://www.examveda.com/about/) Terms & Condition | (https://www.examveda.com/terms-and-condition/) Privacy Policy | (https://www.examveda.com/privacy-policy/)

Contact Us (https://www.examveda.com/contact-us/)

https://www.examveda.com/java-program/practice-mcq-question-on-strings/?page=8 7/7

You might also like