Search Header Logo

String in Java

Authored by KarunaiMuthu SriRam

Computers

University

Used 18+ times

String in Java
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

There is a companion class to string called ………………….., whose objects contain strings that can be modified after they are created.

stringBuffer

stringClass

toString( )

stringChar

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Consider the following code,

string s=new String(); will create an instance of string with

at least one character

a default character

no characters in it

number of characters in it

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

…………………. returns a sting that contains the human-readable equivalent of the value with which it is called.

toValue()

value()

valueOf()

getValue()

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

…………………… method simply return a string that appropriately describes an object of your class.

getChars()

toString()

toCharArray()

getString()

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

To extract a single character from a sting, you can refer directly to an individual character via the …………………… method.

charAt()

getChars()

getCharAt()

getAt()

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

If you need to extract more than one character at a time, you can use the …………………………. .

getBytes()

charAt()

getChars()

getString()

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

If S1 and S2 are two strings, which of the following statements or expressions are correct.

i) String S3=S1+S2;

ii) String S3=S1-S2;

iii) S1<=S2;

iv) S1.compareTo(S2);

i and ii only

ii and iii only

ii and iv only

i and iv only

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers