Font size
WorksheetsPCPH0001_2
Total questions: 70
Worksheet time: 3600secs
What will the stack contain after the following actions?
Push(1);
Push(2);
Push(3);
Push(4);
Pop();
Pop();
Push(5);
1, 2, 3
1, 2, 3, 5
1, 2, 3, 4
1, 2, 5
Convert the infix exression
(A + B) * (C + D)
to Postfix.
A B C * + D +
A B + C D + *
A B * C D * +
A B + C + D +
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
What is the value of the postfix expression 6 3 2 4 + – *
-18
1
40
74
You can replace any element position in the stack.
True
False
Evaluate the given postfix expression 7 8 2 * 4 / +
7
11
8
None of the Above
Convert a given infix
expression (x + y)/(z*8) into equivalent postfix expression
xyz/8*+
xyz8*/+
xy+z8*/
xy+z/8*
If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values
2,2,1,1,2
2,2,1,2,2
2,1,2,2,1
2,1,2,2,2
Consider the following operations performed on a stack of size 5 :
Push (a); Pop() ;
Push(b); Push(c);
Pop(); Push(d);
Pop();Pop();
Push (e)
Which of the following statements is correct?
Underflow occurs
Stack operations are performed smoothly
Overflow occurs
None of the above
Which of the following statement(s) about stack data structure is/are NOT correct?
Stack data structure can be implemented using linked list
New node can only be added at the top of the stack
Stack is the FIFO data structure
The last node at the bottom of the stack has a NULL link
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
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
Evaluate the expression: 7 2 * 3 1 / +
14
17
16
15
Find the postfix expression for: A+B+C+D+E
AB+C+D+E+
AB+C+D++E
ABC++D+E+
AB+C+D+E++
The prefix form of A-B/ (C * D ^ E) is?
a) -/*^ACBDE
b) -ABCD*^DE
c) -A/B*C^DE
d) -A/BC*^DE
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
a) AB+ CD*E – FG /**
b) AB + CD* E – F **G /
c) AB + CD* E – *F *G /
d) AB + CDE * – * F *G
What is the infix equivalent for the following postfix expression?
3 5 6 + *
5 + 6 * 3
5 + (3 * 6)
(5 + 6) * 3
5 (+ 6 * 3)
The result evaluating the postfix expression 10 5 + 60 6 / * 8 – is
284
213
142
71
Operand Operand Operator
Operand Operator Operand
The postfix form of A*B+C/D is?
*AB/CD+
AB*CD/+
A*BC+/D
ABCD+/*
Evaluate the expression: 7 2 * 3 1 / +
14
17
16
15
Find postfix expression for (D/G+(J*S)+Y)
DG+JS*/Y+
DG+JS*+Y/
DG/JS+*Y+
DG/JS*+Y+
Find the postfix expression for: A+B+C+D+E
AB+C+D+E+
AB+C+D++E
ABC++D+E+
AB+C+D+E++
What is the final value after evaluating 82/3*41/+
14
16
13
15
The number of edges from the root to the node is called __________ of the node.
Height
Length
Path
Depth
In a full binary tree...........................
Each level has exactly 0 or 2 nodes
All the leaves are at the same level
Each node has exactly zero or two children
Each level has exactly 2 nodes
Complete binary tree is
Each level is filled except last level
Binary tree
Each level is filled except first level
all levels are filled
last level is filled from left to right
Inorder traversal
Left Right Root
Left Root Right
Right Left Root
Right Left Root
Preorder Traversal of the tree
1 4 9 5 2 8 3
1 4 9 5 2 3 8
1 4 9 8 5 2 3
1 4 9 8 5 2 3
Post order traversal of the tree
9 8 4 2 3 5 1
4 9 8 5 2 3 1
8 9 4 2 3 5 1
8 9 4 3 2 5 1
The no of external nodes in a full binary tree with 5 internal nodes is?
(a)
Which is/are correct?
Every binary tree is either complete or full
Every full binary tree is also a complete binary tree
Every complete binary tree is also a full binary tree
All of the above
None of these
Preorder of a binary tree with the following
Postorder traversal: 1 3 5 4 2
Inorder traversal: 1 2 3 4 5
(a)
How many roots exist for a binary tree?
(a)
Answer the questions referring to the tree: Identify the leaf nodes [Use comma as separator between values; dont use extra space-Give the node values as answer]
(a)
Identify the root node
(a)
Is the given tree a complete binary tree?
4
/ \
2 6
/ \ / \
1 3 5 7
(a)
Calculate the height of the tree.
(a)
Calculate the depth of node 90.
(a)
Calculate the out-degree of node 15.
(a)
Calculate the indegree of node 70.
(a)
Calculate the path of node '44' from the root. [Use arrows between node values; eg. 25->15-> ...]
(a)
How many children does an internal node have in a binary tree?
(a)
How many children does an external node have in a binary tree?
(a)
Which set represents the vertices of the graph?
{1,2}, {2,3}. {2,4}, {4,5}, {4,6}
{1, 2, 3, 4, 5, 6,}
{1, 2, 3, 4, 5, 6, 7}
{1,2}, {2,3}. {2,4}, {4,5}, {4,6}, {6,7}
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 true?
A graph may contain no edges and many vertices
A graph may contain many edges and no vertices
A graph may contain no edges and no vertices
Which of the following is not a style of graph traversal in computing?
Breadth-First
Depth-First
Height-First
Graph traversal is used to find the ______ route to visit all nodes in a network
Shortest
Best
Longest
Most secure
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
