Font size
WorksheetsFINALS Data Structure and algorithm
Total questions: 62
Worksheet time: 31mins
If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?
ABCD
DCBA
DCAB
ABDC
Act of adding values into a stack is called
Popping
Polling
Pushing
None
LIFO stands for
List of Outputs
Last in First Out
First in Last Out
None of them
It use pointer to link nodes.
Variable
Link List
Pointer
Trees
A FIFO structure implemented as a ring where the front and rear pointers can wrap around the end of the start of the array.
Linear Queue
Circular Queue
Priority Queue
int nums[ ] =
{2, 3, 5, 8, 9, 11};
How would you access the fourth element in nums
nums[8]
nums[3]
nums(4)
nums(3)
Which of these data structures is LIFO?
Stack
Queue
Binary Tree
Double linked list
Example of linear data structure except
array
tree
queue
stack
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
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
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
It refers to collection of variables, possibly of several different data types connected in various ways.
Database
Arrays
Data Structures
Abstraction
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
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
What is returned by values[5]?
6
9
8
12
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 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
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
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
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?
What is the degree of vertex 4?
3
4
5
7
Which two vertices are adjacent vertices?
5 is adjacent to 6
3 is adjacent to 6
4 is adjacent to 1
3 is adjacent to 2
The graph represents the following vocabulary term.
Cycle
Path
Complete Graph
Complete Bipartite Graph
What is the weight of the shortest path from A to F?
5
7
9
11
Which vertices are adjacent to E?
B and C
B, C, D, and A
B
A, B, C, D, F, G
Which is an example of a disconnected graph?
None are disconnected graphs
Which of the following is not a style of graph traversal in computing?
Breadth-First
Depth-First
Height-First
Which method of graph traversal makes use of a stack?
Depth-First
Breadth-First
Which method of graph traversal makes use of a queue?
Depth-First
Breadth-First
Which order of traversal is correct using depth-first?
A B C G D E F
A B D C E C G
Which of the following beginnings to a graph traversal would not be correct for depth-first?
A B C G
A D F
A E D F
A B D C
Which order of traversal is correct using breadth-first?
A B D E C F G
A B C G D E F
A has been visited what happens next
Visit B
Visit D
Visit E
Visit C
With breadth-first traversal, which node will be visited next?
C
F
G
A _________ is a simple path is which the first and last vertices are same
Cycle
Circular
