You are on page 1of 17

UGRD-ITE6201 Data Structures and

Algorithms
(Prelim Exam)
Made By (DARKX)
Highest grade: 80.00 / 100.00.

It is a first in-first out data structure. 

ANSWER: queue 

It takes the topmost element from the stack.

ANSWER: None of the above (WRONG) Try / pop()

It contains an element field to store an element value, and a next field to store a pointer to the
next node on the list. 

ANSWER:  Link class (WRONG) Try / Data (WRONG) Try / Data element

In building linked list, it needs three pointers to build: one to point to the first node in the list,
one to point to the last node and one to create the new one. 

ANSWER: True

These defines the logical form of the data type. 

ANSWER: ADT

It is a linear data structures that can accessed, store and removed at one end. 

ANSWER: stack 
Returns the last element in the queue.

ANSWER: back() (WRONG) Try / None of the above (WRONG) Try / T& back()

It is a last-in-first out data structure.

ANSWER: stack (WRONG) Try / queue

Pop operation happens at the bottom of the stack. 

ANSWER: False

This stack operation clears the stack. 

ANSWER: clear ()

A data structure requires a large amount of space for each data item stores and a large amount
of time to perform a single operation and a certain amount of programming effort.

ANSWER: False

Linked list contains the null value before inserting a node. 

ANSWER: True

Checks if the queue is empty.

ANSWER: isEmpty()

It is a collection of values. 

ANSWER: variable (WRONG) Try / data type (WRONG) Try / type


It is a list-like structure in which elements are removed from only one end. 

ANSWER: stack 

It removes the first element in the queue. 

ANSWER: remove() (WRONG) Try / pop() (WRONG) Try / void pop()

It is a stack operation that removes an item on top of the stack. 

ANSWER: pop

Elements are added on top of the queue. 

ANSWER: False

List nodes has a single pointer to the next node on the list. 

ANSWER: singly linked list

It is a type together with the collection of operations to manipulate the type. 

ANSWER: data type

It is a mathematical model for a certain class of data structure that has similar behavior.

ANSWER: abstract data type

This member function removes the top element of the stack. 

ANSWER: pop() (WRONG) Try / remove() (WRONG) Try / void pop()

This stack operation checks if the stack is empty. 


ANSWER: isEmpty (WRONG) Try / isEmpty ()

This queue operation takes the first element from the queue.

ANSWER: dequeue()

The accessible element of the stack is called.

ANSWER: top element

This queue operation clears the queue. 

ANSWER: clear() 

This member function creates an empty queue.

ANSWER: queue()

Returns the topmost element in the stack without removing it. 

ANSWER: None of the above (WRONG) Try / topEl() 

Push operation happens at the top of the stack.

ANSWER: True

It is a collection of nodes wherein every node contains the address of the next node.

ANSWER: linked list

Returns the first element in the queue without removing it. 


ANSWER: firstEl()

After removing the first element from the queue of 10  5   15  7. Which element will be the first
element? 

ANSWER: 7 (WRONG) Try / NONE OF THE ABOVE (WRONG) Try / 5

It is simply as a waiting line that grows by adding an elements to its end and shrinks by taking
elements from its front. 

ANSWER: queue

Inserts an element at the end of the queue.

ANSWER: push()  (WRONG) Try / void push()

Elements are added  and remove on the top of the stack.

ANSWER: True

A type of linked list that arranged elements according to some criteria.

ANSWER: sorted lists

10   5   15    7. Which element will be remove from the queue? 

ANSWER: 7 (WRONG) Try / 10 

It is a physical data structure. 

ANSWER: Array 

It is a piece of information whose values is drawn from a type.


ANSWER: data item

It is a list of items.

ANSWER: Array (WRONG) Try / array list (WRONG) Try / linked list

A stack is called LIFO structure. Last in/first out. 

ANSWER: True

This member function creates an empty stack. 

ANSWER: EmptyStack()  (WRONG) Try / create stack() (WRONG) Try / stack()

The value stored in a pointer variable is indicated by an arrow pointing to something.

ANSWER: true 

It puts an element on the top of the stack. 

ANSWER: push() (WRONG) Try / push(el)

This type of linked list whose elements are in no particular order. 

ANSWER: unsorted list

It is a stack operation that inserts a data item onto the structure. 

ANSWER: push

This queue operation puts an element at the end of the queue.


ANSWER: enqueue (WRONG) Try / enqueue(el)

This linked list operation determines whether a particular item is in the list. 

ANSWER: Search 

Each node in a linked list must contain at least ___________________.

ANSWER: Two fields

Which is the pointer associated with the stack?

ANSWER: TOP

This refers to a linear collection of data items.

ANSWER: List

Which of the following names does not relate to stacks?

ANSWER: FIFO lists

A pointer variable which contains the location at the top element of the stack.

ANSWER: TOP

Which is the pointer associated with the availability list?

ANSWER: AVAIL
The term used to insert an element into stack.

ANSWER: push

This indicates the end of the list.

ANSWER: Sentinel

This is the term used to delete an element from the stack.

ANSWER: Pop

The operation of processing each element in the list is known as ________________.

ANSWER: traversal

Returns the number of elements in the queue. 

ANSWER: None of the above (WRONG) Try / size_type() (WRONG) Try / size_type
size() cost

The average case occurs in linear search algorithm _______________.

ANSWER: when item is somewhere in the middle of the array

The complexity of sorting algorithm measures the __________ as a function of the number n of
items to be shorter.

ANSWER: running time

The complexity of merge sort algorithm.

ANSWER: O(n logn)


The worst case occurs in linear search algorithm when ________________.

ANSWER: Item is the last element in the array or item is not there at all

_____________ order is the best possible for array sorting algorithm which sorts n item.

