CSD Part 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

a

Question 10 Marks: 1 Which traversal method is used in Adaptive Huffman tree? Choose one answer. a. Breadth First traversal b. Inorder traversal c. Postorder traversal d. Preorder traversal

a

Question 15 Marks: 1 What is the worst-case time for finding an element in a Binary tree? Choose one answer. a. O( n ) b. O( n2 ) c. O(lgn) d. O( 1 )

a

Question 11 Marks: 1 When a method call is executed, which information does its activation record contain? Choose one answer. a. None of the others. b. Current depth of recursion. c. Global variables. d. Name of the method. e. Code of the method.

d

Question 18 Marks: 1 Suppose a singly linked list of integers is given below and p is a node with value 6: 7 5 6 4 3 9 8 2 What does the list look like after the following java code snippet is run? int x = 1; Node f = head; while(f.next != p) f = f.next; Node q = new Node(x); // Create new node with value x q.next = p; f.next = q; Choose one answer. a. 1 7 5 6 4 3 9 8 2 b. 7 5 6 4 3 9 8 2 c. 7 5 6 4 3 9 8 2 1 d. 7 5 1 6 4 3 9 8 2 e. 7 5 6 1 4 3 9 8 2

c

Question 19 Marks: 1 Which of the following algorithms in graphs can be implemented by extending Depth First Search algorithm? Choose one answer. a. The Chinese Postman Tour b. All of the others. c. Cycle detection. d. Finding the shortest path (Dijkstra algorithm)

b

Question 20 Marks: 1 A queue is implemented using a doubly linked list, which of the following operations require O( n ) time? Choose one answer. a. enqueue b. clear (remove all elements from the queue). c. None of the others. d. dequeue

c

Question 27 Marks: 1 Consider the following function: void fun(int n) { if (n < 0) { System.out.println( "-" ); fun(-n); } else if(n<15)System.out.println( n ); else { fun(n/15); System.out.println( n%15 ); } } What values of n are directly handled by the stopping (base) case? Choose one answer. a. n < 15 b. n >= 15 c. n >= 0 && n<15 d. n < 0

b d

Question 29 Marks: 1 Selectionsort and quicksort both fall into the same category of sorting algorithms. What is this category? Choose at least one answer. a. Divide-and-conquer sorts b. Interchange sorts c. O(n log n) sorts d. Worst time is quadratic

c

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

a c

Question 34 Marks: 1 In the circular array version of the Queue class, which operations require O ( n ) linear time for their worst-case behavior Choose at least one answer. a. clear() b. dequeue() c. enqueue() when the capacity has been reached d. firstEl()

d

Question 38 Marks: 1 What is the value of the Boundary Folding Hash Function if K = 43-65-76-7 and TSize = 100? Choose one answer. a. 84 b. 86 c. 85 d. 82

c

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

a

Question 50 Marks: 1 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 sub tree 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) Choose one answer. a. 100 b. 001 c. 101 d. 01

a

Question 9 Marks: 1 Which of the following Sorting algorithms have complexity of O( n ) in best case ? Choose one answer. a. Insertion sort b. Selection sort c. Buble sort d. All of the others.

d

Question 31 Marks: 1 What is the complexity of inserting a node in a perfectly balanced tree for worst case? Choose one answer. a. O( n ) b. None of the others. c. O(nlgn) d. O(lgn)

c d

Question 12 Marks: 1 When converting a method from a recursive version into an iterative version, Choose at least one answer. a. The brevity of program formulation is not be lost b. The program always runs slower. c. The brevity of program formulation lost. However, the brevity may not be an issue in Java. d. Program clarity can be diminished.

a

Question 21 Marks: 1 Use the Huffman code tree below. What is the result of decoding the string 110000100100 ? Choose one answer. a. AABBABAB b. BABABBBA c. CAABBBBA d. AABBBCAB

a

Question 23 Marks: 1 What is output if using LZW algorithm with the table initialized with the letters a, b, c encode the string "ababcaab"? Choose one answer. a. 1 2 4 3 1 4 b. 1 2 4 3 5 2 c. 4 4 3 1 1 2 d. 1 2 1 2 3 1 1 2

a

Question 24 Marks: 1 Consider the following function: void fun(int n) { if (n <= 0) System.out.println("That's all!"); else { for(int i = 1; i <= n; i++) System.out.print("*"); System.out.println( ); fun(n - 2); } } What is the output when the statement fun(5); is run? Choose one answer. a. ***** *** * That's all! b. That's all! ***** *** * c. * *** ***** That's all! d. **** ** * That's all!

b

Question 25 Marks: 1 Select the statement that is most correct. Suppose we are considering a doubly linked list and p is a node in the list which has both predecessor and successor nodes. What does the java code snippet below do? Node p1,p2; p1 = p.prev; // prev is a link to previous node p2=p.next; p2.prev = p1; p1.next = p2; Choose one answer. a. It deletes the node after p. b. It deletes the node p. c. It deletes the node before p. d. It does not make any change on the list.

C

Question 3 Marks: 1 Which of the following statements is true: Choose one answer. a. All the sorting methods implemented in java is applied to any basic data type except bool type. b. For objects comparison, a comparison criterion must be implemented by user. c. All of the others.

b

Question 32 Marks: 1 The operation for adding an entry to a stack is traditionally called: Choose one answer. a. insert b. push c. append d. add

a

Question 35 Marks: 1 Study the following statements: (1) A drawback of a balanced tree is the search-time may be out of control. (2) The DSW algorithm can be used to rebalance a binary tree. (3) An AVL tree is one in which the height of the left and the right subtrees of the every node must be same. The statement (1) is ....., the statement (2) is ...... and the statement (3) is ...... Choose one answer. a. False, true, false b. True, false, true c. True, true, true d. False, false, false

a

Question 42 Marks: 1 Select incorrect statement: Choose one answer. a. The characteristic feature of extendible hashing is the organization of the index, which is expandable table. b. A reorganization of the file is avoided by using extendible hashing if the directory overflows. c. Extendible hashing is faster than and requires less space than Linear hashing. d. Linear hashing is a directoryless technique.

d

Question 42 Marks: 1 Select incorrect statement: Choose one answer. a. The characteristic feature of extendible hashing is the organization of the index, which is expandable table. b. A reorganization of the file is avoided by using extendible hashing if the directory overflows. c. Extendible hashing is faster than and requires less space than Linear hashing. d. Linear hashing is a directoryless technique.

c

Question 45 Marks: 1 Specify the statement that is most correct about a circular linked list. Choose one answer. a. In circular linked-list, it is required to define head and tail node b. Circular linked list is a normal doubly-linked list c. Circular linked list is a linked list in which the last node of the list points to the first node in the list. d. Circular linked list is a normal linked list


Set pelajaran terkait

Chapter 22 - Leases and Property Types

View Set

Sherpath: Skeletal Disorders and Immobilization

View Set

Finance 101 (Quizes and practice 03)

View Set

The Medical Office Assistant Module Test

View Set