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

Which of these expressions evaluates to 4.5?(1 point) I. 9 / (double)2 II. 9 / 2

ID: 3842613 • Letter: W

Question

Which of these expressions evaluates to 4.5?(1 point)

I. 9 / (double)2
II. 9 / 2.0
III. (double)(9 / 2)

Question 1 options:

What is similar between an abstract class and an interface? (1 point)

Question 2 options:

Which of the following boolean expressions correctly determines that String s2 is greater than String s1 in logical order? (2 points)

Question 3 options:

Suppose the following array is declared: int[] numbers = {4, 5, 6, 7}; and the following integer is declared: int index = 1 + 6 % 2 * 2;

What is the value of numbers[index]? (2 points)

Question 4 options:

!((x > y) && (y <= 0)) is not equivalent to which of the following expressions?(2 points)

I. !(x > y) || !(y <= 0)
II. !(x > y) && !(y <= 0)
III. (x <= y) || (y > 0)

Question 5 options:

What is output by the following code? (2 points)

ArrayList a = new ArrayList();
ArrayList b = a;
a.add(new Integer(4));
b.add(new Integer(5));
a.add(new Integer(6));
b.add(new Integer(7));
System.out.println(a.get(1));

Question 6 options:

To extend an abstract class, a class must: (2 points)

Question 7 options:

Polymorphism occurs at: (1 point)

Question 8 options:

Which keyword is required if you want a method to always be overridden in a subclass? (1 point)

Question 9 options:

What does overriding mean? (2 points)

Question 10 options:

What is the maximum number of locations that a binary search algorithm will have to examine when looking for a particular value in an array of 130 elements? (2 points)

Question 11 options:

What is the minimum number of locations that a sequential search algorithm will have to examine when looking for a particular value in an array of 100 elements? (1 point)

Question 12 options:

Which of the following sorting algorithms is described by this text? "Start with the item at index 1, and see if it is in order compared to the item at index 0. If it is not, then shift the item in index 0 to index 1 and then assign the original index 1 item to index 0. Then see if the item at index 2 is already in order compared to the items at the lower indexes; if it is not, then shift values from the lower indexes until the original item can be placed in the correct order. Continue this process with all remaining indexes." (2 points)

Question 13 options:

Which of the following sorting algorithms is not written recursively? (1 point)

I. selection sort
II. insertion sort
III. mergesort

Question 14 options:

1) I only 2) II only 3) I and II only 4) II and III only 5) I, II, and III

Explanation / Answer

1.Which of these expressions evaluates to 4.5?
Answer : I & II only ie
I. 9 / (double)2
II. 9 / 2.0

2.What is similar between an abstract class and an interface?
Answer : Neither can be instantiated.

3.Which of the following boolean expressions correctly determines that String s2 is greater than String s1 in logical order?

Answer :s1.compareTo(s2) == -1

4.Suppose the following array is declared: int[] numbers = {4, 5, 6, 7}; and the following integer is declared: int index = 1 + 6 % 2 * 2;
What is the value of numbers[index]?

Answer :5

5.!((x > y) && (y <= 0)) is not equivalent to which of the following expressions?

Answer :(x <= y) || (y > 0)

6.What is output by the following code? (2 points)
ArrayList a = new ArrayList();
ArrayList b = a;
a.add(new Integer(4));
b.add(new Integer(5));
a.add(new Integer(6));
b.add(new Integer(7));
System.out.println(a.get(1));

Answer :5

7.To extend an abstract class, a class must:

Answer :specify the keyword "extends"

8.Polymorphism occurs at:

Answer :early binding time

9.Which keyword is required if you want a method to always be overridden in a subclass?

Answer :abstract

10.What does overriding mean?

Answer :Defining a subclass method with an identical name, return type, and parameter list that is invoked instead of the parent class method

11.What is the maximum number of locations that a binary search algorithm will have to examine when looking for a particular value in an array of 130 elements?

Answer :130

12.What is the minimum number of locations that a sequential search algorithm will have to examine when looking for a particular value in an array of 100 elements?

Answer :1

13.Which of the following sorting algorithms is described by this text? "Start with the item at index 1, and see if it is in order compared to the item at index 0. If it is not, then shift the item in index 0 to index 1 and then assign the original index 1 item to index 0. Then see if the item at index 2 is already in order compared to the items at the lower indexes; if it is not, then shift values from the lower indexes until the original item can be placed in the correct order. Continue this process with all remaining indexes."

Answer :insertion sort

14.Which of the following sorting algorithms is not written recursively? (1 point)
I. selection sort
II. insertion sort
III. mergesort

Answer :I and II only ie Selection Sort & insertion Sort

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote