Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) What is stored in result after the following code is executed? String text =

ID: 674393 • Letter: 1

Question

1)

What is stored in result after the following code is executed?

String text = "I love this class.";

String result = text.substring(2, 9);

2)

In Java, arrays are

Select one:

primitives

primitives if the data stored in the array are primitive values and objects if the data stored in the array are objects

objects

3)

Which of the following violate encapsulation? Select all that apply.

Select one or more:

making public methods to complete tasks

making instance data variables public

defining public methods to access and manipulate private instance data variables

making constants public

4)

The reserved word "this" refers to a reference that

Select one:

points to an object’s private data only

points to the object passed as a parameter

points to the current object

points to the parent object

5)

An alias is when

Select one:

two different reference variables refer to the same object.

two different primitive variables refer to the same value.

two different primitive variables contain identical values.

two variables have the same name.

any of the above

none of the above

Explanation / Answer

1) What is stored in result after the following code is executed?

String text = "I love this class.";

String result = text.substring(2, 9);

Solution: love t

primitives if the data stored in the array are primitive values and objects if the data stored in the array are objects

3)Which of the following violate encapsulation? Select all that apply.

defining public methods to access and manipulate private instance data variables

4)The reserved word "this" refers to a reference that

points to the object passed as a parameter

points to the current object

5)An alias is when

any of the above