wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PCPH0001_2

Total questions: 70

Worksheet time: 3600secs

Name
Class
Date
1.

What will the stack contain after the following actions?

Push(1);

Push(2);

Push(3);

Push(4);

Pop();

Pop();

Push(5);

a)

1, 2, 3

b)

1, 2, 3, 5

c)

1, 2, 3, 4

d)

1, 2, 5

2.

Convert the infix exression

(A + B) * (C + D)

to Postfix.

a)

A B C * + D +

b)

A B + C D + *

c)

A B * C D * +

d)

A B + C + D +

3.

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

a)

1

b)

2

c)

3

d)

4

4.

What is the value of the postfix expression 6 3 2 4 + – *

a)

-18

b)

1

c)

40

d)

74

5.

You can replace any element position in the stack.

a)

True

b)

False

6.

Evaluate the given postfix expression 7 8 2 * 4 / +

a)

7

b)

11

c)

8

d)

None of the Above

7.

 

Convert a given infix

expression (x + y)/(z*8) into equivalent postfix expression

a)

xyz/8*+

b)

xyz8*/+

c)

xy+z8*/

d)

xy+z/8*

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

a)

2,2,1,1,2

b)

2,2,1,2,2

c)

2,1,2,2,1

d)

2,1,2,2,2

9.

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?

a)

Underflow occurs

b)

Stack operations are performed smoothly

c)

Overflow occurs

d)

None of the above

10.

Which of the following statement(s) about stack data structure is/are NOT correct?

a)

Stack data structure can be implemented using linked list

b)

New node can only be added at the top of the stack

c)

Stack is the FIFO data structure

d)

The last node at the bottom of the stack has a NULL link

11.

In a stack, if a user tries to remove an element from empty stack it is called _________

a)

Underflow

b)

Empty collection

c)

Overflow

d)

Garbage Collection

12.

Process of inserting an element in stack is called ____________

a)

Create

b)

Push

c)

Evaluation

d)

Pop

13.

What is the value of the postfix expression 6 3 2 4 + – *

a)

1

b)

40

c)

74

d)

-18

14.

The following postfix expression with single digit operands is evaluated using a stack:

8 2 3 ^ / 2 3 * + 5 1 * -

a)

6,1

b)

5,7

c)

3,2

d)

1,5

15.

To evaluate an expression without any embedded function calls:

a)

One stack is enough

b)

Two stacks are needed

c)

As many stacks as the height of the expression tree are needed

d)

A Turing machine is needed in the general case

16.

What will be the postfix form of the above expression -

(A+B)∗(C∗D-E)∗F/G

a)

None of these

b)

A B + C D ∗ E − F G ∗ / ∗

c)

A B + C D E ∗ − F G / ∗ ∗

d)

A B + C D ∗ E − F G / ∗ ∗

17.

Which one of the following is an application of Stack Data Structure?

a)

Managing function calls

b)

The stock span problem

c)

Arithmetic expression evaluation

d)

All of the above

18.

List of data in which element can be inserted and removed at the same end is called as __________.

a)

array

b)

stack

c)

linked list

d)

queue

19.

Evaluate the expression: 7 2 * 3 1 / +

a)

14

b)

17

c)

16

d)

15

20.

Find the postfix expression for: A+B+C+D+E

a)

AB+C+D+E+

b)

AB+C+D++E

c)

ABC++D+E+

d)

AB+C+D+E++

21.

The prefix form of A-B/ (C * D ^ E) is?

a)

a) -/*^ACBDE

b)

b) -ABCD*^DE

c)

c) -A/B*C^DE

d)

d) -A/BC*^DE

22.

The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

a)

a) AB+ CD*E – FG /**

b)

b) AB + CD* E – F **G /

c)

c) AB + CD* E – *F *G /

d)

d) AB + CDE * – * F *G

23.

What is the infix equivalent for the following postfix expression?


3 5 6 + *

a)

5 + 6 * 3

b)

5 + (3 * 6)

c)

(5 + 6) * 3

d)

5 (+ 6 * 3)

24.

The result evaluating the postfix expression 10 5 + 60 6 / * 8 – is

a)

284

b)

213

c)

142

d)

71

25.
Which notation is used for the following format:
Operand  Operand Operator 
a)
Infix Notation
b)
Postfix Notation
c)
Prefix Notation
d)
None of the Choices
26.
Which notation is used for the following format:
Operand  Operator  Operand
a)
Infix Notation
b)
Postfix Notation
c)
Prefix Notation
d)
None of the Choices
27.
The operations to be performed on the operands are described by the associated operator. Operators of a higher precedence are processed first. Evaluation is performed from?
a)
Left-to-Right
b)
Right-to-Left
c)
Left only
d)
Right only
28.
An expression is made up of only two operands and operators?
a)
TRUE
b)
FALSE
29.

The postfix form of A*B+C/D is?

a)

*AB/CD+

b)

AB*CD/+

c)

A*BC+/D

d)

ABCD+/*

30.

Evaluate the expression: 7 2 * 3 1 / +

a)

14

b)

17

c)

16

d)

15

31.

Find postfix expression for (D/G+(J*S)+Y)

a)

DG+JS*/Y+

