Question
JAVA 3. PLEASE ANSWER ALL. I WILL GIVE A LIKE AND COMMENT AS LIFESAVER!!! Question 1 If myList is a declared ADT list and the
JAVA 3. PLEASE ANSWER ALL. I WILL GIVE A LIKE AND COMMENT AS LIFESAVER!!!
Question 1
If myList is a declared ADT list and the front of the list is on the left, show the contents of the list after applying the following pseudo code?
myList.add(horse) myList.add(goat) myList.add(1, fish) myList.add(cat) myList.remove(2) myList.add(3, dog) myList.replace(2, frog)
Options:
horse frog dog cat
fish frog dog cat
horse fish frog dog
frog horse dog fish
Ans: ?
Question 2
In the makeRoom(newPosition) method of an array-based implementation of the ADT list no shift is necessary if newPosition is equal to
Options:
numberOfEntries 1
numberOfEntries
numberOfEntries +1
none of the above
Ans: ?
Question 3
In an array-based implementation of the ADT list, what is the performance of adding an entry at the end of the list when the array is not resized?
Options:
O(1)
O(log n)
O(n^2)
Ans: ?
Question 4
In an array-based implementation of the ADT list, what is the worst case performance of the remove method?
Options:
O(1)
O(log n)
O(n)
O(n^2)
Ans: ?
Question 4
How does a queue organize its items?
Options:
according to the order in which they were added
by priority
alphabetically
randomly
Ans: ?
Question 5
The ADT priority queue organizes objects
Options:
according to the order in which they were added
by priority
alphabetically
none of the above
Ans: ?
Question 6
If we use a chain of linked nodes with only a head reference to implement a queue, which statement is true?
Options:
You must traverse the entire chain to access the last node.
Accessing the last node is very inefficient.
Both a and b
None of the above
Ans: ?
Question 7
In the linked chain implementation of a queue, the chains first node contains
Options:
the queues front entry
the queues back entry
both a and b
none of the above
Ans: ?
Question 8
In a linked chain implementation of a queue, the performance of the getFront operation is
Options:
O(1), O(log n), O(n), O(n^2)
Ans: ?
Question 9
In a circular array-based implementation of a queue, what is the performance when the enqueue operation must resize the array?
Options:
O(n^2), O(n), O(log n), O(1)
Ans: ?
10)In a graph represented by adjacency matrix u can find all the neighbours of a given vertices in ____Operations
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
11)What type of values are typically stores in unweighted graphs
A. 0 and 1
B. Integers
C.boolean
D.strings
Ans: ?
12)In the ADT graph, the method addEdge has efficiency
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
13)In the ADT graph the method clear has efficiency
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
14)In the ADT graph the methid addVertex has efficiency
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
15)Each vertex in a graph of n bertices can be the origin of at most ____edges
A. n
B.n-1
C.1
D.n+1
Ans: ?
16)In the ADT graph the method has Edge has efficiency
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
17)In the ADT graph, the method getNumberOfEdges has efficiency
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
18)A complete traversal of an n node binary tree is a(n)____ "operation if visiting a node is O(1)for the iterative implementation
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
19)Which of the following real world events could be simulated using a queue
A.restaurant reservation list
B.all other amswers
C.shared network printer
D.bank line
Ans: ?
20)a two part circular linked chain implementation of a queue
A. All other answers
B.keep nodes that are deallocated for future use
C. Allocates newnode on demand when there are no available nodes
D.is intialized with ni available nodes
Ans: ?
21)In an array based implementationof a queue a possible solution to dealing with the full condition is to
A. All other answers
B. Check for frontIndex equal to backIndex
C.wait for an arrayFullException to be thrown
D. Maintain a count of queue items
Ans: ?
22)if we use a chajn of linked nodes with only a heard references to implement a queue which statement is true?
A. You must traverse the entire chain to access the last node
B. Boyh if the answers
C. Accessing the last node is very inefficient
D. None of the other answers
Ans: ?
23)In a circular array based implementation if a queue what is the performance when the enqueue operation if you amortize the cost id resizing the array over all additions to the
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
24)When a linke chain contain nodes that reference both the next node and the previous node it is called a(n)
A. Two way linked chain
B. Multi linked chain
C. Ordinary chain
D. Doubly linked chain
Ans: ?
25)A linked chain whose last node is full is sometiems called an
A.linear linked chain
B.null terminated linked chajn
C.circular linked chain
D. All other answers
Ans: ?
26)when removing a node from a two part circular linked chain implementation of a queue
A. All other answers
B. The node is moved to the part of the chain that is available for the enqueue method
C. Entry at the front of the queue is returned
D.the queue node is advanced
Ans: ?
27)In a doubly linked chain implementation of a queue, what is the performance when the dequeue operation
A. O(1)
B.O(n)
C.O(logn)
D.O(n2)
Ans: ?
28)The java class library interface queue method to put an entey on the back of a queue that returns false if the method falls is
A. Add
B.put
C.poll
D.offer
Ans: ?
29)The java class library interface queue method tagg retrieves the entey at the front of a queue but themrows a NosuchElementException if the queue was empty is
A.poke
B.empty
C.look
D.peek
Ans: ?
30)when a counter enumerates simulated time units. It is called a(n)
A. All other answers
B.time driven simulation
C.event drivem simulation
D.clock simulation
Ans: ?
31)The radix sort
A. Treats array entries asif they were strings that have same length
B. Is not suitable as a general purpose sorting algorithm
C.restrcits the data that it sorts on
D. All other answers
Ans: ?
32)Which of the following statements are true about quick sort
A. It can degrade into an O(n2) sort if the pivot selection scheme is bad
B. It doesnt require additional memory that merges sort does
C. All other answers
D.in practice it can be transfer than merge sort
Ans: ?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started