Quiz 2 - CSC 220

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

If a class implements an interface, does it need to have public method with the same name and parameters for EVERY method in the interface? Can the class have methods OTHER than those in the interface it implements? (hint: ArrayBasedPD)

-yes the need to be public and with the same name and parameters as in the interface -yes they can include additional methods but it must first include all the specified methods

How many number can your computer (the one you use to do your homework) add up in on millisecond (1/1000 second)? If you dont remember the exact speed of your computer take a guess

1 - 10million numbers

Assuming you use binary search, what is the largest number of pages you have to look at in order to look up a word in an alphabetical dictionary with 1,000 pages?

10 = log₂(1,000)

Assuming you use binary search, what is the largest number of pages you have to look at in order to look up a word in an alphabetical dictionary with 1,000,000 pages?

20 = log₂(1,000,000)

Assuming you use binary search, what is the largest number of pages you have to look at in order to look up a word in an alphabetical dictionary with 1,000,000,000 pages?

30 = log₂(1,000,000,000)

if name1="Victor" and name2="Vincent" then name1.compareTo(name2) is -11 because c comes 11 letters before n. What is it if name1="Jean" and name2="Jane?"

4

You are testing your homework, but you have not implemented find yet, so the directory will not yet be in alphabetical order. You save the current directory and look at the contents of csc220.txt. What you see is on the left. Jay 1 Bob 8 Ian 2 Ann 3 Eve 6 result of ArrayBasedPd.add("Zoe", 7)

Jay 1 Bob 8 Ian 2 Ann 3 Eve 6 Zoe 7

You are testing your homework, but you have not implemented find yet, so the directory will not yet be in alphabetical order. You save the current directory and look at the contents of csc220.txt. What you see is on the left. Jay 1 Bob 8 Ian 2 Ann 3 Eve 6 result of sortedPD.add("Zoe", 7) if it inserts at index = 2 for testing (Remember: zero based indexing)

Jay 1 Bob 8 Zoe 7 Ian 2 Ann 3 Eve 6

You are testing your homework, but you have not implemented find yet, so the directory will not yet be in alphabetical order. You save the current directory and look at the contents of csc220.txt. What you see is on the left. Jay 1 Bob 8 Ian 2 Ann 3 Eve 6 result of ArrayBasedPD.removeEntry("Bob")

Jay 1 Eve 6 Ian 2 Ann 3

You are testing your homework, but you have not implemented find yet, so the directory will not yet be in alphabetical order. You save the current directory and look at the contents of csc220.txt. What you see is on the left. Jay 1 Bob 8 Ian 2 Ann 3 Eve 6 result of SortedPD.removeEntry("Bob")

Jay 1 Ian 2 Ann 3 Eve 6

using ui.getInfo(prompt) and ui.sendMessage(message), write code that gets a name from the user and sends a message "Blank is not allowed" if the user gives you a blank name. Cancel should not cause your code to crash.

String name = ui.getInfo("Enter a name"); if (name == null) break if(name = "" && name != null) ui.sendMessage("Blank is not allowed"); break;

When you have finished your homework what will you do to turn it in

nothing - make sure that the proper folders are in box


Kaugnay na mga set ng pag-aaral

Chapter 5 Macroeconomics Elasticity and Its Application

View Set

Definition of Collaborator, Perpetrator, and Bystander

View Set

Anatomy Midterm (Chapter 1,7,8,9,10)

View Set

Ch.5- Cost - volume- profit relationships

View Set