Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following are advantages of a linked-list (a general, abstract data type which also has a java.util implementationl) over an an array: Check all that

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The following are advantages of a linked-list (a general, abstract data type which also has a java.util implementationl) over an an array: Check all that apply.) Even if we don't have a reference to the proper node, a linked-list can easily access any element in the middle of the list with a single statement, but an array requires a loop to gain access to that node. Assuming we have a reference to the proper node, a linked-list will enable fast insertion into the middle of the list, while insertion into the middle of an array, even if we know the int index of the desired insertion point, will not be as fast or simple. A linked-list takes less memory to store a single element (a Node in the list) than an array takes to store its version of a single element (the kth item in the array) Inserting an item into an already-ordered linked-list, so as to preserve the order, requires fewer loops and/or a shorter loop than inserting an item into an ordered array so as to preserve the order. If an instance method calls another instance method of the same class, an object must be used for dereferencing the call True False You have an array declared as follows: int anArray-new int[3][5]; Assume that the array has been filled with integer values. Which of the following would you use to display the value stored in the second row, first column? O System.out.println(anArray[1,0]); System.out.println(anArray[O][1]) O System.out.println(anArray[2][1]) System.out.println(anArray[1][O]) The statements Card card1, card2, card3, myCard; cardi -new Card(); card2 -cardi; will cause how many card objects to be instantiated? (only one correct choice): 2 3 O 0 4 Consider the following int anArray[][] . (6, 7, 8, 9, 10, , 11, 12, 13, 14, 15 h 3 func (anArray) Which of the following method headers would work for the method called func? O funclint a[3]0) O func(int aD0) O funclint a(31][5]) func(int al5]) Assume that in a given class, Villain, the instance member xCoordinate and static member newOriginX, are both are declared public, allowing the client to use them directly (that's fine -- maybe there is no illegal value for either, so no need to provide mutators). Consider legal and correct the client code (where the two objects are members of the class in question): evilvillain1.xCoordinate 3; evilvillain1.neworiginx-2.2; evilvillain2.xCoordinate 5; evilvillain2.neworiginx-1.4; Immediately after this code, what are the values of the instance and static members? We will get warnings about accessing the static member through an object vs. the class name, but for this problem we ignore the warning- it's okay.) evilVillain1 has xCoordiante 5 evilVillain2 has xCoordiante 5 the class's static, if accessed through evilVillain1.newOrigin,2.2 the class's static, if accessed through evilVillain2.newOrigin,-2.2 evilVillain1 has xCoordiante 3 evilVillain2 has xCoordiante5 the class's static, if accessed through evilVillain1.newOrigin, - -1.4 the class's static, if accessed through evilVillain2.newOrigin,-2.2 O evilVillain1 has xCoordiante3 evilVillain2 has xCoordiante5 the class's static, if accessed through evilVillain1.newOrigin,- -1.4 the class's static, if accessed through evilVillain2.newOrigin,1.4 evilVillain1 has xCoordiante3 evilVillain2 has xCoordiante 5 the class's static, if accessed through evilVillain1.newOrigin,- -2.2 the class's static, if accessed through evilVillain2.newOrigin,-2.2 Consider the following 2-D array allocation: Dog[]l] lilikoi - new Dog[4][6]; Check the true statements O The original array declaration, with no additional instantiation, will create 24 Dog references. We can redefine the Dog object in the bottom row and right-most column of lilikoi] using the notation: lilikoi[4][6]new Dog); O lilikoiU0 is considered to have 4 rows and 6 columns O The original array declaration, with no additional instantiation, will create 24 doubles. for ( row = 0; row

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

What problems have I solved? What skills did that show?

Answered: 1 week ago