Mid termexam review

32
MidTerm Review MidTerm Review Chapters 1 - 8 Chapters 1 - 8 for any two paths, difference in path lengths never more than a factor of 2

Transcript of Mid termexam review

Page 1: Mid termexam review

MidTerm ReviewMidTerm Review

Chapters 1 - 8Chapters 1 - 8

–for any two paths, difference in path lengths never more than a factor of 2

Page 2: Mid termexam review

Which statement is NOT true Which statement is NOT true about Hierarchical Data about Hierarchical Data Structures?Structures?

a. Zero or more successorsa. Zero or more successors b. Referred to as b. Referred to as treestrees c. Each element has more than one c. Each element has more than one

predecessor.predecessor. d. Each element has one d. Each element has one

predecessor.predecessor.

–Chapter 7 Essential Concepts

Page 3: Mid termexam review

What three items are included in What three items are included in Software Design componentsSoftware Design components

a. Interface, Implementation, a. Interface, Implementation, Test PlanTest Plan

b. Preconditions, b. Preconditions, Postconditions, ImplementationPostconditions, Implementation

c. Interface, Preconditions, c. Interface, Preconditions, PostconditionsPostconditions

d. Interface, Specification, d. Interface, Specification, Postconditions Postconditions

Chapter 1, Page 9Chapter 1, Page 9

Page 4: Mid termexam review

Object Oriented Design Object Oriented Design decomposes the problemdecomposes the problem

a. According to activitiesa. According to activities b. Rationallyb. Rationally c. According to relationsc. According to relations d. Functionallyd. Functionally

Chapter 1, Page 10

Page 5: Mid termexam review

A technique for proving the A technique for proving the correctness of a program is calledcorrectness of a program is called

a. Program Testinga. Program Testing b. Project Verificationb. Project Verification c. Program Verificationc. Program Verification d. Program Validationd. Program Validation

Chapter 1, Page 23

Page 6: Mid termexam review

The first widely used Object The first widely used Object Oriented Language is Oriented Language is

a. Pascala. Pascal b. Algolb. Algol c. Javac. Java d. C++d. C++

Chapter 2, Page 43

Page 7: Mid termexam review

When two classes are related by When two classes are related by inheritance, it is a __________ inheritance, it is a __________ relationshiprelationship a. Has-aa. Has-a b. Top Downb. Top Down c. Is-ac. Is-a

Chapter 2, Page 51

Page 8: Mid termexam review

An (a) ________ consists of An (a) ________ consists of _______ classes._______ classes.

a. Java program; finala. Java program; final b. Interface; concreteb. Interface; concrete c. Implementation; staticc. Implementation; static d. Interface; abstractd. Interface; abstract

Chapter 4; Page 189

Page 9: Mid termexam review

t ~ O(f(n)) is readt ~ O(f(n)) is read

a. t is a function of n.a. t is a function of n. b. t is on the order of f(n)b. t is on the order of f(n) c. n Is a function of t c. n Is a function of t d. n is raised to the t powerd. n is raised to the t power

Chapter 5, Page 247Chapter 5, Page 247

Page 10: Mid termexam review

The algorithmic behavior least The algorithmic behavior least studied is the studied is the

a. Worst-Casea. Worst-Case b. Average-Caseb. Average-Case c. Best-Casec. Best-Case d. Least-Cased. Least-Case

Chapter 5, Page 249

Page 11: Mid termexam review

A sequential search algorithm A sequential search algorithm looks at every item in an n-item looks at every item in an n-item list tolist to

a. locate the last occurrence of a specific a. locate the last occurrence of a specific targettarget

b. sort the items in the listb. sort the items in the list c. decrement every item in the listc. decrement every item in the list d. locate the first occurrence of a specific d. locate the first occurrence of a specific

targettarget

Chapter 5, Page 252

Page 12: Mid termexam review

Recursion is less efficient than Recursion is less efficient than looping.looping.

a. Truea. True b. Falseb. False

Chapter 5, Section 5.5.2

Page 13: Mid termexam review

The merge sort is an example The merge sort is an example of aof a

a. static sorting algorithma. static sorting algorithm b. limited bubble sortb. limited bubble sort c. primitive data structurec. primitive data structure d. stable sorting algorithmd. stable sorting algorithm

Chapter 5, Page 276

Page 14: Mid termexam review

The merge sort is an example The merge sort is an example of aof a

a. static sorting algorithma. static sorting algorithm b. limited bubble sortb. limited bubble sort c. primitive data structurec. primitive data structure d. stable sorting algorithmd. stable sorting algorithm

Chapter 5, Page 276

Page 15: Mid termexam review

A Data Type is a collection of A Data Type is a collection of values along with a set ofvalues along with a set of

a. algorithms defined on these a. algorithms defined on these values algorithms defined on these values algorithms defined on these values.values.

b. computer functions.b. computer functions. c. operations defined on these c. operations defined on these

values.values. d. Both b and c.d. Both b and c.

Chapter 6, Page 288Chapter 6, Page 288