ANSWER: O(n+logn)

The complexity of linear search algorithm.

ANSWER: O(n)

___________ sorting algorithm is frequently used when n is small, where n is the total number of
elements.

ANSWER: Insertion

Which of the following is not the required condition for binary search algorithm?

ANSWER: There must be mechanism to delete and/or insert elements in list

State True or False for internal sorting algorithms.

i. Internal sorting are applied when the entire collection if data to be sorted is small enough that
the sorting can take place within main memory.

ii. The time required to read or write is considered significant in evaluating the performance of
internal sorting.

ANSWER: True, False

The method used by card sorter.

ANSWER: Radix sort


In a graph, if E=(u,v), it means _____________.

ANSWER: u is adjacent to v but v is not adjacent to u (WRONG) Try /


e begins at processor u and ends at successor v

This is a binary tree whose every node has either zero or two children.

ANSWER: extended binary tree

The depth of complete binary tree is given by ________________.

ANSWER: Dn = log2n+1

Which indicates pre-order traversal?

ANSWER: Root, Left sub-tree, Right sub-tree

A connected graph T without any cycles is called a ____________.

ANSWER: A tree graph (WRONG) Try / all of these

This is a terminal node in a binary tree.

ANSWER: Leaf

Graph G is _____________ if for any pair u, v of nodes in G, there is a path from u to v or path from
v to u.

ANSWER: Unliterally connected


Another name for directed graph.

ANSWER: Digraph

A connected graph T without any cycles is called ________________.

ANSWER: no cycle graph (WRONG) Try / free graph

In a graph, if e=[u,v], then u and v are called _______________

ANSWER: All of the choices

It provides a natural organization for data. 

ANSWER: Trees

It is a pair of nodes. 

ANSWER: edge of tree

It is a binary tree that stores a collection of elements with their associated keys at its nodes.

ANSWER: heap

Merge sort combines the two sorted sublists into one sorted list. 

ANSWER: True

It returns true if the tree is empty and false otherwise. 

ANSWER: empty()
This graph operation stores the graph in computer memory.

ANSWER: graph (WRONG) Try / none of the above (WRONG) Try / create the graph

It is an abstract data type that stores elements hierarchically.

ANSWER: tree

Returns the left child of the p. 

ANSWER: p.left()

It is an array of size N where each cell of A is thought of as a bucket

ANSWER: bucket array 

It returns true if map is empty and false otherwise. 

ANSWER:   empty() 

It is a pair sets of vertices that connects through edges. 

ANSWER: graph 

It allows you to store elements so they can be located quickly using keys.

ANSWER: storage (WRONG) Try / hash map

A linear ordering of a tree.

ANSWER: Children node (WRONG) Try / Ordered trees


It is consists of two major components: bucket array and a hash function.

ANSWER: hash table

It stores elements at the nodes of the tree.

ANSWER: tree 

It returns the number of entries in map. 

ANSWER: entries()  (WRONG) Try / number() (WRONG) Try / None of the above

It returns a position list containing the children of node p. 

ANSWER: p.children()

It sorts the list by moving each element to its proper place.

ANSWER: insertion sort 

A binary tree function that removes the last node of the tree and return its element

ANSWER:   remove()

This graph operation makes the graph empty. 

ANSWER:   Empty graph (WRONG) Try / Empty (WRONG) Try / Clear the graph

In a directed graph, edges  are drawn using lines. 

ANSWER: False
It is similar to preorder traversal of a binary tree.

ANSWER: depth-first traversal

The list is partitioned and combining the sorted lowerSublist and upperSublist is trivial.

ANSWER: quicksort

It is an ordered tree in which every node has at most two children. 

ANSWER: binary tree 

It removes from the map the entry. 

ANSWER: remove() (WRONG) Try / erase() (WRONG) Try / erase(k)

The graphs must be stored in computer memory. 

ANSWER: True

A list is sorted by selecting elements in the list, one at a time, and moving them to their proper
positions. 

ANSWER: Selection sort 

Returns the parent of p. 

ANSWER: p.parent()

It is a node where it stores an element. 

ANSWER: left subtree (WRONG) Try / tree  (WRONG) Try / right subtree


It returns the parent of the tree. 

ANSWER: parent()  (WRONG) Try / p.parent()

In a tree structure, has a parent element and zero or more children elements. 

ANSWER: True

A tree is either empty or consist of nodes. 

ANSWER: True

It uses divide-and-conquer technique to sort a list by partitioning the list into two sublists.

ANSWER: merge sort 

It returns a position for the tree’s root. 

ANSWER: root()

This graph traversal that traverse a binary tree level-by level. 

ANSWER: none of the above (WRONG) Try / depth-first traversal

These are used to model electrical circuits, chemical compounds and highway maps. 

ANSWER: graphs
What is the first sublist of the following sets of number

10 18 17 15 21  34  36 32 33 37

[1]

ANSWER:
In an undirected graph, edges are drawn using lines.

ANSWER: False

It return an iterator to the first entry of M. 

ANSWER: begin()

It return true if p is the root and false otherwise. 

ANSWER: Root() (WRONG) Try /  p.isRoot()

A linear list in which the pointer points only to the successive node.

ANSWER: singly linked list

The elements are removal from a stack in _________ order.

ANSWER: Reverse

This form of access is used to add and remove nodes from a queue.

ANSWER: FIFO, First In First Out

Value of first linked list index is _______________.

ANSWER: 0

New nodes are added to the ________ of the queue.

ANSWER: Back
The situation when in a linked list START=NULL is ____________________.

ANSWER: Underflow

Linked lists are best suited _____________________.

ANSWER: for the size of the structure and the data in the structure are constantly
changing

You might also like