CSD201
CSD201
| Managing
function calls, The stock span problem, Arithmetic expression evaluation.
Which of the following is true about linked list implementation of stack? | In push
operation = False.
To evaluate an expression without any embedded function calls: | One stack is
enough.
What is written to the screen for the input "FileComp****ress*ion**" ? | iserCeliF
Suppose the f(n) function is defined on the set of integer numbers as below. What
is the value of f(-5)? | 3
An algorithm that calls itself directly or indirectly is known as | Recursion
Which data structure allows deleting data elements from front and inserting at
rear? | Queues
Identify the data structure which allows deletions at both ends of the list but
insertion at only one end. | Input-restricted deque
Which of the following data structure is non-linear type? | (Strings, Lists,
Stacks)= False.
Which of the following data structure is linear type? | (Strings, Lists, Stacks)=
True.
To represent hierarchical relationship between elements, which data structure is
suitable? | Tree
A binary tree whose every node has either zero or two children is called | Extended
binary tree
The depth of a complete binary tree is given by | Dn = log2n + 1
When representing any algebraic expression E which uses only binary operations in a
2-tree, | the variable in E will appear as external nodes and operations in
internal nodes
A binary tree can easily be converted into q 2-tree | by replacing each ... new
external node
When converting binary tree into extended binary tree, all the original nodes in
binary tree are | internal nodes on extended tree
The post order traversal of a binary tree is DEBFC. Find out the pre order
traversal | ABDECF
Which of the following sorting algorithm is of divide-and-conquer type? | Quick
sort
In a binary tree, certain null entries are replaced by special pointers which point
to nodes higher in the tree for efficiency. These special pointers are called |
thread
The in order traversal of tree will yield a sorted listing of elements of tree in |
Binary search trees
In a Heap tree | Values in a node is greater than every value in children of it
In a graph if e=[u, v], Then u and v are called | endpoints of e & adjacent nodes &
neighbors
A connected graph T without any cycles is called | a tree graph & free tree & a
tree
In a graph if e=(u, v) means | e begins at u and ends at v & u is processor and v
is successor
If every node u in G is adjacent to every other node v in G, A graph is said to be
| complete
Suppose a singly linked list of integers is given below: (head)7 10 6 4 2 13 8
3(tail) | 7 10 6 4 2 13 8 5 3
Multi-programming. | may use a queue
Select the most correct statement about the complexity of bubble sort * | The best
case is 0(n). and the worst case is 0(n~2)
Object dequeue() {if (isEmpty()) return(null); return(pool.remove(0));} | True
What is written to the screen for the input "HowAre**YouTo***Day" ? | ToDay
Suppose a singly linked list of integers is given below and p is a reference to the
node with value 9 in the list (i.e. p.info=9): (head) 7 11 6 4 3 9 8 21 (tail) | 7
11 6 4 3 13 9 8 21
In a linked list, the tail node is introduced for performance purpose only. | True
Using the Huffman code tree below. What is the result of decoding the string:
1100000001100 ? | AABBBCAB
Which call will result in the most recursive calls? | fun(-1012);
Select the most correct statement about the complexity of insertion sort | The best
case is 0(n). and the worst case is 0(n~2)
A recursive method is a method that invokes itself directly or indirectly. For a
recursive method to terminate there must be one or more base cases. | Most Correct
The operation for removing and returning the top element of the stack is
traditionally called: | pop
What is the breadth-first traversal of a tree below after deleting the node 5 by
merging? | 2.1.4. 3. 7. 6. 8
In a singly-linked list we can insert a node after a given node with time
complexity 0(1) | True
In a singly-linked list there is no efficient way to insert a node before a given
node in the middle of the list (the action is considered efficient if it's
complexity is 0(1)). | True
Specify the reason for data compression (select the best answer): | Saving data
storage
Suppose you are using the LZW algorithm to encode the message AABCADAB contents of
the dictionary at the beginning of encoding are: (1) A (2) B (3) C (4) D What
string is denoted by code word (5)7 | AA
Linked lists are best suited | for relatively permanent collections of data.
Consider the binary tree below. Which statement is correct? (full binary tree =
proper binary tree = 2-tree) | The tree is neither complete nor full.
The complexity of heap sort is | 0(nlog n)
What is the minimum number of nodes in a full binary tree with height 3? find a
tree the height of root is 1. and in a full binary tree every node other than tle
leaves has two children). | 7
What is the minimum number of nodes in a nearly complete binary tree with heigh 4?
| 7
Given a raw message 'FFFF0000FFF00FFFFF00' (without single quote). Run the run-
length encoding algorithm for that message, what is the output? | 4F403F205F20
Fill in the blank of the statement to form the most correct one: In a every element
contains some data and a link to the next element which allows to keep the
structure. | singly linked list
What is the correct definition of a hash table? | ...used for storing items or
their addresses... i = h(x) in the table.
Specify the correct statement about chaining method for handling collision | In
chaining ... keys or references to keys.
Which of the following applications may use a stack? | Auxiliary data structure for
algorithms.
Select the most correct statement about the complexity of selection sort | Both
best and worst cases are 0(n^2)
What values of n are directly handled by the stopping (base) case? | n==0&& n<35
6, 4, 7, 3, 5, 2 What is the balance factor of the node 4?(please note that the
tree is still AVL) | 0
Consider the AVL tree below. What is the breadth first traversal of the tree after
inserting a node with value 24? | 35, 22, 39, 12, 32, 37, 27, 24,
which call will result in the most recursive calls ? | fun(-1025)
Consider the binary tree below. Which statement is correct? | The tree is full but
not complete.
The Order followed by stack data structure is | FIFO
How many stack will be needed for the evaluation of a prefix expression | 0
If the two stacks are implemented on a single array, the overflow occurs at |
top1=top2 && top1=top2-1
Which of the following applications may use a stack? | Keeping track & A
parentheses & Syntax analyzer for a compiler.
Given a search() method in a binary search tree: Node search(int x) { Node p =
root; while(p!=null && p.info != x){if(p<p.info) p = p.left; else p=p.right;}
return(p);} The complexity of this algorithm is: | O(n)
What is the breadth-first traversal of a tree below after deleting the node 15 by
merging? | 30 5 40 10 35 25 20
void enqueue(Object x){Node p = new Node(x); p.next = null; if(isEmpty()) head =
tail = p; else {tail.next = p; tail = p;}} | True
What is written to the screen for the input "Go**od**Mor*ni*ng*Sir"? | oGdorig
In a singly-linked list every element contains some data and a link to the next
element, which allows to keep the structure | True
What is the breadth-first traversal of a tree below after deleting the node 2 by
copying? | 5 1 7 4 6 8 3
Node f = head; while(f.next !=p) f = f.next; f.next = p.next; | it deletes the node
p.
Integer pop(){ if(isEmpty) return(null); return((Integer)pool.remove(pool.size()-
1)); } | True
void push(Integer x){ Node p = new Node(x); p.next = head; head=p; } | True
In a singly-linked list, there is no efficient way to insert a node before a given
node in the middle or at the end of the list, but we can insert a node after a
given node or at the beginning of the list with time complexity O(1) | True
void preOrder(Node p){ if(p = null) { visit(p); preOrder(p.left);
preOrder(p.right); } } | pre-order traverse algorithm
The memory address of the first element of an array is called | base address
The memory address of fifth element of an array can be calculated by the formula |
LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per
memory cell for the array
Which of the following data structures are indexed structures? | linear arrays
Which of the following is not the required condition for binary search algorithm? |
There must be mechanism to delete and/or insert elements in list
Which of the following is not a limitation of binary search algorithm? | binary
search algorithm is not efficient when the data elements are more than 1000.
Two dimensional arrays are also called | tables arrays && matrix arrays
A variable P is called pointer if | P contains the address of an element in DATA.
Which of the following data structure can't store the non-homogeneous data
elements? | Arrays
Which of the following data structure store the non-homogeneous data elements? |
Records
Each data item in a record may be a group item composed of sub-items; those items
which are indecomposable are called | elementary items & atoms & scalars
pointers store the next data element of a list | False
Binary search algorithm cannot be applied to | sorted binary trees
When new data are to be inserted into a data structure, but there is no available
space; this situation is usually called | overflow
The situation when in a linked list START=NULL is | underflow
Which of the following is two way list? | grounded header list;circular header
list;linked list..nodes=False
Which of the following name does not relate to stacks? | FIFO lists
The term "push" and "pop" is related to the | stacks
A data structure where elements can be added or removed at either end but not in
the middle | Deque
The complexity of linear search algorithm is | O(n)
The complexity of Binary search algorithm is | O(log n)
The complexity of Bubble sort algorithm is | O(n2)
The complexity of merge sort algorithm is | O(n log n)
The operation of processing each element in the list is known as | Traversal
What is written to the screen for the input "Go**odMorn**in***gSir"? | riSgMdo
What is the result of the breadth first traverse of the binary search tree T, after
inserting the following keys into the tree sequentially(suppose T is empty before
insertion): 7, 8, 4, 1, 3, 6, 9 | 7 4 8 1 6 9 3
Suppose a singly linked list of integers is given below. (head) 7 11 6 4 3 12 8 2
(tail) What does the list look like after the following java code snippet is run? |
7 11 6 4 3 12 8 5 2
Suppose T is a binary tree with 14 nodes. What is the minimum possible height of T?
| 4
A graph that has neither self-loops nor parallel edges are called____ | simple
graph
ch = top element of the stack S if ch is isolated then remove it from the stack and
put it to E else select the first vetex Y (by alphabet order). which is adjacent to
ch.push Y to S and remove the edge (ch.Y) from the graph | B, D, C, B, A, B
(1) Put the vertex X to H (2) Check if H is a Hamilton cycle the stop, else go to
(3) (3) Consider the last vertex Y in H, if there is/are vertex(es) adjacent to Y,
select the first adjacent vertex Z (by alphabet order) and put it to H. if there no
adjacent vertex, remove Y from H and denote it as bad selection (so you do not
select it in the same way again). Go to (2) | A, B, C, E, D, A
void inOrder(Node p){ if(p != null){ inOrder(p.left); visit(p);
inOrder(p.right);} } | True
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); } } | n>=0 &&
n<15
What is writen to the screen for the input "GoodA***fter****Noo**n"? | Adoretfoo
Given a weighted graph below. What is the total edge-weight of the minimum spanning
tree of G? | 27
void fun(int n){if(n>0) {System.out.print(" "+ n%5); fun(n); } } What will happen
if the statement fun(33): is run? | The operating system detects the infinite
recursion because of the "repeated state"
Node q = new Node(x); q.next = head; head = q; | inserts new node with value x at
the head of the list
What is writen to the screen for the input"H*owAre***You**To****Day"? | HowAreYouT
Integer pop() { if(isEmpty()) return (null); return((Integer)pool.removeLast()); }
| pop() method of a stack of Integers.
What is the breadth-first traversal of a tree below after deleting the node 5 by
copying? | 4 2 7 1 3 6 8
Consider the list of eight integers (n-8) below: 15, 13, 18, 19, 17, 12, 16, 14
What is the list after it is partitioned with low = 0 and up = n-1? | 12, 13, 14,
15, 17, 19, 16, 18
What is value of the Boundary Folding Hash Function if K = 42-58-67 and TSize =
100? | 94
int fun(int n) {if(n<0) return(fun(-n)); else if(n<5) return(2); else
return(n*fun(n-2)); } What is the value of fun(6)? | 12
Given the character frequencies B : 32% C : 28% D : 16% E : 6% F : 18% Using
Huffman encoding, what is the code for character C?(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) | 01
Consider a graph below. Cut-vertices in the graph are | b, c, e
void fun(int n) {if(n < 0) {System.out.println("-"); fun(-n); } else if(n<10)
System.out.println(n); else {fun(n/10); System.out.println(n%10); } } Which call
will result in the most recursive calls? | fun(-1023)
Suppose a doubly linked list of integers is given below and p is a reference to the
node with value 10 in the list(i.e. p.info=10): (head) 27 11 6 4 3 10 8 2(tail)
What does the list look like after the following java code sippet is run? | 27 11 6
4 3 10 19 8 2
Which of the following applications may use a stack? | Undo sequence in a text
editor
The operation for adding an entry to a queue is traditionally called: | enqueue
Suppose cursor refers to a node in a linked list (using the IntNode class with
instance variables called data and link). What statement changes cursor so that it
refers to the next node? | cursor = cursor.link;
In the linked list version of the Bag class an instance variable manyNodes is used
to keep track of how long the linked list is. Why not just make a call to the
IntNode method listLength()? | The listLength() method is O(n) and the alternative
is O(1).
Suppose that the Bag is implemented with a linked list. Which of these operations
are likely to have a constant worst-case time? | add
What is the expression for generating a pseudorandom number in the range 1...N? |
(int) (Math.random() * N) + 1;
What kind of list is best to answer questions such as "What is the item at position
n?" | Lists implemented with an array.
Suppose that obj is an Object variable and s is a String variable. Which of the
following statements is a correctly-compiling widening conversion? Don't worry
about possible run-time exceptions. | obj = s
Suppose that obj is an Object variable and that it refers to an Integer object. If
s is a String variable, then which statement is correct about the assignment "s =
(String) obj;"? | The statement will compile, but there will be a run-time
exception.
What is a primary difference between an array and a Vector from Java's Class
Libraries: | Vectors grow automatically as needed.
Entries in a stack are "ordered". What is the meaning of this statement? | There is
a first entry, a second entry, and so on.
The operation for adding an entry to a stack is traditionally called: | push
The operation for removing an entry from a stack is traditionally called: | pop
Which of the following stack operations could result in stack underflow? | pop
Consider the usual algorithm for determining whether a sequence of parentheses is
balanced. What is the maximum number of parentheses that will appear on the stack
AT ANY ONE TIME when the algorithm analyzes: (()(())(()))? | 3
Suppose we have an array implementation of the stack class, with ten items in the
stack stored at data[0] through data[9]. The CAPACITY is 42. Where does the push
method place the new entry in the array? | data[10]
Consider the implementation of the Stack using a partially-filled array. What goes
wrong if we try to store the top of the Stack at location [0] and the bottom of the
Stack at the last used position of the array? | . Both push and pop would require
linear time.
In the linked list implementation of the stack class, where does the push method
place the new entry on the linked list? | At the head
In the array version of the Stack class, which operations require linear time for
their worst-case behavior? | False=(is_empty,peek,pop,push when the stack is below
capacity)
In the linked-list version of the Stack class, which operations require linear time
for their worst-case behavior? | False=(is_empty,peek,pop,push)
What is the value of the postfix expression 6 3 2 4 + - *: | Something between -15
and -100
One difference between a queue and a stack is: | Queues use two ends of the
structure; stacks use only one.
If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and
then removed one at a time, in what order will they be removed? | DCBA
Which of the following expressions evaluates to true with approximate probability
equal to P? (P is double and 0 <= P <= 1). | Math.random() < P
Suppose we have a circular array implementation of the queue class, with ten items
in the queue stored at data[2] through data[11]. The current capacity is 42. Where
does the insert method place the new entry in the array? | data[12]
Consider the implementation of the Queue using a circular array. What goes wrong if
we try to keep all the items at the front of a partially-filled array (so that
data[0] is always the front). | The getFront method would require linear time.
In the linked list implementation of the queue class, where does the insert method
place the new entry on the linked list? | At the tail
In the circular array version of the Queue class, which operations require linear
time for their worst-case behavior? | False=(getFront, isEmpty, insert when the
capacity has not yet been reached)
In the linked-list version of the Queue class, which operations require linear time
for their worst-case behavior? | False=(getFront, isEmpty, insert )
If data is a circular array of CAPACITY elements, and rear is an index into that
array, what is the formula for the index after rear? | (rear + 1) % CAPACITY
I have implemented the queue with a circular array, keeping track of front, rear,
and manyItems (the number of items in the array). Suppose front is zero, and rear
is one less than the current capacity. What can you tell me about manyItems? |
count could be zero or the capacity, but no other values could occur.
I have implemented the queue with a linked list, keeping track of a front node and
a rear node with two reference variables. Which of these reference variables will
change during an insertion into a NONEMPTY queue? | Only rear changes
I have implemented the queue with a linked list, keeping track of a front node and
a rear node with two reference variables. Which of these reference variables will
change during an insertion into an EMPTY queue? | front changes., rear changes.
Give a weighted graph below and you are using the Dijkstra algorithm to find the
sortest path from the vetex H to the vertex T. What is the label of the vertex D
when the shortest path from H to T is determined? | infinity
If every node u in G is adjacent to every other node v in G, a graph is said to be
| strongly connected
Suppose T is a binary tree with 14 nodes. What is the minimum possible height of T?
(Note: In a tree the height of root is 1) | 4
Suppose a doubly linked list of integers is given below and p is a reference to the
node with value 15 in the list(i.e. p.info=15): (head)7 11 6 4 3 15 8 12(tail) What
does the list look like after the following java code snippet is run? | 7 11 6 4 3
35 15 8 12
int fun(int n) {if(n < 0) return(fun(-n)); else if(n<5) return(2); else
return(n*fun(n/2)); } What is the value of fun(5) ? | 10
Give a graph below. What is the output of breadth-first traversal from vetex D?
(visit nodes in ABC order if there are some nodes having the same selection
ability). | D, C, F, B, G, A, E, H
Given the division hash function h(x) = x%M, where M = 10 and Collision Resolution
is linear probing. How the hash table looks like after inserting the following keys
sequentially? 95,33,221,204,53,243 | 4
Given the division hash function h(x) = x%M, where M = 10 and Collision Resolution
is quadratic probing. i.e. when inserting a key x, the collision is resolved by
finding an available position at (h(x) + i^2)%M), i=1, 2, ... How the hash table
looks like after inserting the following keys sequentially? | 3
Select the most correct statement about the complexity of heapsort | Both best and
worst cases are O(nlogn)
What is written to the screen for the input "Good**Mor*ni***ngSir"? | risgnMog
What is the value of the Shift Folding Hash Function if K = 43-65-69-7 and TSize =
100? | 84
Using the Huffman code tree below. What is the result of decoding the string:
10000010011? | ABBCD
Node p1,p2; p1 = p.next; p2 = p1.next; p.next = p2; if(p2!=null) p2.prev=p; | it
deletes the node after p.
Given a graph below. What is the output of depth-first traversal from vertex D?
(visit nodes in ABC order if there are some nodes having the same selection
ability). | D, C, B, A, E, G, F, H
What is value of the Boundary Folding Hash Function if K = 43-57-69 and TSize =
100? | 87
int fun(int n) {if(n<0) return(fun(-n)); else if(n<5) return(2); else
return(n*fun(n-2)); } Which call will result in the most recursive calls? | fun(-
1012);
Suppose a singly linked list of integers is given below and p is a reference to the
node with value 3 in the list(i.e. p.info=3): (head)7 11 6 14 3 9 8 12(tail) What
does the list look like after the following java code snippet is run? | 7 11 6 14 5
3 9 8 12
Given a weighted graph below and you are using the Dijkstra algorithm to find the
sortest path from the vertex H to the vertex T. What are the correct order of
vertices selected into the set S until the vertex T is selected?(Each step a vertex
with minimal current distance is selected into S). | H, A, B, D, T
Suppose a doubly linked list of integers is given below and p is a reference to the
node with value 3 in the list(i.e. p.info=3): (head)7 1 6 4 3 9 8 2(tail) What does
the list look like after the following java code sippet is run? | 7 1 6 4 3 8 2
In a _____every element contains some data and a link to the next element, which
allows to keep the structure | Singly linked list
Consider the following function: void quiz(int n) {if (n > 1) {quiz(n / 2);
quiz(n / 2); } System.out.print("* "); } How many asterisks are printed by the
function call quiz(5)? | 3
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? | *(/n)***(/n)*****(/n)That's all!
Suppose we are considering a doubly linked list and p is some node in the list
which has successor node. What does the java code snippet below do? Node p1, p2; p1
= new Node(x); p2 = p.next; p.next = p1; p1.prev = p; p1.next = p2; p2.prev = p1; |
it inserts new node with value x after the node p.
Basically, the complexity of inserting new element before a given node in the
middle of a singly linked lists is | O(n)
Store a waiting list of printing jobs. | may use a queue
void fun(int n) {if(n > 0) { fun(n-2); System.out.print(" " +n ); } } What is the
output when the statement fun(9); is run? | 1 3 5 7 9
Node q = new Node(x); q.prev=null; q.next = head; head.prev = q; head = q; | it
inserts new node with value x at the head of the list.
A _____ node contains some data and one link to its successor and one link to its
predecessor in the list. | doubly linked list
____will visit nodes of a tree starting from the highest (or lowest) level and
moving down (or up) level by level and at a level, it visits nodes from left to
right(or from right to left). | Breath-First Traversal
The keyword implements is used to specify that a class inherits from aninterface. |
True
Which of the following keywords are access modifier: | Protected, Private
Subclasses or derived classes inherit the fields... , An abstract datatype can be
part of a program in the form of an interface. | True
An object can be saved in a life if its class type is stated, If the vectors
capacity is greater than its size, then a new elem | True
Deleting a node at the beginning of th ...time O(1) - On the average,delete
operatio... O(n) steps, There is no immediate access to the predecessorof any node
in list | True about singly linked list
The node which is deleted from the list will ... e garbage collection, Deleting a
node at the end of...ant time O(1), Processing for adding a node tothe end of list
includes six steps | True about Doubly linked list
The search time is O(lgn) in the worst case , In 20-element skip lists, the node in
position 3 points to the | False about skip list
In the array list, poping is executed in O(lgn) to the worst case | False
The Java implementation of the stack is potenti, Stack can be implemented by linked
list | True about Stack
Which of the following can be executed in constant time O(n) | When deleting a node
of a singly linked list in the average case , in the worst case
The recursive version increases program readability, improves self-documentation
and simplifies coding | True
When converting a method from a recursive version into an iterative version | The
brevity of program formulation lost. However, the brevity may not bean issue in
Java , Program clarity can be diminished
Recursive definitions on most computers are eventually implemented using a run-time
stack and this implementation is done by the operating system. | True
In all cases, nonrecursive implementation is faster recursive implementation |
False
The height of a nonempty tree is the maximum level of node ,The level ofa node is
the length of the path from the root to the node plus 1,The level ofa node must be
between 1 and height of the tree | True about tree
For a binary tree with n nodes, there are n! different traversals, The complexity
of searching depends on the shape of the tree and the,Breath-First traversal | True
Depth-first traversal can not be implemented if ,A recursive implementation of
preorder tree trav,There are six possible ordered depth-first traversal | False
Polish notation eliminates all parentheses from formu, Using Polish notation, all
expressions have to be brok,Expression trees do not use | True
The complexity of DFS is O( | V | + | E | ), where | V | is number of ve, To
prevent loop from happen in an algorithm for traversing a grahp | True
Which of the following statements about finding the shortest path are true: | For
label-correcting method, information of any ,The complexity of Dijkstras algorithm
is O( | V | 2)
The complexity of sequential Coloring algorithm is O( | V | 2) ,Sequential Coloring
algorithm establishes the sequence of | True about Graph coloring
Which graph representation is best? | It depends on the problem
Which operation is used in DSW Algorithm: | Rotation
Which of the following methods are used to traverse a tree without using anystack
or threads: | Traversal through tree Transformation
In the array implementation, dequeuing can be executed in O(n) | False
The most top element is the latest added element , Operations of stack based on
Last in First out structure. | True about Stack
In the array implementation, enqueuing can be executed in constant time O(1) | True
Run-length encoding is very efficient for text file in which only blank character
has a tendency to be repeated without using any technique | True
In shift folding method, the key is usually divided into even, The boundary folding
method is applied to number data | True
If hash function transforms different keys into different numbers, it iscalled a
perfect hash function | True
bitRadixsort() can be improved by implementing array , One of techniquesradix sort
uses is by looking at each | Radix sort
Insertion sort is applied to small portions of an array, Mergesort can be made more
efficient by replacing | efficient sorting
which of the following queue operations could result in queue underflow (become
empty)? | dequeue
void fun(int n) {if(n > 0) { n = n/5; fun(n); System.out.print(" " + n); } } What
is the output when the statement fun(23); is run? | 0 4
What is written to the screen for the input "Good**Mor*ni***ng"? | dorino
In Huffman coding, both the sender and receiver must have a copy of the same code
in order for the decoded file to match the encoded file. | True
Which of the following data structure is non linear data structure? | Trees
Which of the following data structure is linear data structure? | Arrays
Finding the location of the element with a given value is: | Search
Arrays are best data structures | for relatively permanent <benvung> collections of
data
Linked lists are best suited | for the size of the structure and the data in the
structure are constantly changing
Each array declaration need not give, implicitly or explicitly, the information
about | the first data from the set to be stored
The elements of an array are stored successively in memory cells because | by this
way computer can keep track only the address of the first element and the addresses
of other elements can be calculated
Two dimensional arrays are also called | matrix arrays
A variable P is called pointer if | P contains the address of an element in DATA
Each data item in a record may be a group item composed of sub-items; those items
which are indecomposable are called | Scalars, atoms, elementary items
An array is suitable for homogeneous data but hte data items in a record may have
different data type | difference bw linear and record
In a record, there may not be a natural ordering in opposed to linear array. |
difference bw linear and record
A record form a hierarchical structure but a lienear array does not | difference bw
linear and record
Arrays are dense lists and static data structure | True
linked lists are collection of the nodes that contain information part and next
pointer | True
data elements in linked list need not be stored in adjecent space in memory | True
Which of the following is two way list? | doubly linked list
When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal
would return | FAEKCDHGB
Value of the first linked list index is _______ | Zero
A linked list index is ____ that represents the position of a node in a linked
list. | an integer
Why is the constructor of the LinkedList class empty? | bc...of the LinkedList
class is ...constructor of the LinkedList class.
_______ form of access is used to add and remove nodes from a queue | FIFO , First
In First Out
______ form of access is used to add and remove nodes from a stack | LIFO
New nodes are added to the _____ of the queue. | back
A _______ is a data structure that organizes data similar to a line in the
supermarket, where the first one in line is the first one out. | queue linked list
In an array queue, data is stored in an _____ element. | Array
The pop() member function determines if the stack is empty by calling the _____
member function | isEmpty()
What happens when you push a new node onto a stack? | the new node is placed at the
front of the linked list.
In a binary tree, certain null entries are replaced by special pointers which point
to nodes higher in the tree for efficiency. These special pointers are called |
Thread
The complexity of merge sort algorithm is a. | O(n log n)
Which of the following case does not exist in complexity theory | null case
A Linked list can grow and shrink in size dynamically at | run time
What member function places a new node at the end of the linked list? |
appendNode()
The _______ function retrieves the value of the size member of the LinkedList class
| getSize()
Elements of an array are stored _______ in memory | Sequentially
Each entry in a linked list is called a _______ | Link
How many parts are there in a declaration statement? | 3
_________ is the way you groups things together by placing one thing on top of
another and then removing things one at a time from the top | Stack
Pushdown list means: | Stack , Queue, Linked list
Which of the following is the feature of stack? | All operations are at one end
The five items: A, B, C, D and E are pushed in a stack,one after the other starting
from A. The stack is popped four times and each element is inserted in a queue.
Then two elements are deleted from the queue and pushed back on the stack. Now one
item is popped from the stack.The popped item is. | D
To delete a dynamically allocated array named `a`, the correct statement is |
delete a
To create a linked list, we can allocate space and make something point to it, by
writing: struct-name *pointer-variable; Which of the following statement will
correctly allocate the space | pointer-variable = malloc(sizeof(struct struct-
name));
The size of a structure can be determined by a. size of variable name b. size of
(struct tag) | both a and b
The reason for using pointer is ... Choose the false option from the following
sentences | Accessing arrays or string elements
Finding the location of the element with a given value is | Search
Arrays are best data structures | for relatively permanent collections of data
Each data item in a record may be a group item composed of sub-items; those items
which are indecomposable are called | all of above
The difference between linear array and a record is | All of above
Which of the following statement is false? | pointers store the next data element
of a list
Binary search algorithm can not be applied to | sorted singly linked list
Identify the data structure which allows deletions at both ends of the list but
insertion at only one en | Input-restricted deque
Which of the following data structure is non-linear type? | None of above
Which of the following data structure is linear type? | All of above
To represent hierarchical relationship between elements, which data structure is
suitable | Tree
The depth of a complete binary tree is given by | Dn = log2n+1
A binary tree can easily be converted into q 2-tree | by replacing each empty sub
tree by a new external node
The post order traversal of a binary tree is DEBFC Find out the pre order traversal
| ABDECF
Value of the first linked list index is | Zero
A linked list index is ____ that represents the position of a node in a linked
list. | an Integer
Why is the constructor of the LinkedList class empty? | because initialization of
data members of the LinkedList class is performed by the constructor of the
LinkedList class.
form of access is used to add and remove nodes from a queue | FIFO , First In First
Out
form of access is used to add and remove nodes from a stack | LIFO
A _______ is a data structure that organizes data similar to a line in the
supermarket, where the first one in line is the first one out. | both of them
In a graph if e=[u, v], Then u and v are called | all of above
A connected graph T without any cycles is called | All of above
In a graph if e=(u, v) means | B.e begins at u and ends at v C. u is processor and
v is successor
Which of the following case does not exist in complexity theory | Null case
A Linked list can grow and shrink in size dynamically at _______ | run time
is the way you groups things together by placing one thing on top of another and
then removing things one at a time from the top | Stack
ushdown list means: | All of the above
The five items: A, B, C, D and E are pushed in a stack,one after the other starting
from A. The stack is popped four times and each element is inserted in a queue.
Then two elements are deleted from the queue and pushed back on the stack. Now one
item is popped from the stack. | D
To delete a dynamically allocated array named `a`, the correct statement is |
delete a;
The size of a structure can be determined by | a. size of variable name + b. size
of (struct tag)
The reason for using pointer is ... | Accessing arrays or string elements
What is the "push"? | Placing a data item on top of the stack.
What is "popping"? | Removing a data item from the top of the stack.
Explain LIFO | Last-In-First-Out. A stack is a LIFO storage mechanism because the
last item inserted is the first one to be removed.
What is "peek"? | It allows the user to read the value at the top of the stack with
out removing it.
Explain how you would create an algorithm that matches delimiters on the stack.
Include errors in your explanation. | 1. Read the characters from a string one at a
time.
What happens to non delimiter characters? | They are not inserted onto the stack;
they are ignored.
Whatever you can do to manipulate the data storage structure becomes our: |
Methods.
What is the difference between a stack and a queue? | In a queue the first item
inserted is the first to be removed (FIFO). In a stack the last item inserted is
the first to be removed (LIFO)
Where does the term queue come from? | It is a British reference to waiting in
line. Fist in, first out.
Unlike a stack, the items in a queue don't always: | extend all the way down to
index 0.
How is "peek" different in a queue? | It "peeks" at the value of the item at the
front of the queue without removing it as opposed to the last value in a stack.
What is wrapping around? When is it useful? What is created that must be fixed? |
Wrapping around allows the user to fill in new items in the queue at index zero,
assuming that the queue is empty at index zero. This creates a broken sequence (the
items in the queue are in two different sequences in the array).
How can you fix a broken sequence? What is created? | Delete enough items so that
the Fron arrow wraps around. This creates a single contiguous sequence.
What is a deque? | A double-ended queue. You can insert items and either end &
delete items from either end.
How is a priority queue different than a queue? | A priority queue items are
ordered by key value so that the item with the lowest key ( or in some
implementations the highest key) is always at the front. Items are inserted in the
proper position to maintain the order.
How does the mail sorting analogy apply to the priority queue? | You insert a
letter from the postman into your pile of pending letters according to priority.
The higher the priority the higher the position in the pile.
What are the pros and cons of using a priority queue implemented by a simple array?
| Pro: Simple and appropriate when the # of items isn't high or insertion speed
isn't critical.
In a singly-linked list, these is no efficient way to insert node before a given
node in the middle or at the end of the list | T
which of the following applications may use a queue | Store a waiting list of
printing
select the most correct statement | sort is 0(n^2), best case it is O(n)