Page 16: Mid termexam review

Sequencing through the nodes of Sequencing through the nodes of a linear structure is known asa linear structure is known as

a. traversal.a. traversal. b. iteration.b. iteration. c. recursion.c. recursion. d. marshalling.d. marshalling.

Chapter 6, Page 289

Page 17: Mid termexam review

For Lists, the current position For Lists, the current position indicator is known as a indicator is known as a

a. indexa. index b. cursorb. cursor c. nodec. node d. position numberd. position number

Chapter 6, Page 294

Page 18: Mid termexam review

A set is a collection of objects with A set is a collection of objects with no duplicates andno duplicates and

a. is accessed by a key access table.a. is accessed by a key access table. b. is openly addressed by tuplesb. is openly addressed by tuples c. The order objects in the collection c. The order objects in the collection

is immaterial.is immaterial. d. None of the above.d. None of the above.

Chapter 8, Page 509

Page 19: Mid termexam review

The list interface can be The list interface can be implemented as _______ based implemented as _______ based and _________ based methods.and _________ based methods.

a. array, referencea. array, reference b. array, pointerb. array, pointer c. binary, referencec. binary, reference d. array, recursived. array, recursive

Chapter 6, Page 305

Page 20: Mid termexam review

A stack is a _________ linear A stack is a _________ linear data structuredata structure

a. LILOa. LILO b. LIFOb. LIFO c. FIFOc. FIFO d. FILOd. FILO

Chapter 6, Page 347

Page 21: Mid termexam review

A Queue is a _________ A Queue is a _________ linear data structurelinear data structure

a. LILOa. LILO b. LIFOb. LIFO c. FIFOc. FIFO d. FILOd. FILO

Chapter 6, Page 358

Page 22: Mid termexam review

Two widely used techniques Two widely used techniques for implementing sets arefor implementing sets are

a. Trees and queuesa. Trees and queues b. Arrays and linked listsb. Arrays and linked lists c. Linked lists and treesc. Linked lists and trees d. Deques and Arraysd. Deques and Arrays

Chapter 8, Page 514

Page 23: Mid termexam review

Starting at the root and visiting Starting at the root and visiting every node on the tree is known every node on the tree is known as treeas tree a. trackinga. tracking b. traversalb. traversal c. iterationc. iteration d. walkingd. walking

Chapter 7, Page 399Chapter 7, Page 399

Page 24: Mid termexam review

A tree is ______ if it is a finite set A tree is ______ if it is a finite set of nodes that is either empty or of nodes that is either empty or consists of a root and a left child consists of a root and a left child and a right child.and a right child.

a. generala. general b. redb. red c. tertiaryc. tertiary d. binaryd. binary

Chapter 7, Page 398

Page 25: Mid termexam review

Databases are usually modeled Databases are usually modeled by the ________ data structure.by the ________ data structure.

a. nodala. nodal b. treeb. tree c. listc. list d. tabled. table

Chapter 6, Page 292

Page 26: Mid termexam review

Visiting every node in a graph Visiting every node in a graph is known as is known as

a. iteratinga. iterating b. marshalling b. marshalling c. scalingc. scaling d. traversald. traversal

Chapter 8, Page 568

Page 27: Mid termexam review

Tree nodes store information.Tree nodes store information.

a. Truea. True b. Falseb. False

–Chapter 7 Essential Concepts

Page 28: Mid termexam review

Prefix RepresentationPrefix Representation

a. operator written before operands a. operator written before operands b. operator written between b. operator written between

operands operands c. operator written after operands c. operator written after operands d. undefinedd. undefined

–Chapter 7 Essential Concepts

Page 29: Mid termexam review

Postfix RepresentationPostfix Representation

a. operator written before operands a. operator written before operands b. operator written between b. operator written between

operands operands c. operator written after operands c. operator written after operands d. undefinedd. undefined

–Chapter 7 Essential Concepts

Page 30: Mid termexam review

Some methods of a binary Some methods of a binary tree includetree include

a. prune()a. prune() b insertRight()b insertRight() c. insertLeft()c. insertLeft() d. equals()d. equals() e. All of the abovee. All of the above f. b and c f. b and c

–Chapter 7 Essential Concepts

Page 31: Mid termexam review

Heap is a binary tree Heap is a binary tree satisfying two conditions:satisfying two conditions: a. Order Property; Release Propertya. Order Property; Release Property b. Structure Property; Insert b. Structure Property; Insert

PropertyProperty c. Order Property; Structure c. Order Property; Structure

PropertyProperty d. Traversal Property; Structure d. Traversal Property; Structure

PropertyProperty

–Chapter 7 Essential Concepts

Page 32: Mid termexam review

For any two paths, difference in For any two paths, difference in path lengths never more than a path lengths never more than a factor of 2factor of 2 a. Linear Treea. Linear Tree b. B-Treeb. B-Tree c. Red/Black treec. Red/Black tree d. AVL Treed. AVL Tree

–Chapter 7 Essential Concepts