Fast CSD

¡Supera tus tareas y exámenes ahora con Quizwiz!

3: Which of the following Sorting algorithms use Divide and Conquer strategy? Select one: a. Quick sort b. Radix sort c. Heap sort d. Bubble sort.

a

Q 7: Which of the following statements is false? Select one: a. The postorder traversal always visits the right-most node first. b. The preorder traversals always visit the root first. c. The top-down level order traversals always visit the root first. d. The postorder traversal always visits the root last

a

Q 8: Select incorrect statement about restrictions need to be imposed on the prospective codes: Select one: a. There should not be any unused short codewords either as stand-alone encodings or as prefix for longer codewords b. Decoding should not require any look ahead c. Each codeword maybe corresponds to one or many symbols d. The length of the codewords for a given symbol A should not exceed the length of the codeword of a less probable symbol B

c

Q10: In a binary search tree, certain null entries are replaced by pointers which point to node higher in the tree for traversal. These special pointers are called... a. Root b. Arc c. Thread d. Non-terminal e. Leaf

c

Q 1: After two passes of a sort algorithm, the following array: 47 3 21 32 56 92 has been rearranged as shown below: 3 21 47 32 56 92 Which sorting algorithm is being used? a. all of them b. bubble sort c. selection sort d. insertion sort

a

Q 10: When the compiler compiles your program, how is a recursive call treated differently than a non-recursive method call? a. There is no duplication of local variables b. None of the others c. Primitive values are all treated as reference variables d. Reference variables are all treated as primitive values

b

Q 9: An array contains the elements shown below: 7 8 26 44 13 23 98 57 What would be the value of the elements in the array after two pass of the heap sort algorithm. Select one: a. 7 8 13 23 26 44 57 98 b. 44 26 23 7 13 8 57 98 c. 26 13 23 7 8 44 57 98 d. 57 26 44 7 13 8 23 98 e. None of the others

e

Q 1: Recursion requires much memory because: Select one: a. Previous function calls are still open when the function calls itself and the activation records of these previous calls still occupy space on the call stack. b. It requires large data values. c. Recursive functions tend to declare many local variables. d. Many copies of the function code are created.

a

Q 3: Consider the following chain of method calls: f() → f1() → f2() → f(3) → f() What is this kind of recursion? a. Indirect recursion. b. Tail recursion. c. Non-tail recursion. d. None of the others.

a

Q 3: Priority queues can be implemented by using unordered linked list. Which of the following operations is (are) used to dequeue? a. Searching and Deleting. b. Searching. c. Deleting. d. Inserting and Searching.

a

Q 3: Secondary clustering occurs because... Select one: a. the sequence of step lengths is always the same. b. the hash function is not perfect. c. too many items with the same key are inserted. d. many keys hash to the same location..

a

Q 4: Assume that in an array list implementation of a stack, pushing an element onto a full stack requires allocating more memory. What is the complexity of pushing operation in this case? a. O(n) b. O(n2) c. None of the others. d. O(1) e. O(lg n)

a

Q 4: When a list of 7 elements shown below is rearranged in ascending order, which of the following sorting algorithms is completed with the minimum number of elements exchanges? 3 5 12 9 10 7 15 Select one: a. Shell sort b. Merge sort c. Insertion sort d. Bubble sort

a

Q 5: The Java Collections Framework contains a Map interface. An implementation of this interface is ... Select one: a. HashTable b. Singly Linked List. c. Priority Queue. d. Connected Graph

a

Q 6: What is the complexity of reversing the order of the elements on a stack using two additional stacks? Select one: a. O(n) b. O(lg n) c. O(n2) d. O(1)

a

Q 9: The best technique when the amount of data is not well known is ... Select one: a. separate chaining b. linear probing c. quadratic probing d. double hashing

a

Q 1: Select incorrect statement about Adaptive Huffman Coding: Select one: a. If the sibling property is violated, Huffman tree has to be restructured to restore this property. b. The sibling property is described as each node has a sibling (except for the root) and the breadth-first right-to-left tree traversal generates a list of nodes with nonincreasing frequency counters. c. Adaptive Huffman coding can be applied to any kind of file. d. If Adaptive Huffman coding is used to compress executive file, output file is much smaller than the original.

b

