0% found this document useful (0 votes)
189 views

MT IT1815 Data Structures and Algorithms

This document contains a midterm examination for a computer science course. It has two sections - a multiple choice section with 30 questions worth 75 points total (15 items worth 2 points each and 15 items worth 3 points each), and a short answer section with 5 items worth 5 points each for a total of 25 points. The exam covers topics like data structures, trees, stacks, queues, and more. Students are instructed not to cheat and to show their work.

Uploaded by

deborah galang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
189 views

MT IT1815 Data Structures and Algorithms

This document contains a midterm examination for a computer science course. It has two sections - a multiple choice section with 30 questions worth 75 points total (15 items worth 2 points each and 15 items worth 3 points each), and a short answer section with 5 items worth 5 points each for a total of 25 points. The exam covers topics like data structures, trees, stacks, queues, and more. Students are instructed not to cheat and to show their work.

Uploaded by

deborah galang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1st Term, SY 2022-2023 1000005184 — IT1815

Midterm Examination Page 1

Name:_____________________________ Section:___________________________ Date:_______________


Notice: B. Depth
Any form of cheating will result in a score of ZERO. (e.g. C. Level
leaking of exam items and answers on social media, D. Subtree
copying from other students, using prohibited
10. It is an ordered list in which the last element added is
resources/cheat sheets, etc.)
the first element retrieved or removed.
Use black or blue pen only. Pencils and erasable pens
are not allowed. A. Linked List
B. Queue
I. (75 points) C. Stack
Read and analyze each item. Encircle the letter of the D. Tree
correct answer. 11. It is an ordered list in which the first element added is
the first element retrieved or removed.
A. (15 items x 2 points)
A. Linked List
1. What is the process of visiting all the nodes in a B. Queue
specific order? C. Stack
A. Abstraction D. Tree
B. Inheritance 12. Which Java package contains the Queue interface?
C. Polymorphism A. java.awt
D. Traversal B. java.io
2. This operation removes an item from the queue. C. java.util
A. Dequeue D. javax.swing
B. Enqueue 13. This is the tree's highest level.
C. Pop A. Degree
D. Push B. Depth
3. It represents the hierarchical nature of a structure in a C. Edge
graphical form. D. Subtree
A. Linked List 14. This operation adds an item to the queue.
B. Queue A. Dequeue
C. Stack B. Enqueue
D. Tree C. Pop
4. This operation adds an item to the top of the stack. D. Push
A. Peek 15. This operation removes an item from the top of the
B. Pop stack.
C. Pull A. Peek
D. Push B. Pop
5. If a tree consists of nodes where each has two (2) child C. Pull
nodes at most, what is it called? D. Push
A. Binary Tree
B. Dual Tree B. (15 items x 3 points)
C. Double Tree
D. Twin Tree 16. Which of the following is NOT an example of a
palindrome?
6. It is the measure of a node's distance from its root.
A. data
A. Degree B. eve
B. Edge C. madam
C. Level D. refer
D. Subtree
17. Which directory represents the leaf node in the given
7. It is the number of child nodes in a subtree. file path? C:\Users\bpena\Documents\Midterm
A. Degree A. C:
B. Depth B. Users
C. Level C. bpena
D. Subtree D. Midterm
8. What do you call a node that has no child nodes? 18. How many one-level subtrees does the tree have?
A. Internal Node
B. Parent Node
C. Leaf Node
D. Root Node
9. It is a tree within a tree.
A. Degree
1st Term, SY 2022-2023 1000005184 — IT1815
Midterm Examination Page 2

Name:_____________________________ Section:___________________________ Date:_______________


B. stack
C. new
D. push();
25. Which of the following is NOT a step in evaluating a
postfix expression?
A. If the token is an operator, push it to the stack.
B. If the token is an operator, perform two (2) pop
operations.
C. Classify the token as operand or operator.
A. 0 D. Push the result of the two (2) popped operands to
B. 1 the stack after performing the required operation.
C. 2
D. 3 26. How many directories represent parent nodes in the
given file path? C:\Users\bpena\Desktop\Midterm
19. What is the tree's depth?
A. 1
B. 2
C. 4
D. 5
27. How many directories represent child nodes in the
given file path? C:\Users\bpena\Documents\Midterm
A. 1
B. 2
C. 4
D. 5
A. 0
B. 1 28. Complete the Java code below.
C. 2 Queue queue = new LinkedList();
D. 3 _____.offer("Ma'am BK");
A. add
20. How many nodes are represented in the given file B. LinkedList
path? C:\Users\bpena\Downloads\Midterm C. Queue
A. 1 D. queue
B. 2
C. 4 29. Which of the following is a correct import statement in
D. 5 Python?
A. deque from collections import
21. Which of the following is NOT a step in converting an B. from collections import deque
infix into a postfix expression? C. import collections from deque
A. If the token is an operand, append it to the postfix D. import from collections deque
expression.
B. If the token is an operator, push it to the stack if 30. Which method should be used if you need to identify
empty. the first item in a queue?
C. If a left parenthesis is encountered, pop all the A. element()
elements until a right parenthesis is encountered. B. offer()
D. Classify the token as operand or operator. C. peek()
D. poll()
22. Complete the statement below.
DefaultMutableTreeNode root = new
DefaultMutableTreeNode("M"); II. (25 points : 5 items x 5 points)
JTree tree = new JTree(_____); Answer the following items on the space provided or a
A. JTree separate sheet of paper (as needed).
B. "M"
1. Illustrate a stack based on these ordered elements:
C. tree
Cloud, Infernal, Mountain, Ocean.
D. root
2. Identify the parent nodes and child nodes.
23. Which represents the root node in the given file path?
C:\Users\bpena\Desktop\Midterm
A. C:
B. Users
C. bpena
D. Midterm
24. Which causes an error in the following statements?
Stack stack = new Stack();
stack.push();
A. Stack
1st Term, SY 2022-2023 1000005184 — IT1815
Midterm Examination Page 3

Name:_____________________________ Section:___________________________ Date:_______________


3. Determine the order after post-order traversal. RUBRIC:

FOR ILLUSTRATION
CRITERIA PERFORMANCE INDICATOR POINTS
The illustration is drawn and
Content 3
labeled correctly.
The illustration is well presented
Organization 2
and organized.
TOTAL 5

4. Illustrate a queue based on these ordered elements:


Sona, Lulu, Janna, Nami.
5. Convert infix 6 + (7 * 8) into postfix.

You might also like