Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 25 (0.75 points) Which method from the String class can be used to divide a string into an array of substrings around a given

Question 25 (0.75 points)

Which method from the String class can be used to divide a string into an array of substrings around a given character?

Question 25 options:

split

indexOf

trim

substring

Question 26 (0.75 points)

You are working on a program that needs the ability to generate random numbers. What should the import statement at the top of the class look like?

Question 26 options:

import java.rand.Random;

import java.util.Random;

import java.Random;

import java.util.ArrayList;

Question 27 (0.75 points)

A helper method that only needs to be used inside a single class should be designated as _____. Choose the best answer.

Question 27 options:

final

private

static

public

Question 28 (0.75 points)

Which of the following objects is immutable?

Question 28 options:

String

ClockDisplay

ArrayList

HashMap

Question 29 (0.75 points)

If we want to convert the String "5" to primitive type int, we could create a java.lang.Integer object and use which method? Choose the best answer.

Question 29 options:

intValue()

5

valueOf()

toString()

Question 30 (0.75 points)

What keyword is used to declare a constant in Java?

Question 30 options:

immutable

final

const

constant

Question 31 (0.75 points)

Which statement is not true about the following loop:

for(int val: counts) { // body not shown } 

Question 31 options:

If counts is empty, the loop body will not execute.

If counts is an array, it won't compile.

It is a for-each loop.

The elements stored in counts are of type int.

Question 32 (0.75 points)

A key difference between arrays and ArrayList is

Question 32 options:

ArrayList can store more elements than arrays

Arrays have a fixed size that cannot change, whereas elements can be added and removed from an ArrayList whenever needed

ArrayList can store more types of elements than arrays

ArrayList is included automatically, but arrays require importing an additional library

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started