CSD201

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A chained hash table has an array size of 512. What is the maximum number of entries that can be placed in the table? Select one: a. 512 b. 511 c. 256 d. 1024 e. None of the others

a

Which of the following arrays is (are) heap? Select one: a. 82 70 51 63 55 37 10 43 27 30 34 b. 82 70 51 63 34 37 10 43 27 30 55 c. 82 70 51 43 55 37 10 43 63 30 34 d. All of the others

a

Consider the heap: 100 90 80 30 60 50 70 20 10 What is the position of the elements when dequeuing an element? Select one: a. 90 10 80 30 60 50 70 20 b. 90 60 80 30 10 50 70 20 c. 90 60 80 30 20 50 70 10

b

Consider the list of eight integers below: 6, 4, 9, 10, 8, 3, 7, 5 What is the list after is has just been partitioned by the first step of quicksort and a pivot value is chosen as the first element of the list? (sorting from smallest to largest). a. 3, 4, 5, 6, 8, 7, 9, 10 b. 3, 4, 5, 6, 8, 10, 7, 9 c. 3, 4, 5, 6, 7, 8, 10, 9 d. 3, 4, 6, 5, 8, 10, 7, 9

b

In run-length encoding algorithm a run is define as ... Select one:18 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

Linked lists allow easy insertion and deletion of information because such operations have a local impact on the list. Select one: a. False b. True

b

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

d

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

An array contains the elements shown. Show the contents of the array after it has gone through a one-increment pass of the shell sort. The increment factor is h = 3. 23 3 7 13 89 7 66 18 90 98 57 Select one: a. 13 2 6 23 3 7 44 18 7 66 57 90 98 89 b. 2 3 6 13 89 7 66 23 7 44 18 90 98 57 c. 2 98 66 3 89 44 6 23 7 7 18 90 13 57 d. 2 3 6 7 23 13 89 7 66 44 18 90 98 57

a

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

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

If the value of A, B, C and D are 2, 3, 4 and 5, respectively. Using stack, manually calculate the value of the following postfix expression A B C + * D - ( 2+3*4-5) Select one: a. 9 b. 7 c. 6 d. 11

a

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

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

Secondary clustering occurs because...14 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

Suppose that you place 180 elements in a hash table with an array size of 200. What is the load factor? Select one: a. 0.9 b. 0.75 c. 0.5 d. 1.45

a

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

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

Using the coalesced hashing to put the following values in a table with 10 elements: A5, A2, A3, B5, A9, B2, B9, C2 Using the extraction method to extract the number as the key. What is the chain to begin with A5? Select one: a. A5-B5-A9-B9 c. A5-B5 c. A5-A2-A3 d. A5-B2-C2

a

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

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

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

Which of the following is an appropriate description concerning a binary search tree whose node values are 17, 6, 19, 3, 22, 32? a. No matter which values is placed at the root node, "3" cannot have a left child. b. The root node values cannot be "32". c. Any binary tree containing these values has a maximum depth of three (3). d. No matter which values is placed at the root node, "3" is always at the deepest level.

a

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

Which of the following operation in the doubly linked circular list can be done O(1) time? (option) a. Deletion of the tail node b. Insertion of the tail node c. Insertion of a node to any position d. Deletion of any node

a b

Which of the following operations always take O(1) time: Select one or more: a. Deleting one node from the begin of the doubly linked list b. Searching one node in singly linked list without tail in the best case. c. Deleting one any node in a doubly linked list. d. Inserting one node to the end of the singly linked list that has no tail.

a b

Select correct statement(s) about Doubly Linked List: a. The node which is deleted from the list will be claimed by the garbage collector b. Inserting a new node at the end of the list requires O(n) steps c. Deleting a node at the end of the list takes constant time O(1) d. Methods for processing doubly linked list are simpler than those of singly linked list

a c

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

Select correct statement: Select one:13 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

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

Suppose temp refers to a node in a linked list (using the SLLNode class with instance variables called info and next). What boolean expression will be true when temp refers to the tail node of the list? a. (temp == null) b. (temp.next == null) c. (temp.info == null) d. (temp.next != null)

b

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

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. 29 d. -1

b

What is output of using LZW algorithm with the table initialized with the letters a, b, c encode the string "ababcaab"? Select one: a. 1 2 4 3 5 2 b. 1 2 4 3 1 4 c. 4 4 3 1 1 2 d. 1 2 1 2 3 1 1 2

b

What is output of using LZW algorithm with the table initialized with the letters x, y, z encode the string "xyxyzxxy"? Select one: a. 1 2 4 3 5 2 b. 1 2 4 3 1 4 c. 4 4 3 1 1 2 d. 1 2 1 2 3 1 1 2

b

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

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

Which of the following Sorting algorithms have complexity of O(n) in best case? Select one: a. Bubble sort b. All of the others c. Selection sort d. Insertion sort

b

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

b

Which of sentences about singly linked list are true: a. On the average, delete operation executes O(n) steps. b. There is no immediate access to the predecessor of any node in list. c. Deleting a node at the beginning of the list takes constant time O(1). d. Search operation takes O(n) time in the best case. e. Deleting last node of the list always takes O(lgn) time.

b c

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

Consider the following statements: a. Every node of a singly linked list has two reference fields, one to the predecessor and one to the successor b. Every node of a doubly linked list has two reference fields, one to the predecessor and one to the first node of the list Select one: a. a and b are true b. a is true and b is false c. a and b are false d. a is false and b is true

