Filters
Question type

Study Flashcards

A ragged grid has a fixed number of columns and a variable number of rows.

A) True
B) False

Correct Answer

verifed

verified

A linked structure can be stored in noncontiguous memory.

A) True
B) False

Correct Answer

verifed

verified

In Python, a node in a doubly linked structure contains two fields: a data item and a reference to the next node.

A) True
B) False

Correct Answer

verifed

verified

What action does the following code perform assuming the Node class defined in Chapter 4? ​ head = Node(newItem, head)


A) deletion of an item in a linked list
B) appending an item to the end of a linked list
C) replacing an item at the beginning of a linked list
D) insertion of an item at the beginning of a linked list

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

Which statement tests if a singly linked node variable named myItem has been initialized?


A) if myItem is Null:
B) if myItem != None:
C) if myItem = None:
D) if myItem is not Null:

E) B) and C)
F) All of the above

Correct Answer

verifed

verified

What is the operation on a linked structure called that visits each node without deleting it?


A) probe
B) insertion
C) removal
D) traversal

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

The list is the primary implementing structure in Python collections.

A) True
B) False

Correct Answer

verifed

verified

What type of memory scheme does a linked list use?


A) overlapping
B) noncontiguous
C) sequential
D) random

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

B

The following code sums all the values in the two-dimensional array. What is the missing code? Sum = 0 For row in range(grid.getHeight() ) : For column in range(grid.getWidth() ) : < missing code >


A) sum += grid[ column ][ row ]
B) sum += grid[ row-1 ][ column-1 ]
C) sum += grid[ column+1 ][ row+1 ]
D) sum += grid[ row ][ column ]

E) All of the above
F) None of the above

Correct Answer

verifed

verified

Which of the following is an advantage of a doubly linked structure over a singly linked structure?


A) it is less complex to implement
B) you can easily access the predecessor of an item
C) you can easily access the successor of an item
D) it uses less memory

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

On average, what is the performance of a sequential search on a singly linked structure?


A) logarithmic
B) linear
C) exponential
D) random

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

On a linked structure, index-based operations must be emulated by manipulating links within the structure.

A) True
B) False

Correct Answer

verifed

verified

To start a traversal of a linked structure, initialize a variable to the structure's head pointer.

A) True
B) False

Correct Answer

verifed

verified

In the Array class defined in Chapter 4, how do you instantiate an array object that can hold 10 values?


A) myArray(10) = Array
B) Array myArray, 10
C) myArray = Array(10)
D) Array(10) myArray

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The process for resizing an array named myArray is shown below. What is the missing code? if logicalSize == len(myArray) : Temp = Array(len(myArray) + 1) For i in range(logicalSize) : < missing code > A = temp


A) myArray[ temp ] = myArray[ i ]
B) temp [ i ] = myArray[ i ]
C) myArray[ i ] = temp[ i ]
D) temp = myArray(len(myArray) )

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

B

What process is required to avoid wasting memory if successive calls to the pop method on a list are made?


A) delete the array
B) grow the array
C) reset the array
D) shrink the array

E) C) and D)
F) B) and C)

Correct Answer

verifed

verified

Similar to an array, linked structures support random access.

A) True
B) False

Correct Answer

verifed

verified

In the following code to insert an item in an array, what is the missing code? for x in range(logicalSize, targetIndex, -1) : MyArray[x] = myArray[x - 1] A[targetIndex] = newItem < missing code >


A) targetIndex += 1
B) targetIndex -= 1
C) logicalSize += 1
D) logicalSize -= 1

E) C) and D)
F) None of the above

Correct Answer

verifed

verified

What method does Python's list type use to increase the size of the underlying array?


A) size
B) append
C) increase
D) augment

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

B

What type of operation is the following code performing? probe = head While probe != None and targetItem != probe.data: Probe = probe.next If probe != None: Probe.data = newItem Return True Else: Return False


A) sum of all items
B) replacement
C) insertion
D) deletion

E) B) and D)
F) C) and D)

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer