Unit 5

Unit 5

University

10 Qs

quiz-placeholder

Similar activities

HTML, JAVASCRIPT,XML

HTML, JAVASCRIPT,XML

University

12 Qs

OOP

OOP

University

13 Qs

C Program Array and strings

C Program Array and strings

University

10 Qs

OOP - Java Classes

OOP - Java Classes

12th Grade - University

15 Qs

Java Quiz2

Java Quiz2

University

11 Qs

Array Java

Array Java

University

15 Qs

Java : Array

Java : Array

University

10 Qs

OOP - Quiz

OOP - Quiz

University

15 Qs

Unit 5

Unit 5

Assessment

Quiz

Computers

University

Medium

Created by

Mr. V

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. In Java, which class is used to represent a sequence of characters?

  1. CharArray

  1. StringArray

  1. String

  1. CharSequence

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. Strings in Java are:

  1. Mutable

  1. Immutable

  1. Both mutable and immutable

  1. None of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. What happens when you concatenate two strings using the "+" operator in Java?

  1. The original strings are modified

  1. A new string object is created with the concatenated value

  1. The "+" operator cannot be used with strings

  1. An exception is thrown

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. Which method is used to compare two strings for equality in Java?

  1. compare()

  1. equals()

  1. isEqual()

  1. compareTo()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. What is the result of the following code?

String str1 = "Hello";

String str2 = "hello";

System.out.println(str1.equals(str2));

true

false

The code will not compile

An exception will be thrown

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. The method length() in the String class returns:

  1. The number of characters in the string

  1. The number of words in the string

  1. The size of the string in bytes

  1. The capacity of the string

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. Which method is used to convert all characters in a string to lowercase?

  1. toLowerCase()

  1. convertToLower()

  1. changeCase()

  1. lowerCase()

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?