Created 07/09/03; edited 06/13/15


Quiz on Data Structures

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.


1. Which was the first book written on data structures?

A.    Programming Paradigms
B.    Fundamentals of Data Structures
C.    DOS for Dummies
D.    The Art of Computer Programming

2. What is a data structure?

A.    Any collection of data in main memory.
B.    A collection of data that includes the structural relationships betweeen the data.
C.    A collection of data and subroutines that operate on the data.
D.    Any empty form that can be filled in with data.

3. In a linear data structure, each element has a (1)___________ and a (2)_________, except for the first element which has no (3)__________ and the last element which has no (4)____________.

A.    (1) predecessor, (2) successor, (3) predecessor, (4) successor.
B.    (1) predecessor, (2) successor, (3) successor, (4) predecessor.
C.    (1) head, (2) tail, (3) tail, (4) head.
D.    (1) data, (2) link, (3) data, (4) link.

4. May the data in an element of a data structure itself have structure?

A.    No. Data must be the same size as the MIPS word size.
B.    No. Data must be a primitive type such as integer or float.
C.    Yes. The internal structure of the data in a node may be arbitrarily complex.
D.    Yes. It can have the same structure as the outer structure of all the data.

5. What are the two sections of a node in a linked list?

A.    The data and the counter.
B.    The data and the null.
C.    The data and the link to the successor node.
D.    The data and the link to the predecessor node.

6. Examine this fragment:

          ?????   $s0,head
          . . .
          
          .data
head:     .word   7

Replace ???? with the instruction that will place the address of head into $s0.

A.    lw
B.    li
C.    la
D.    sw

7. Examine this fragment:

          ?????   $s0,head
          . . .
          
          .data
head:     .word   7

Replace ???? with the instruction that will place the contents of head into $s0.

A.    lw
B.    li
C.    la
D.    sw

8. Examine the following code fragment, which traverses a linked list starting at the head. Each node is 8 bytes long.

        la    $s1,head
        
loop:   ????  $s1,exit
        
        ....
        lw    $s1,4($s1)
        b     loop

What instruction should replace ????

A.    jr
B.    lw
C.    bnez
D.    beqz

9. What is the usual value used for null with a data structure?

A.    0x00000000
B.    0x00
C.    0xFFFFFFFF
D.    0x11111111

10. Are the nodes of a linked list always arranged in in order in main memory?

A.    No. This might happen, but usually does not.
B.    No. The nodes are always contiguous, but not may not be in order.
C.    Yes. In a linear data structure the data in memory is laid out in order.
D.    Yes. In order to traverse the structure the data must be in order.

   The number you got right:       Percent Correct:       Letter Grade:   


Click here

If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.