c

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

In a simple hash function, the division method is used for page-based address translation: a pair of new logical page number "101000" and its corresponding physical page number "0010" is stored into the page table shown below. Which of the following indexes is used to place them in the table? Here, the given logical page number is divided by 7, and its remainder is used as the index of the page table. If the slot specified by the index value is already taken, the table is searched forward from that slot to find the next empty slot. a. 000 b. 010 c. 110 d. 111

c

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

The top-down method of J. Williams is used to organize the following array as a heap a. 17 8 14 5 4 12 13 10 3 b. 17 8 14 12 13 4 5 3 10 c. 17 14 12 13 4 8 5 3 10 d.17 14 8 13 12 4 5 3 10

c

What is the result of the breadth first traverse of the the binary search tree T, after inserting the following keys into the tree sequentially (suppose T is empty before insertion): 6, 7, 3, 1, 2, 5, 8 Select one: a. 6, 3, 1, 2, 5, 7, 8 b. 6, 3, 7, 1, 5, 2, 8 c. 6, 3, 7, 1, 5, 8, 2 d. 6, 3, 7, 1, 2, 5, 8

c

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

Consider the following pseudocode: declare a stack of characters while (there are more characters in the word to read) { read a character if a character is '*' then pop and write the popped character to the screen else push the character into the stack } What is written to the screen for the input "Go**odMorn**in***g" ? Select one: a. oGnrniM b. oGnrndo c. oGnrnid d. oGnrnio

d

Consider the statements related to delete From Tail operation in the singly linked list: a. There is a only one special cases to consider: the list is empty b. Most time-consuming part of the operation is finding the next to last node Select one: a. a is true and b is false b. a is false and b is true c. a and b are true d. a and b are false

d

Encoding the string "aaabbccddddddeee" with Huffman. Please indicate the size of the output string? Select one: a. 128 bits b. 24 bits c. 16 bits d. 36 bits

d

Given a raw message "BBBUUUUBBBUUBBBBBUU" (without single quote). Run the run-length encoding algorithms for that message, what is the output? Select one: a. 3B4U3B2U5B b. 3B4U3B2U5B2UU c. 3B4U4B3U2B5UU2 d. 3B4U3B2U5B2U

d

Given the character frequencies B: 32% C: 28% D: 16% E: 6% F: 18% Using Huffman encoding, what is the code for character D? (Suppose that when constructing a subtree from 2 nodes we always place node with higher frequency on the left; and the left branch of a node gets value 0, the right one gets value 1) Select one: a. 01 b. 001 c. 101 d. 100

d

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

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:6 a. Searching. b. All of the others. c. Deleting. d. Inserting.

d

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

Select the best choice about a linked structure Select one: a. Inserting a new element to it is efficiently b. Deleting an element from it is efficiently c. It needs more memory spaces for linking elements d. All of the others

d

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

Specify the correct implementation of dequeue() method of a queue. T java.util.LinkedList, here is pool, for storing data and the head of the list i head of the queue. (Choose the most suitable one) Select one: a. Object dequeue () { if (isEmpty()) return; return (pool.remove(pool.size()-1)); } b. void dequeue (Object x) { if (isEmpty()) return(null); pool.remove(pool.size()-1); } c. Object dequeue () { if (isEmpty()) return(null); return (pool.removeLast()); } d. Object dequeue () { if (isEmpty()) return(null); return (pool.removeFirst()); }

d

Suppose we are implementing a stack using a singly linked list where the head of the list is treated as the top of the stack. Specify the correct implementation of push() method of the stack. (Choose the most suitable one) Select one: a. void push(Object x) { Node p = new Node(x); p.next = head; } b. void push(Object x) { Node p = new Node(x); p.next = head; head = p.next; } c. void push(Object x) { Node p = new Node(x); p.next = null; head = p; } d. void push(Object x) { Node p = new Node(x); p.next = head; head = p; }

d

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

What is the best definition of a collision situation in hash table? Select one: a. Two entries with the exact same key have different values. b. Two entries are identical except for their keys. c. Two entries with different data have the exact same key. d. Two entries with different keys have the same exact hash value.

d

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

Which of the following problems may use the recursion technique? Select one: a. Perform symbolic differentiation b. All of the others c. The eight queens problem d. The Maze problem

d

You want to place 1000 elements in a hash table using linear probing, and you would like an average numbers of trials for successful search two elements. How big does the array of hash table need to be? Select one: a. 1000 b. 125 c. 50 d. 1500

d

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

Find the average length L Huf for the letters X, Y, and Z and their probabilities .05, .05 and .9 respectively. Select one: a. 2.3 b. 1.75 c. None of the others. d. 0.8 e. 1.1

e


Ensembles d'études connexes

4 - Life Insurance Premiums, Proceeds and Beneficiaries

View Set

Chapter 26: Coagulation Modifier Drugs

View Set

CS 235 Exam 3 Concepts Homework Quiz Terms

View Set

fluid, electrolyte, acid-base homeostasis questions

View Set

test one ms, test 2 med surge 3, RESPIRTORY TEST 3, test, Test 5 practice questions, med-surg chapter 31 test bank, Iggy Chapter 45, 40 MedSurg, A&C Med Surg 10th Ch 38, Iggy Chapter 35, Iggy10th Ch 33, A&C Med Surg Iggy Ch 10, Chapter 11: Concepts o...

View Set