Font size
WorksheetsData Structure and Algorithm
Total questions: 43
Worksheet time: 55mins
If for an algorithm time complexity is given by O(n) then complexity of it is:
linear
exponential
constant
none of the mentioned
Data in the data structures are processed by operations like insertion, deletion, sorting, merging and ______________
A. Traversing
B. Searching
C. Retrieval
D. Both A and B
If the insertion and deletion happens from both the ends then the deletion is called a ______
Deque
Enqueue
peek
full
Process of inserting an element in stack is called
Insert
Pop
Overflow
Push
If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?
CBA
ABDC
ABCD
DCAB
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
Prints all nodes of linked lists
Prints alternate nodes of Linked List
Prints all nodes of linked list in reverse order
Prints alternate nodes in reverse order
. Match the following.
a) Completeness i) How long does it take to find a solution
b) Time Complexity ii) How much memory need to perform the search.
c) Space Complexity iii) Is the strategy guaranteed to find the solution when there in one.
a-iii, b-i, c-ii
a-i, b-ii, c-iii
a-i, b-iii, c-ii
a-iii, b-ii, c-i
Efficiency of an algorithm is measured by
Time and Space complexity
Speed and Capacity complexity
Speed and Space complexity
Time and Capacity complexity
Which of the following data structures are mutable?
Array
List
Tuple
Enum
The algorithm implemented in a stack is?
FIFO- the first element must come out first from the list
WIFI - the worst element must be the first to come in to the list
LIFO - the last element must be the first to come out from the list
all of the above
What will happen by attempting to push another item onto the top of a full stack?
Underflow error
Overload error
Overflow error
Catastrophic error
Look at the diagram of the stack. What would the stack look like after the following operations were called:
peek()
pop()
push("yellow")
It refers to collection of variables, possibly of several different data types connected in various ways.
Database
Arrays
Data Structures
Abstraction
there are primitive data types, meanwhile there are what we call abstract data type, evaluate which is not one.
Stacks
Arrays
Trees
Tables
Data that a variable can hold in a programming language, all programming language has a set of it.
Algorithms
Variables
Data Types
Programming
Finite set of instructions that specify a sequence of operations to be carried out
Flowcharting
Algorithms
Procedure
Pseudocodes
Linear Search checks every element of a list one at a time in sequence, also called as sequential search.
MAYBE
TRUE
FALSE
None of the Choices
It is a mathematical object which arises in many physical problems, consists of m rows and n columns
Array
Matrix
Table
Excel
Which of the following definitions of Array Terms is CORRECT?
Elements - individual data / items in an array indicated by the array name followed by its dimensions appears in a square brackets
Index - each variable or cell in an array
Dimensions - an integer from 1 - n called dimensioned variables
All of the Choices
Which of the following statements is NOT TRUE about PSEUDOCODES?
textual presentation of a flowchart
the control structures impose the logic
close to a natural language
None of the choices
It can be used to encapsulate parts of an algorithm by localizing in one section of a program all the statements relevant to a certain aspect of a program.
Algorithms
Pseudocodes
Flowcharting
Procedures
What is returned by values[5]?
6
9
8
12
Which of these data structures is FIFO?
Stack
Queue
Graph
Linked list
A Queue can only store 6 data items. The Queue has sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point?
0
1
2
3
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Rear" pointer point?
0
1
2
3
A Queue can only store 6 data items. The Queue has sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point if a deQueue operation is performed.
Bert
Cynthia
Cedric
Albert
In terms of an array, what is an index?
he first element in an array
A value which points to a data element in an array
A list of all the elements in an array
In the known abstract data types, which returns an overflow or underflow error?
Linked List
Stacks
Queues
Graphs
Trees
A Binary search requires the data it is searching to be ordered in some way...
True
FALSE
Not all the time
Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the no of element present on stack are
1
2
3
4
5
Does Abstracts Data Types support the programmer's efficiency?.
Yes
No
choose the two types of the Data
Primitive Data Type
return
User defined Data
void
What is an algorithm?
placeholders for representing data
is a sequence of instructions or a set of rules that are followed to complete a task.
Something that comes somewhere in between formatted English and computer program code
The arrangement of and relations between
the parts or elements of something.
Correct code to define a list C++?
Int[] scores = {15, 29, 4, 50};
int scores [4]= {15, 29, 4, 50}
int scores = (15, 29, 4, 50)
none of the above
It use pointer to link nodes.
Variable
Trees
Pointer
Link List
Differentiate priori and posterio analysis in one sentence (5 points)
In doing shell sort algorithm, what will you do after you swapped the values using the Knuth's formula and the interval of 1?
Sort the remaining sub list using bubble sort
Identify the pivot value then implement merge sort
Use insertion sort
all of the above
Why do we use the isFull() function in a queue?
A. to identify if the list has any available position, so we can add if there is or send an overflow error message otherwise
B. to detect the size of the list then resize it when necessary to adjust the size of the queue
both A and B
no answer
What will happen during a dequeue operation and the algorithm found out that the list is already empty?
an underflow error message will appear
an overflow error message will appear
an error message will appear
a queue is full error message will appear
to be able to use interpolation search, we need to get the ______________ from the list
middle position
probing position
interval position
high and low position
When the item being search in binary search does not match to the calculated middle position because the search item is at the upper list, what will you do?
reassign a new value to the lowest position whereas: low = mid + 1
reassign a new value to the highest position whereas: high = mid - 1
reassign a new value to the lowest position whereas: mid = mid + 1
none of the above
It talks about arranging data in a particular format, whether ascending or descending.
Searching
Stacking
Queueing
Sorting
Bonus question: what is the significance of learning Data Structures and understanding the use of algorithm in day to day life as an IT person?
