Font size
WorksheetsData Structure
Total questions: 150
Worksheet time: 2hrs 53mins
How is an array initialized in C language?
int a= {1,2,3};
int a[3]={1,2,3};
int a = new int[3]
int a(3)= [1,2,3];
Which of the following data items may lead to variable length records when included as items in the record?
age
DOB
Gender
Previous Employer
Which of the following is a linear data structure?
Graph
Binary Tree
Linked list
AVL Tree
What will be the output of the following code snippet?
5
15
6
9
What is the disadvantage of array data structure?
Elements of an array can be accessed in constant time
Elements are stored in contiguous memory location
The amount of memory to be allocated should be known beforehand
Multiple other data structures can be implemented using Array
When a pop() operation is called on an empty queue, what is the condition called?
Overflow
Underflow
Syntax Error
Garbage Value
What is the time complexity of the binary search algorithm?
O(n)
O(1)
O(n2)
O(log2n)
What is the best case time complexity of the binary search algorithm?
O(1)
O(n)
O(log2n)
O(n2)
Identify the two types of efficiencies that are important for computer algorithms.
Time efficiency and High power efficiency
High power efficiency and Computational Efficiency
Computational Efficiency and Space Efficiency
Time Efficiency and Space Efficiency
The running time of an algorithm is O(g(n)) if and only if ___
its worst case running time is O(g(n)) and best case run time is Ω(g(n))
O(g(n))= Ω(g(n))
its worst case running time is Ω(g(n)) and best case run time is O(g(n))
O(g(n)) Ո ω(g(n)) is non-empty set
A queue follows _________
LIFO
FIFO
Linear Tree
Ordered Aray
See the image and answer
[log2n] * n
n
[log2n]
[log2n] + 1
How can we describe an array in the best possible way?
The Array shows a hierarchical structure.
Arrays are immutable (Not Modifiable)
Container that stores the elements of similar types
The Array is not a data structure
Which one of the following is the size of int arr[9] assuming that int is of 4 bytes?
9
36
32
None
Which one of the following is the process of inserting an element in the stack?
Add
Push
Insert
None
If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known as___
Overflow
Successful Insertion
Underflow
Garbage Collection
Which of the following is not the correct statement for a stack data structure?
Arrays can be used to implement the stack
Stack follows FIFO
Elements are stored in a sequential manner
Top of the stack contains the last inserted element
If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?
1234
2134
4321
None
The time complexity of enqueue(insertion) operation in Queue is ___
O(1)
O(n)
O(log n)
O(n log n)
A mathematical-model with a collection of operations defined on that model is called _____
Data Structure
ADT
Primitive Data Type
Algorithm
Which of the following points is/are true about Linked List data structure when it is compared with array
Arrays have better cache locality that can make them better in terms of performance.
It is easy to insert and delete elements in Linked List
The size of array has to be pre-decided, linked lists can change their size any time.
Random access is not allowed in a typical implementation of Linked Lists
All the Above
You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?
Delete the First element
Inser a new element as the first element
Delete the last element
Add a new element at the end of the list
Which one of the following is an application of Stack Data Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All the above
Which one of the following is an application of Queue Data Structure?
When a resource is shared among multiple consumers.
When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes
Process Scheduling
All the above
Which of the following is true about linked list implementation of stack?
In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
Both of the above
None of the above
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree?
7 5 1 0 3 2 4 6 8 9
0 2 4 3 1 6 5 9 8 7
0 1 2 3 4 5 6 7 8 9
9 8 6 4 2 3 0 1 5 7
Which of the following is not the type of queue?
Priority Queue
Single ended Queue
Ordinary Queue
Circular Queue
When a pop() operation is called on an empty queue, what is the condition called?
Overflow
Underflow
Syntax Error
Garbage Value
Which of the following can be done with LinkedList?
Implementation of Stacks and Queues
Implementation of Binary Trees
Implementation of Abstract Data Structures with dynamic memory allocation
All of the above
What is the information, which a LinkedList’s Node must store?
The address of the next node if it exists
The value of the current node
Both (A) and (B)
None of the above
Which of the following represents the Postorder Traversal of a Binary Tree?
Left -> Right -> Root
Left -> Root -> Right
Right -> Left -> Root
Right -> Root -> Left
Which data structure is mainly used for implementing the recursive algorithm?
Queue
Stack
Array
List
Which of the following data structures allow insertion and deletion from both ends?
Stack
Double Ended Queue(Deque)
Queue
Strings
Which of the following data structures can be used to implement queues?
Stack
Arrays
LinkedList
All of the Above
What is the disadvantage of array data structure?
Elements of an array can be accessed in constant time.
The amount of memory to be allocated should be known beforehand.
Elements are stored in contiguous memory blocks.
Multiple other data structures can be implemented using arrays.
Which of the following is not an advantage of trees?
Hierarchical structure
Faster search
Router algorithms
Undo/Redo operations in a notepad
3. What is a full binary tree?
Each node has exactly two children
Each node has exactly zero or two children
All the leaves are at the same level
Each node has exactly one or two children
The number of edges from the node to the deepest leaf is called _________ of the tree.
Height
Depth
Length
Width
The height of a Binary Search Tree is given as h. Consider the height of the tree as the no. of edges in the longest path from root to the leaf. The maximum no. of nodes possible in the tree is?
2(h+1)−1
2(h−1)−1
2(h−1)+1
2(h)+1
If a node having two children is to be deleted from binary search tree, it is replaced by its
Pre-order predecessor
In-order predecessor
in-order successor
Post - order successor
Example of linear data structure except
array
tree
queue
stack
Which of these data structures is LIFO?
Stack
Queue
Binary Tree
Double linked list
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)
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
It use pointer to link nodes.
Variable
Link List
Pointer
Trees
LIFO stands for
List of Outputs
Last in First Out
First in Last Out
None of them
Act of adding values into a stack is called
Popping
Polling
Pushing
None
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
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, get the total number of element present in stack is
1
2
3
4
circular linked list
linked list
doubly circular linked list
doubly linked list
People have used the word ________ to mean computer information that is transmitted or stored.
Beta
Data
Database
None of above
_____________ specifies how we enter data into our programs and what type of data we enter.
data type
data
datum
all of above
void is __________ data type.
primary
derived
user defined
none of above
int is __________ data type.
user defined
derived
primary
all of above
Array is ___________ data type.
user defined
primary
derived
all of above
Pointer is __________ data type
derived
primary
user defined
none of above
In ____________ data structure, the data items are arranged in a linear sequence.
linear
non linear
both a and b
all of above
In ___________ data structures all elements may or may not be of same type.
linear
non linear
homogeneous
non- homogeneous
In ___________ data structure data items are not in sequence.
non linear
linear
non-homogeneous
all of above
____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.
linear
homogeneous
static
dynamic
Stack uses __________ data structure as the element that was inserted last is the first one to be taken out.
LIPO
FIFO
LIFO
FIPO
Full form of LIFO is ____________
Last Inside First Outside
Last Innner First Outer
Last In First Out
Last Impact First Out
Every stack has a variable _________ associated with it.
TOP
BOT
POT
none of the above
_________ operation adds an element to the top of the stack.
pop
push
peep
all of the above
_________ operation removes the element from the top of the stack.
push
pop
update
none of the above
_________ operation returns the value of the topmost element of the stack.
push
pop
peep
update
_________ operation changes the value of element given by user of the stack.
push
pop
peep
update
A function calls itself is called ___________.
queue
recursion
function
none of above
A queue is a _________ data structure in which each element that was inserted first is the first one to be taken out.
FITO
FIFO
FISO
FIVO
The elements in a queue are added at one end called ________.
front
rear
near
none of above
What is a data structure?
A method of arranging data
A way of keeping data without an order?
A "stack" only
There is no formal definition for "Data Structure"
Which of these data structures is FIFO?
Stack
Queue
Binary Tree
Linked List
Stack is also called as
Last in first out
First in last out
Last in last out
First in first out
Which data structure allows deleting data elements from front and inserting from rear?
Stack
Queue
Array
Linked List
Which of the following data structure is non linear type?
Stack
Queue
Tree
Liked list
Which of the following data structure is linear type?
Stack
Array
Queue
All of the above
Traversing each and every record exactly once is called_______
Insertion
Deletion
Traversing
Searching
Data structure= Organized data +________________
allowed operations on it.
allowed functions on it
None of the above
In linked list each node is divided into ___________parts?
one
two
three
four
In stack insertion and deletion can take place only at one end call the ____________________ of the stack.
Path
Function
Top
Bottom
Algorithm is a __________________ procedure.
shortcut
function
reverse
step by step
In algorithm comment use by ________brackets.
curley
secure
None of the above
both of the above
A field or collection of fields in a record which identifies a record uniquely is called a ______________
Primary Key
Secondary Key
None of the above
Stack performs ____________ operation
PUSH
POP
both of the above
In which algorithm takes less time or space is called
Best case
Worst case
Average case
None of the above
The algorithm is completed when the statement _______________ is encountered.
Return
Finish
EXIT
None of the above
In algorithm several statements appear in the same step
True
False
Go to statement is the part of ______________
Conditional statement
Unconditional statement
None of the above
In algorithm assignment operation is performed using the symbol__________
=
:=
++
==
In algorithm variable names should be in capital letters.
True
False
A series of values stored in memory is called ___
an array
a tree
a matrix
a struct
In some languages, arrays are also called ___
groups or arrows
roots or leaves
lists or vectors
lines or strings
Almost all programming languages start arrays at ___
index 0
index 1
index 2
the null character
In almost all programming languages, what kind of bracketing is used to denote array access?
round brackets
square brackets
curly braces
quotation marks
Arrays of characters, like letters, numbers, punctuation and other written symbols, are called ___
structs
vectors
strings
groups
Most often, to save a string into memory, you just put it in ___
square brackets
round brackets
quotes
curly braces
A string ends with the binary value 0 in memory, which is called ___
the concatenation character
the floating point
index zero
the null character
What is the operation of joining character strings end-to-end called?
string cataloging
integration
interlocking
string concatenation
A two-dimensional list, which can be thought of as an array of arrays, is called ___
a matrix
a struct
a tree
a grid
A data type that can be used to group items of possibly different types into a single type is called ___
a root
a struct
a tree
a pointer
A type of struct that stores a variable, like a number, and also a pointer is called ___
a nodule
a radix
a node
a root
A flexible data structure that can store many nodes is called ___
a tree
a linked list
a pointer
a queue
Complex data structures built on top of linked lists, that use First-In First-Out behaviour, are called ___
vectors
strings
queues
stacks
When linked lists are used as stacks, what kind of behaviour is implemented?
First-In First-Out, or FIFO
First-In Last-Out, or FILO
Last-In Last-Out, or LILO
Last-In First-Out, or LIFO
Instead of enqueuing and dequeuing, data is pushed onto a stack and ___
grabbed from a stack
popped from a stack
eaten from a stack
pulled from a stack
If a struct contains more than one pointer, what abstract data type is created?
a queue
a stack
a tree
a node
In a tree data structure, the top most node is called ___
the peak
the apex
the crown
the root
In a tree data structure, any nodes that hang from other nodes are called ___
branched nodes
leaf nodes
children nodes
daughter nodes
In a tree data structure, any nodes that have no children (where the tree ends) are called ___
boundary nodes
leaf nodes
orphan nodes
terminal nodes
An important property of trees is that there’s a one-way path from ___
branch to branch
roots to leaves
parent to daughter
peak to trough
Which data structure is used for data that links arbitrarily, and includes things like loops?
binary trees
circular trees
graphs
dynamic linked stacks
In a stack, if a user tries to remove an element from empty stack it is called _________
Underflow
Empty collection
Overflow
Garbage Collection
Process of inserting an element in stack is called ____________
Create
Push
Evaluation
Pop
Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order).
The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?
1
2
3
4 or more
User perform following operations on stack of size 5 then -
push(1);
pop();
push(2);
push(3);
pop();
push(2);
pop();
pop();
push(4);
pop();
pop();
push(5);
Overflow Occurs
Stack Operations will be performed Smoothly
Underflow Occurs
None of these
What is the value of the postfix expression 6 3 2 4 + – *
1
40
74
-18
The following postfix expression with single digit operands is evaluated using a stack:
8 2 3 ^ / 2 3 * + 5 1 * -
6,1
5,7
3,2
1,5
To evaluate an expression without any embedded function calls:
One stack is enough
Two stacks are needed
As many stacks as the height of the expression tree are needed
A Turing machine is needed in the general case
What will be the postfix form of the above expression -
(A+B)∗(C∗D-E)∗F/G
None of these
A B + C D ∗ E − F G ∗ / ∗
A B + C D E ∗ − F G / ∗ ∗
A B + C D ∗ E − F G / ∗ ∗
Which one of the following is an application of Stack Data Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All of the above
List of data in which element can be inserted and removed at the same end is called as __________.
array
stack
linked list
queue
A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called
AVL tree
Red-black tree
Lemma tree
None of the above
________is very useful in situation when data have to stored and then retrieved in reverse order.
Stack
Queue
List
Link list
In the __________traversal we process all of a vertex’s descendents before we move to an adjacent vertex.
Depth First
Breadth First
With First
Depth Limited
There is an extra element at the head of the list called a ________
Antinel
Sentinel
List header
List head
A graph is a collection of nodes, called __________ And line segments called arcs or__________ that connect pair of nodes.
vertices, edges
edges, vertices
vertices, paths
graph node, edges
The disadvantage in using a circular linked list is __________
it is possible to get into infinite loop
last node points to fist node.
time consuming
requires more memory space.
State true of false.
i) A node is a parent if it has successor nodes.
ii) A node is child node if out degree is one.
True, True
False, True
True, False
False, False
A tree sort is also known as__________ sort.
quick
heap
shell
selection
_____________is the method used by card sorter?
Radix sort
Insertion
Heap
Quick
______________the condition indicate the queue is empty.
Front=Null
Null=Front
Front=Rear
Rear=Null
TREE[1]=NULL indicates is _____________
Overflow
Empty
Underflow
Full
A terminal node in a binary tree is called __________
Root
Branch
Child
Leaf
If node N is a terminal node in a binary tree then its ________
Right tree is empty
Left tree is empty
Both left & right sub trees are empty
Root node is empty
Other name for directed graph is _________
Direct graph
Digraph
Dir-graph
Dgraph
In a graph if E=(u,v) means _____________
u is adjacent to v but v is not adjacent to u
e begins at u and ends at v
u is processor and v is successor
both b and c
1. Example of linear data structure except
array
queue
tree
stack
2. _________________ is a collection of elements used to store the same type of data.
Array
Switch
Case
Loop
3. Types of data structure are....
primitive data structure
non-primitive data structure
both
none of them
4. Input/output function prototypes and macros are defined in which header file?
conio.h
stdlib.h
stdio.h
dos.h
5. Which of the following is not a correct variable type?
int
real
float
char
6. Which of the following is the correct operator to compare two variables?
equal
=
:=
==
7. What is the only function all C programs must contain?
start()
system()
main()
program()
8. What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
9. The "\n" character does which of the following operations?
Double line spacing
Character deletion
Character backspace
Places cursor on the next line
10. Is the syntax for the following C statement correct?:
scanf("%d", input);
True
False