Q 1: To implement an AVL tree, a concept balance factor is introduced (bal = height(right) - height(left)). Suppose an AVL tree is created by inserting to the tree the following keys sequentially: 6, 4, 7, 3, 5, 2. What is the balance factor of the node 4? (please note that the tree is still AVL) Select one: a. 1 b. 0 c. 2 d. -1

b

Q 4: What is the complexity of inserting a node in a perfectly balanced tree for worst case? a. O(n) b. O(lgn) c. O(nlgn) d. None of the others

b

Q 5: Select an incorrect statement. What is this kind of recursion? a. Recursion, gone wrong, can lead to an overflow stack error. b. Recursion is always more efficient than loops. c. Recursion can made the conceptual design of an algorithm's implementation easier.

b

Q 7: In run-length encoding algorithm a run is define as ... Select one: a. Amount of time require to the compression algorithm b. A sequence of identical characters c. The size of result of encoding input data d. Number of different character in the input

b

Q 8: Select correct statement: Select one: a. In particular sorting situation, if swaps take much longer than comparisons, the selection sort is about twice as fast as the bubble sort. b. A copy is three times as fast as a swap. c. If there are N items, the bubble sort makes exactly N*N comparisons. d. The bubble sort always ends up comparing every item with every other item

b

Q 8: The recursion statement indicates... Select one: a. the ending of the recursion statement b. the rule of the recursion c. the starting value d. the beginning of the recursion statement

b

Q 3: Which of the following statements is true? Select one: a. If the binary tree has n nodes and height h, then h <= lg(n+1) b. If all of its leaves at the same level, then the binary tree is full c. A binary tree cannot have more than 2^d nodes at level d. d. if every proper subtree of a binary tree is full, then the tree itself must also be full

c

Q 6: Consider the following statements about recursion: a) A recursive approach may be inefficient in many cases. If so, it can be replaced with a simple loop or a stack-based approach. b) Some value of its arguments causes a recursive method to return without calling itself. This is called the ground case. Select one: a. a and b are false b. a is true, b is false c. a and b are true d. a is false, b is true

c

Q 7: Which the sorting technique always makes recursive calls to sort pieces that are about half the size of the original array? Select one: a. Quick sort b. Heap sort c. Merge sort d. Shell sort

c

Q 10: Priority queues can be implemented by using unordered linked list. In this case, which of the following operations of the linked list is (are) used to enqueue an element? Select one: a. Searching. b. All of the others. c. Deleting. d. Inserting.

d

Q 2: Select incorrect statement: Select one: a. A hash function transforms a range of key values into a range of index values. b. Using the next available position after an unsuccessful probe is called quadratic probing. c. Separate chaining involves the use if a linked list at each location. d. The first five step sizes in quadratic probing are 1, 4, 9, 16, 25.

d

Q 2: We implement the stack as a singly linked list and use AddtoHead() method of the linked list to implement push() method. A top pointer of the stack is... Select one: a. Nothing. We need a doubly linked list. b. Any one reference. Depending on the node that is accessed. c. The tail reference of the singly linked list. d. The head reference of the singly linked list.

d

Q 2: Which of the following is not correct about a recursive function? Select one: a. A recursive function may call itself indirectly. b. A recursive function may call itself directly. c. A recursive function is based on the recursion principle. d. A recursive function is based on the diversion principle.

d

Q 4: How many activation records are allocated when calculating Fibonacci(5) by calling recursion method? a. 25 b. 41 c. 9 d. 15

d

Q 5: Select the best choice: A stack can be implemented using... Select one: a. A singly linked list. b. A circular linked list. c. An array. d. All of the others. e. A double linked list.

d

Q 9: Precondition for both methods: n >= 0 public boolean even(int n){ if(n==0) return true; return odd(n-1); } public boolean odd(int n){ if(n==0) return false; return even(n-1); } Which assertions are correct? a. odd always stops, but even may loop indefinitely b. both odd and even may loop indefinitely c. even always stops, but odd may loop indefinitely d. both odd and even always stops

d


Conjuntos de estudio relacionados

ATI Parenteral (IV) Medications Test

View Set

Week 4 go/ tomorrow/today/ Monday-Sunday

View Set

Computer Concepts Final Exam 1-7

View Set

Med Surg I Prep U Chapter 13: Fluid and Electrolytes: Balance and Disturbance

View Set

MENTAL HEALTH EXAM 2: Mood disorders

View Set

Anatomy and physiology chapter 6

View Set

CONTEMPORARY WORLD MIDTERMS (Chapter 1-3)

View Set