b)

DG+JS*+Y/

c)

DG/JS+*Y+

d)

DG/JS*+Y+

32.

Find the postfix expression for: A+B+C+D+E

a)

AB+C+D+E+

b)

AB+C+D++E

c)

ABC++D+E+

d)

AB+C+D+E++

33.

What is the final value after evaluating 82/3*41/+

a)

14

b)

16

c)

13

d)

15

34.

The number of edges from the root to the node is called __________ of the node.

a)

Height

b)

Length

c)

Path

d)

Depth

35.

In a full binary tree...........................

a)

Each level has exactly 0 or 2 nodes

b)

All the leaves are at the same level

c)

Each node has exactly zero or two children

d)

Each level has exactly 2 nodes

36.

Complete binary tree is

a)

Each level is filled except last level

b)

Binary tree

c)

Each level is filled except first level

d)

all levels are filled

e)

last level is filled from left to right

37.

Inorder traversal

a)

Left Right Root

b)

Left Root Right

c)

Right Left Root

d)

Right Left Root

38.

Preorder Traversal of the tree

a)

1 4 9 5 2 8 3

b)

1 4 9 5 2 3 8

c)

1 4 9 8 5 2 3

d)

1 4 9 8 5 2 3

39.

Post order traversal of the tree

a)

9 8 4 2 3 5 1

b)

4 9 8 5 2 3 1

c)

8 9 4 2 3 5 1

d)

8 9 4 3 2 5 1

40.

The no of external nodes in a full binary tree with 5 internal nodes is?

(a)  

41.

Which is/are correct?

a)

Every binary tree is either complete or full

b)

Every full binary tree is also a complete binary tree

c)

Every complete binary tree is also a full binary tree

d)

All of the above

e)

None of these

42.

Preorder of a binary tree with the following

Postorder traversal: 1 3 5 4 2

Inorder traversal: 1 2 3 4 5

(a)  

43.

How many roots exist for a binary tree?

(a)  

44.

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)  

45.

Identify the root node

(a)  

46.

Is the given tree a complete binary tree?

4

/ \

2 6

/ \ / \

1 3 5 7

(a)  

47.

Calculate the height of the tree.

(a)  

48.

Calculate the depth of node 90.

(a)  

49.

Calculate the out-degree of node 15.

(a)  

50.

Calculate the indegree of node 70.

(a)  

51.

Calculate the path of node '44' from the root. [Use arrows between node values; eg. 25->15-> ...]

(a)  

52.

How many children does an internal node have in a binary tree?

(a)  

53.

How many children does an external node have in a binary tree?

(a)  

54.

Which set represents the vertices of the graph?

a)

{1,2}, {2,3}. {2,4}, {4,5}, {4,6}

b)

{1, 2, 3, 4, 5, 6,}

c)

{1, 2, 3, 4, 5, 6, 7}

d)

{1,2}, {2,3}. {2,4}, {4,5}, {4,6}, {6,7}

55.

What is the degree of vertex 4?

a)

3

b)

4

c)

5

d)

7

56.

Which two vertices are adjacent vertices?

a)

5 is adjacent to 6

b)

3 is adjacent to 6

c)

4 is adjacent to 1

d)

3 is adjacent to 2

57.

The graph represents the following vocabulary term.

a)

Cycle

b)

Path

c)

Complete Graph

d)

Complete Bipartite Graph

58.

What is the weight of the shortest path from A to F?

a)

5

b)

7

c)

9

d)

11

59.

Which vertices are adjacent to E?

a)

B and C

b)

B, C, D, and A

c)

B

d)

A, B, C, D, F, G

60.

Which is an example of a disconnected graph?

a)
b)
c)
d)
e)

None are disconnected graphs

61.

Which of the following is true?

a)

A graph may contain no edges and many vertices

b)

A graph may contain many edges and no vertices

c)

A graph may contain no edges and no vertices

62.

Which of the following is not a style of graph traversal in computing?

a)

Breadth-First

b)

Depth-First

c)

Height-First

63.

Graph traversal is used to find the ______ route to visit all nodes in a network

a)

Shortest

b)

Best

c)

Longest

d)

Most secure

64.

Which method of graph traversal makes use of a stack?

a)

Depth-First

b)

Breadth-First

65.

Which method of graph traversal makes use of a queue?

a)

Depth-First

b)

Breadth-First

66.

Which order of traversal is correct using depth-first?

a)

A B C G D E F

b)

A B D C E C G

67.

Which of the following beginnings to a graph traversal would not be correct for depth-first?

a)

A B C G

b)

A D F

c)

A E D F

d)

A B D C

68.

Which order of traversal is correct using breadth-first?

a)

A B D E C F G

b)

A B C G D E F

69.

A has been visited what happens next

a)

Visit B

b)

Visit D

c)

Visit E

d)

Visit C

70.

With breadth-first traversal, which node will be visited next?

a)

C

b)

F

c)

G