Which must be imported in a program in order to use the java

Assignment Help Data Structure & Algorithms
Reference no: EM131325061

Data structures using JAVA final exam

Q1. In a linked list implementation of a stack, only a fixed number of elements can be pushed onto the stack.
a. true
b. false

Q2. In a linked representation, memory for the stack elements is allocated dynamically.
a. true
b. false

Q3. Which of the following must be imported in a program in order to use the Java stack class?
a. java.util
b. stack.util
c. java.stackclass
d. java.classStack

Q4. An array is a random access data structure; a stack is not.
a. true
b. false

Q5. StackClass s = new StackClass(50);
int x, y, z;

s.push(new IntElement(3));
s.push(new IntElement(7));
x = s.pop();
s.push(new IntElement(5));
y = s.pop();
z = s.pop();

Given the sequence of operations above, what is the value of x?
a. 0
b. 3
c. 5
d. 7

Q6. A stack is also called a LIFO data structure.
a. true
b. false

Q7. In a linked list implementation of a stack you must keep track of the address of the top element of the stack.
a. true
b. false

Q8. The operation pop returns the top element of the stack.
a. true
b. false

Q9. The method deleteQueue does which of the following?
a. uses one queue to delete another
b. removes the back element from the queue
c. removes the front element from the queue
d. removes all elements from the queue leaving an empty queue

Q10. Queue can be derived from the class ____.
a. LinkedListClass
b. stack
c. list
d. array

Q11. The method front returns the first element in the queue.
a. true
b. false

Q12. In a queue object, the constructor initializes queueFront and queueRear to indicate that the queue is empty.
a. true
b. false

Q13. FIFO is similar to the way customers in line at a bank are serviced.
a. true
b. false

Q14. In queuing systems, queues of objects are waiting to be served by various ____.
a. operations
b. lists
c. customers
d. servers

Q15. A queue is a set of elements of the same type in which the elements are added at one end and deleted from the other end.
a. true
b. false

Q16. Each iteration of the main loop in the simulation program represents one minute.
a. true
b. false

Q17. In general, if L is a sorted list of size n, to determine whether an element is in L, the binary search makes at most 2 * log2n + 2 key (item) comparisons.
a. true
b. false

Q18. ____ uses a random number generator to find the next available slot.
a. Linear probing
b. Random probing
c. Quadratic probing
d. Chaining

Q19. Data stored in a hash table can be stored in ____.
a. an array only
b. a linked list only
c. a stack only
d. both an array and a linked list

Q20. If the hash function causes a cluster at a particular home position it is known as ____.
a. rehashing
b. primary clustering
c. aggregation
d. secondary clustering

Q21. On average, the number of comparisons made by a sequential search is equal to one-third the size of the list.
a. true
b. false

Q22. One of the disadvantages of chaining is that if the item size is small, a considerable amount of space is wasted.
a. true
b. false

Q23. One requirement of linear search is that the item must be in the array.
a. true
b. false

Q24. In linear search, you search an array starting from the middle component.
a. true
b. false

Q25. If we want to design a search algorithm that is of an order less than log2n, then it ____ be comparison based.
a. must
b. could
c. cannot
d. should

Q26. The worst case for the number of comparisons in quick sort is O(n2).
a. true
b. false

Q27. Suppose that Lis a list of nelements, where n> 0. Let A(n) denote the number of key comparisons in the average case of merge sort. Which of the following is true?
a. A(n) = O(n log2n)
b. A(n) = O(n log n)
c. A(n) = O(n2 log n)
d. A(n) = O(n2 log2n)

Q28. Selection sort always starts with the middle element of the list.
a. true
b. false

Q29. In quick sort the list is partitioned into three sublists, and the three sublists are then sorted and combined into one list in such a way so that the combined list is sorted.
a. true
b. false

Q30. Empirically, heap sort usually takes twice as long as quick sort.
a. true
b. false

Q31. The functions implementing sorting algorithms are included as private members of the related class.
a. true
b. false

Q32. Tracing the execution of a comparison-based algorithm can be done by using a graph called a comparison tree.
a. true
b. false

