NEW
Font size
WorksheetsDS & Python B.Tech. (BI) VII Sem
Total questions: 40
Worksheet time: 22mins
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
What is the value of the postfix expression 6 3 2 4 + – *:
1
14
74
-18
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);
}
a) Prints all nodes of linked lists
b) Prints all nodes of linked list in reverse order
c) Prints alternate nodes of Linked List
d) Prints alternate nodes in reverse order
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"
Root
data structure similar to a graph, with no loops.
an object in a graph also known as a vertex
a join of relationship between nodes - also know as an arc
the starting node in a rooted tree structure from which all other nodes branch off./
Binary TREE
data structure similar to a graph, with no loops.
an object in a graph also known as a vertex
a join of relationship between nodes - also know as an arc
a tree where each node can only have 2 child nodes attached to it
In preorder traversal of a binary tree the second step is ____________
traverse the right subtree
traverse the left subtree
traverse right subtree and visit the root
visit the root
Which of these tree traversal methods is used to output the contents of a binary tree in ascending order?
Pre-Order
In-Order
Post-Order
Monastic Orders
What are the 3 depth traversals for a tree data structure?
Pre-, In- and Post-order
Pro-, In- and Past-order
Pre-, Out- and Post-order
Pre-, In- and New-order
When traversing a binary tree, which diagram is post-order?
When traversing a binary tree, which diagram is pre-order?
What does the following code do? myAge = int (myAge)
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge from a integer to a string
Converts the var (variable) myAge to if statement
print(Hello world!)
What is the default return value for a function that does not return a value explicitly?
None
int
double
null
Which of the following keywords marks the begining of the function block?
Func
define
def
function
Fill in the line of code for calculating the factorial of a number.
def fact(num):
if num == 0:
return 1
else:
return _____________________
num*fact(num-1)
(num-1)*(num-2)
num*(num-1)
fact(num)*fact(num-1)
exp(),floor()belongs which module?
cmath.py
urlib.py
math.py
statistics.py
