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

Can someone help with these questions ? Even with some if you can\'t with all. T

ID: 3679621 • Letter: C

Question

Can someone help with these questions ? Even with some if you can't with all. Thank you.

15.Question 15 of 30 (worth 3 points)

Which of the following would be a correct way to call (invoke) this method?

public static void printArray(int[] array) { for (int i = 0; i < array.length; i++) { System.out.print(array[i] + " "); } }

A. int[] result={3, 1, 2, 6, 4, 2}; printArray(result);

B. int[]{3, 1, 2, 6, 4, 2}; printArray(int[]);

C. int[] result={3, 1, 2, 6, 4, 2}; printArray({3, 1, 2, 6, 4, 2});

D. int[] result; printArray(int[] result);

20.Which of the following are steps in Task Centered GUI Design?

A. Analyze B. Finalize C. Initialize D. Design E. Evaluate F. Iterate

Q21.

A GUI should avoid bundling actions together, because the user may not anticipate any side effects. For example, if a user chooses to cancel a request to send a note, only the send request should be cancelled. Do not bundle another action, such as deletion of the note, with the cancel request.

True

False

Question 22 of 30 (worth 3 points)

Which of the following is a top-level container?

A. JButton

B. JLabel

C. JFrame

D. JPanel

Question 23 of 30 (worth 3 points)

The JButton class provides the functionality for an ordinary push button. A button can only contain text.

True

False

Question 24 of 30 (worth 3 points)

Unlike radio buttons, in which many or none can be selected at once, check boxes only have one button selected at a time.

True

False

Question 25 of 30 (worth 3 points)

Which search algorithm can be described as follows: Given a collection you try every element in the collection until you have found the element or until you reach the end of the collection.

A. Sequential Search

B. Iterative Binary Search

C. Recursive Binary Search

D. None of the above

Question 26 of 30 (worth 5 points)

Consider the following class:

public class BinarySearch { public static boolean contains(int[] a, int b) { if (a.length == 0) { return false; } int low = 0; int high = a.length-1; while(low <= high) { int middle = (low+high) /2; if (b> a[middle]){ low = middle +1; } else if (b< a[middle]){ high = middle -1; } else { // The element has been found return true; } } return false; } }

What is the purpose of iteration in the above code.

A. To search between the low and high index numbers as long as there are index numbers between low and high to search.

B. To walk through each element of the array from the first element until the end of the array is reached.

C. To test if the original array has a length greater than zero before attempting any other statements.

D. To set the index point in the middle so the right hand side of the array can be searched before the left hand side is searched

Question 30 of 30 (worth 5 points)

You have previously defined these GUI objects needed for your JPanel. jbtAdd jbtFind jbtReplace Which code block should you use to add these objects to a new JPanel called p2 using a GridLayout with 1 row and 3 columns?

A. new GridLayout(1, 3); JPanel p2 = new JPanel(jbtAdd, jbtFind, jbtReplace);

B. JPanel p2 = new JPanel(new GridLayout(1, 3)); jbtAdd.addTo(p2); jbtFind.addTo(p2); jbtReplace.addTo(p2);

C. p2.add(jbtAdd); p2.add(jbtFind); p2.add(jbtReplace); JPanel p2 = new JPanel(new GridLayout(1, 3));

D. JPanel p2 = new JPanel(new GridLayout(1, 3)); p2.add(jbtAdd); p2.add(jbtFind); p2.add(jbtReplace);

Explanation / Answer

15. A. int[] result={3, 1, 2, 6, 4, 2}; printArray(result);

20. F. Iterate

21. True.

22. C. JFrame

23. True

24. False.

25. A. Sequential Search

26. A. To search between the low and high index numbers as long as there are index numbers between low and high to search.

30. D. JPanel p2 = new JPanel(new GridLayout(1, 3)); p2.add(jbtAdd); p2.add(jbtFind); p2.add(jbtReplace);