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

  How much time will it take to sort the array

If an arbitrary item is added to the end of an already sorted list, how much time will it take to sort the array again using insertion sort?

  Create a data flow diagram

Create a data flow diagram for Online library management system. It should include search, hold, add items, issue, recall, and add user. It should support books, dvds, and cds. The flows should include each data element, the levels must be balance..

  Use sequential search algortithm to locate the number

These numbers should be stored in an array. Use the sequential search algortithm to locate the number entered by the user. If the number is in the array, the program should display a message.

  Count all strings as occurrences of one operand

count Halstead's ry1 and ry2. Calculate ry and N. Count all strings as occurrences of one operand called ‘‘string.''

  Part-11 suppose you want to demonstrate an erd to someone

part-11. suppose you want to demonstrate an erd to someone who has never seen one. provide a scenario from everyday

  Write a sortedinsert function in c program

Write a sortedInsert() function in C program that takes two parameters: a list that is sorted in increasing order, and a single node,

  The heuristic evaluation of a user interface design

principles used in the heuristic evaluation of a user interface design.

  What is the running time of your algorithm in terms of n

If you give a greedy algorithm, be sure to prove that your algorithm is correct by proving both greedy choice and optimal program substructure. What is the running time of your algorithm, in terms of n?

  Determine the branching factor

Expalin the search algorithm that results from each of the following special cases. How does it relate to other algorithms we have discussed.

  Description of the steps of the algorithm and justify it

Design an algorithm that solves the above problem using a mandatory heap and has time complexity O(m + k*lg(m)) and space complexity O(m).

  Database over electronic files to store data

Discuss the benefits of a database over electronic files to store data determine what kinds of database products are used in your company?

  Show how a program could use this function to print value

Here is a fragment of a program that uses this function: answer = 4 result = cube(3) print answer, result The output from this fragment is 4 27. Explain why the output is not 27 27, even though cube seems to change the value of answer to 27.

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