Comp Sci Final

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following is printed as a result of the call mystery(1234)?

43211234

Which of the following describes the content of numbers after the following statement has been executed? int m = mystery(n);

All values in positions m+1 through numbers.length-1 are greater than or equal to n

Which of the following changes to the sort method would correctly sort the integers in * elements * into * descending * order?

I and III only Replace line 9 and Replace line 3 and 7

Which of these constructors would be legal for the NamedPoint class?

I and III only name = " "; and super(d1, d2); name = pointName;

Which of the following method headings of isLargerThan can be added to the declaration of the Circle class so that it will satisfy the Shape interface?

I only public int isLargerThan (Shape other)

Assume that sum1D works correctly. Which of the following can replace missing code so that sum2D method works correctly?

I, II, and III

Assume that doSome is called and executes without error. Which of the following are possible combinations for the value of lim, the number of times Statement S is executed, and the number of times Statement T is executed?

II only 7 4 9

incomplete method partialsum Which of the following statements is true?

Implementation 1 does not work as intended, because it will cause an ArrayIndexOutOfBoundsException

Which of the following is the best postcondition for checkArray?

Returns the index of the largest value in array array

Consider a * shuffle * method Which of the following best describes the problem with the given implementation of the * shuffle * method?

The last element of the returned array (result[result.length - 1]) may not have the correct value

consider the following instance variable and method private int[] arr; what is returned by the call mystery(0, arr.length - 1, num)?

The number of elements in arr that are less than num

Car Dealership making a program to store information about cars for sale: keep track of number of doors, whether car has air conditioning, and its average number of miles per gallon

Use one class, car, with three instance variables: int numDoors, boolean hasAir, and double milesPerGallon

Consider the following output. 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5 Which of the following produce this?

for (int j = 1; j <= 5; j++) { for (int k = 5; k >= j; k--) { System.out.print(j + " "); } System.out.println(); }

Which of the following can be used to replace /* missing code */ so that advance will correctly update the time?

hours = hours + minutes / 60; minutes = minutes % 60;

Assuming that k is a nonnegative integer and m = 2^k, what value is returned as a call mystery(m)?

k

Assume that the following declaration appears in a class other than dog. Dog fido = new UnderDog(); what is printed as fido.act()?

run eat bark sleep

TimeRecord which can fill the missing expression Assume timeCard has been initialized with TimeRecord Objects. Consider the following code segments that is intended to compute total time

total.advance(timeCards[k].gethours(), timeCards[k].getMinutes())

Public void changer test() is executed, what are the values of s and n at the point

world 6

What are the contents of * mat * after the code segment has been executed?

{{2, 1, 1, 1}, {3, 2, 1, 1}. {3, 3, 2, 1}}


Kaugnay na mga set ng pag-aaral

Health Insurance Policy Provisions, Clauses, and Riders - Questions (9)

View Set

GU pediatric success ch 9 2nd ed

View Set

6.13.M - Quiz Review: European Absolutism

View Set

Unit 3.1 Exam Review - Periodic Table

View Set

environmental science a - unit 2: earth systems

View Set