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

. T F An instance variable declared as private can be seen.anly by the class in

ID: 3688757 • Letter: #

Question

. T F An instance variable declared as private can be seen.anly by the class in which it was declared and all its sub classes F If a class C is declared as abstract, then.prixate C myC- new CO; is valid 3. T FA variable declared as final cannot ever be modified, once it has been dedared and initialized 4. T F The following is a legal statement: double x-5: S. T F Code that does not explicitly handle checked exceptions, results in a compilation error You are not able to sort a two dimensional array using the sart() method You are not able to change variable values from a subclass 8. T F methad declarations void A(double x, integer k)) and xoid A(integer k, double x) (; have identical signatures The binary search algorithm will work properly on all integer arrays Interface is a class in Java 10. T F 11. T F 12. T | F | 13. TF ("Give me Liberty-.split(" ").length) evaluates to 3 String.equals and . will always return the same result If the following statements are the only two statements in a method String x = "thing one"..and String Y-thing one", then X.equals(Y) evaluates to true, but X Y evaluates to false within that method A class declared as final cannot be inherited via the.extends keyword consider the statement: String S-"Out of Gas", then the statement: SI7 'g'; will change "Gas" to "gas" 14. T F 16. TF 17. TF F boolean primitive variables can only be assigned values: true, false, or null You can index into an array with a variable of type double as long as the there. are no digits past the decimal point 18. T F A subclass inherits all of the public, private and protected members of its arent if the subclass is in the same package as its parent 19. TF 20. TF 21. T F Any for loop can be rewritten using a while loop It is legal to define more than one class in a java source file A class can implement multiple interfaces L.. Math,sart(4,0); isa valid statement

Explanation / Answer

1)False

Because The scope of the private modifier is within the class only.

2)False , Because for Abstract class we can't create object.

3)True

4)True

5)True

6)False

7)True , if the variable declared as static then we can change.

8)false

9)True

10)false , An interface isn't a class, but you could say that both interfaces and classes are types.

11)True

12)false ,.equals check content of the string and == check address comparison

13)false , Both are true

14)True , final class can't be inherited.

15)false

16)false , we can't assign null values to boolean

17)True

18)false , private scope is within the class

19)yes

  any for loop can be written with a while loop and any while loop can be rewritten with a for loop.

20)True , but only one class can be public.

21)True

22)false , change type to double

23)True

24)true

24)True , if your switch block condition value is 4 , then case xyz will execute.