Q33. Insertion sort tries to reduce the number of key comparisons relative to which of the following?
a. heap sort
b. merge sort
c. selection sort
d. quick sort

Q34. Merge sort uses a pivot just like quick sort.
a. true
b. false

Q35. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree.
a. true
b. false

Q36. In a binary search tree, the key in the ____ node is larger than every key in the left subtree and smaller than every key in the right subtree.
a. child
b. root
c. right
d. head

Q37. The ____ of a binary tree is the number of nodes on the longest path from the root to a leaf.
a. level
b. height
c. width
d. depth

Q38. A double rotation at a node is a right rotation followed by a left rotation.
a. true
b. false

Q39. There are ____ cases to consider when deleting a node from a binary search tree.
a. two
b. three
c. four
d. five

Q40. In an AVL tree: 1) the height of the left and right subtrees of the root differ by at most 2, and 2) the left and right subtrees of the root are AVL trees.
a. true
b. false

Q41. In a perfectly balanced binary tree ____.
a. the left and right subtrees of the root are binary trees
b. the left and right subtrees of the root have the same depth
c. the left and right subtrees of the root have the same width
d. the left and right subtrees of the root are perfectly balanced binary trees

Q42. Any node in a binary tree can be called a leaf node.
a. true
b. false

Q43. In a breadth first traversal all the nodes at any level, i, are visited before visiting the nodes at level i+ 1.
a. true
b. false

Q44. An edge incident on a single vertex is called a ____.
a. loop
b. map
c. parallel
d. component

Q45. The two most common graph traversal algorithms are the height first traversal and breadth first traversal.
a. true
b. false

Q46. The ____-first traversal of a graph is similar to traversing a binary tree level by level.
a. height
b. depth
c. breadth
d. width

Q47. Graphs can be used to model chemical compounds.
a. true
b. false

Q48. In an undirected graph G = (V, E), the elements of E are ordered pairs.
a. true
b. false

Q49. The second step in a depth first traversal starting at a given node v is to ____.
a. mark the node as visited
b. visit the node
c. go to the vertex u adjacent to v
d. delete the node

Q50. A ____ tree of G is a spanning tree with the minimum weight.
a. minimal spanning
b. short
c. binary
d. binary search

Reference no: EM131325061

Questions Cloud

Define the service level agreement : Your customer has asked you to define the Service Level Agreement - paper that defines the components required in the SLA .Service Level Agreement (SLA) and incident-management planning
What recommendations can you make to assist the company : Is Lobo using the lowest cost combination of workers to produce its targeted output? If not, what recommendations can you make to assist the company?
Mirr of the project using the reinvestment approach : Miller and Sons is evaluating a project with the following cash flows: The company uses a 10 percent interest rate on all of its projects. What is the MIRR of the project using the reinvestment approach? The discounting approach? The combination appr..
What is the return if the investor sells the stock : Assume a stock is initially priced at $50, and pays an annual $2 dividend. An investor uses cash to pay $25 a share and borrows the remaining funds at a 12 percent annual interest. What is the return if the investor sells the stock for $55 at the end..
Which must be imported in a program in order to use the java : CST 227- Which of the following must be imported in a program in order to use the Java stack class? In a linked list implementation of a stack, only a fixed number of elements can be pushed onto the stack.
Identify the alga known for biological activity : Identify the alga known for biological activity called bioluminescence?
What is the intrinsic value of the stock per share : Next year’s annual Dividend is expected to be $4, per share.The long-term growth in dividends is expected to be 3%, indefinitely.The firm’s Beta is 0.95, the Equity Risk Premium is 7.5%, and the risk free rate for the expected duration of the investm..
Adjacent filaments of spirogyra affins : Two adjacent filaments of spirogyra affins each 10 cells participating in reproduction. How many new Spirogyra plants are produced during sexual reproduction?
Explain the concept of risk-based corrective action : Explain the concept of Risk-Based Corrective Action (RCBA). Why is this concept used in hazardous waste remediation? Discuss three waste minimization strategies that could be used by a small business classified as a small quantity generator

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd