Search Header Logo

JAVA - Day2

Authored by Chitra Muthu

Information Technology (IT)

University

Used 1+ times

JAVA - Day2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following is immutable in Java?

String

StringBuffer

StringBuilder

Both B and C

2.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What will be the output of the following code?
String s1 = "Hello";

String s2 = "Hello";

System.out.println(s1 == s2);

true

false

Compilation error

Runtime error

3.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following is used to create a mutable string in Java?

String

StringBuffer

StringBuilder

Both B and C

4.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which method is used to get the length of a string?

size()

length()

getSize()

getLength()

5.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following is thread-safe?

String

StringBuffer

StringBuilder

Both A and B

6.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What will be the output of the following code?
String s = "Java";

s.concat("Programming");

System.out.println(s);

JavaProgramming

Java

Compilation Error

Runtime Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following class provides fast and efficient string modification?

String

StringBuffer

StringBuilder

Both B and C

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?