WorksheetsDSA Finals
Total questions: 87
Worksheet time: 57mins
This operation adds an item to the queue.
Dequeue
Enqueue
Pop
Push
It represents the hierarchical nature of a structure in a graphical form.
Linked List
Queue
Stack
Tree
It is the number of child nodes in a subtree.
Degree
Depth
Level
Subtree
Which Java package contains the Queue interface?
java.awt
java.oi
java.util
javax.swing
If a tree consists of nodes where each has two (2) child nodes at most, what is it called?
Binary Tree
Dual Tree
Double Tree
Twin Tree
This operation removes an item from the top of the stack.
Peek
Pop
Pull
Push
It is an ordered list in which the first element added is the first element retrieved or removed.
Linked List
Queue
Stack
Tree
Which Java package contains the Stack class?
java.awt
java.oi
java.util
javax.swing
What is the process of visiting all the nodes in a specific order?
Abstraction
Inheritance
Polymorphism
Traversal
What do you call a node that has no child nodes?
Internal Node
Parent Node
Leaf Node
Root Node
It is the measure of a node's distance from its root.
Degree
Edge
Level
Subtree
It is a tree within a tree.
Degree
Depth
Level
Subtree
This is the tree's highest level.
Degree
Depth
Edge
Subtree
This operation removes an item from the queue.
Dequeue
Enqueue
Pop
Push
This operation adds an item to the top of the stack.
Peek
Pop
Pull
Push
Which method should be used if you need to dequeue an item in Java without encountering an exception?
element()
offer()
poll()
remove()
Which represents the root node in the given file path? C:\Users\bpena\Desktop\Midterm
C.
Users
bpena
Midterm
Which of the following is NOT a step in evaluating a postfix expression?
If the token is an operator, push it to the stack.
If the token is an operator, perform two (2) pop operations.
Classify the token as operand or operator.
Push the result of the two (2) popped operands to the stack after performing the required operation.
Which of the following is NOT a step in converting an infix into a postfix expression?
If the token is an operand, append it to the postfix expression.
If the token is an operator, push it to the stack if empty.
If a left parenthesis is encountered, pop all the elements until a right parenthesis is encountered.
Classify the token as operand or operator.
What is the tree's depth?
0
1
2
3
Which of the following is a correct import statement in Python?
deque from collections import
from collections import deque
import collections from deque
import from collections deque
How many one-level subtree does the tree have?
0
1
2
3
Complete the Java code below.
Queue queue = new LinkedList();
_____.offer("Ma'am BK");
add
LinkedList
Queue
queue
How many nodes are represented in the given file path? C:\Users\bpena\Downloads\Midterm
1
2
4
5
How many directories represent child nodes in the given file path? C:\Users\bpena\Documents\Midterm
1
2
4
5
Which directory represents the leaf node in the given file path? C:\Users\bpena\Documents\Midterm
C:
Users
bpena
Midterm
Which method should be used if you need to identify the first item in a queue?
enqueue()
offer()
peek()
poll()
Which causes an error in the following statements?
Stack stack = new Stack();
stack.push();
Stack
stack
new
push()
How many directories represent parent nodes in the given file path? C:\Users\bpena\Desktop\Midterm
1
2
4
5
Which of the following is NOT an example of a palindrome?
data
eve
madam
refer
Consist of a set of vertices (nodes) and a set of edges (relations) between the pairs of vertices.
Graph
Priority Queue
Map
Set
As presented in the graph, what are the vertices (V)?
{A, B, C, D, E}
{ {A, B}, {A, C}, {C, D}, {D, E} }
{A, B, C, d, E}
{ {A, B}, {A, C}, {C, D}, {A, E} }
As presented in the graph, what are the edges (E)?
{ {A, B}, {A, C}, {C, D}, {A, D} }
{ {A, B}, {A, C}, {C, D}, {D, E} }
{ {A, B}, {A, C}, {B, C}, {C, D} }
{ {A, B}, {A, C}, {C, D}, {A, E} }
Digraph is also known as?
Directed Graph
Undirected Graph
Mixed Graph
Simple Graph
Vertices is also known as?
Nodes
Relations
Edges
Lines
Edges is also known as?
Nodes
Relations
Vertices
Lines
Weighted Graph
Consist of edges that are associated with values.
Consist of vertices that are associated with values.
Consist of edges that have no values.
Consist of edges that are connected in a circular pattern.
Which is true about Vertex?
A vertex is adjacent to another vertex if there is an edge to it from that other vertex.
A vertex is adjacent to another vertex if they are the same vertex.
A vertex is adjacent to another vertex if there is no edge between them.
A vertex is adjacent to another vertex if it is part of a different graph.
What are the edges?
{ {A, B}, {B, C}, {C, E}, {D, B}, {E, D} }
{ {A, B}, {B, C}, {C, E}, {D, B}, {E, B} }
{ {A, B}, {B, C}, {C, D}, {D, B}, {E, D} }
{ {D, B}, {B, C}, {C, E}, {D, B}, {E, D} }
Adjacent of A?
B and C
C and E
A and D
B
Which is true about Degree?
The degree of a vertex is the number of edges which has that vertex as an endpoint.
The degree of a vertex is the number of vertices connected to it.
The degree of a vertex is the number of edges that do not connect to it.
The degree of a vertex is the total number of vertices in the graph.
What is the Degree of Vertex A?
2
1
3
4
What is the Degree of Vertex A?
2
1
3
4
What is the Degree of Vertex E?
2
1
3
4
Is a sequence of adjacent vertices.
Path
Graph
Node
Edge
Is a square matrix with dimensions equivalent to the number of vertices in the graph.
Adjacency Matrix
Adjacency List
Path
Degree
It is used to indicate whether pairs of vertices are adjacent or not.
Adjacency Matrix
Adjacency List
Path
Degree
Uses an array of lists to represent a graph.
Adjacency Matrix
Adjacency List
Path
Degree
It is used to indicate whether pairs of vertices are adjacent or not.
Adjacency Matrix
Adjacency List
Path
Degree
Identify the elements in the Adjacency Matrix
1
(a)
2
(a)
3
(a)
4
(a)
5
(a)
Identify the elements missing in the Adjacency List
A
(a)
B
(a)
C
(a)
D
(a)
E
(a)
Which Java package contains the Graph class?
ArrayList<ArrayList> name = new ArrayList<>();
ArrayList<ArrayList> name = new ArrayList<>():
ArrayList<ArrayList> name = new ArrayList()<>;
Graph<Graph> name = new Graph<>();
Is the process of arranging data in specific order.
Sorting
Filtering
Searching
Grouping
Every pair of adjacent items is compared and items are swapped until they are in order.
Bubble Sort
Selection Sort
Insertion Sort
Shell Sort
The smallest unsorted item is chosen and then swapped with the item in the next position to be filled.
Bubble Sort
Selection Sort
Insertion Sort
Shell Sort
The comparison applies to adjacent items and previously scanned items.
Merge Sort
Selection Sort
Insertion Sort
Shell Sort
Utilizes a decreasing interval sequence to sort elements, often starting with a sequence like N/2, N/4, ..., 1, and eventually applying Insertion Sort when the interval reaches 1
Merge Sort
Selection Sort
Insertion Sort
Shell Sort
The list is divided into sorted sub-lists then combined into a single sorted list.
Merge Sort
Selection Sort
Insertion Sort
Shell Sort
How would you declare and initialize a Sorting in Java?
ArrayList values = new ArrayList();
Sort values = new Sort();
Sort <Sort> values = new Sort<>();
ArrayList values = new Sort();
ArrayList values = new ArrayList();
Collections.addAll(values, 5, 1, 10);
Collections.sort(value);
1, 5, 10
Error
5, 1, 10
10, 1, 5
ArrayList values = new ArrayList();
Collections.addAll(values, 5, 1, 10);
Collections.sort(values);
1, 5, 10
Error
5, 1, 10
10, 1, 5
values = [1, 7, 4]
values.sort(values)
Error
1, 4, 7
1, 7, 4
4, 1, 7
values = [1, 7, 4]
values.sort()
Error
1, 4, 7
1, 7, 4
4, 1, 7
Is the science of training machines to perform human tasks.
Artificial Intelligence
R.U.F.F.Y AI
Machine Learning
Machine Learning Model
Which of the following is not a subset of AI?
Reasoning
Natural Language Processing
Machine Learning
Quantum Computation
Making inferences based on data.
Reasoning
Natural Language Processing
Planning
Quantum Computation
Understanding both written text and human speech.
Reasoning
Natural Language Processing
Planning
Quantum Computation
Acting autonomously and flexibly to construct a sequence of actions to reach a final goal.
Reasoning
Machine Learning
Planning
Quantum Computation
Is a form of artificial intelligence that enables a system to learn from data, identify patterns, and make decisions with minimal human intervention.
Reasoning
Machine Learning
Planning
Quantum Computation
Common examples of machine learning Except
When you search and view products in an online shopping site, you may encounter other similar products that you may find interesting the next time you go online.
Virtual assistants like Siri and Alexa, are asked over voice when you need to find information.
Transportation apps suggest faster routes and computes prices of rides based on the rider demand.
Calculators perform basic arithmetic operations (addition, subtraction, multiplication, division) based on predefined rules and user input.
Which of the following is not a purpose of machine learning?
Classification
Clustering
Prediction
Data Entry
Classifying an item into a distinct set of categories (Ex. Recognizing the object in an image)
Classification
Clustering
Prediction
Data Entry
Grouping items with common properties (Ex. Facebook suggesting people to add in a group)
Classification
Clustering
Prediction
Data Entry
Forecasting future values (Ex. Demand for products around holiday season)
Classification
Clustering
Prediction
Data Entry
Is the output generated when you train your machine learning algorithm with data.
Artificial Intelligence
R.U.F.F.Y AI
Machine Learning
Machine Learning Model
The machine is provided with an established set of data (labeled data).
Supervised Learning
Unsupervised Learning
Semi-Supervised Learning
Reinforcement Learning
The machine is provided with a set of data but is not provided with a specific answer (unlabeled data). The machine may identify trends of similarity through clustering.
Supervised Learning
Unsupervised Learning
Semi-Supervised Learning
Reinforcement Learning
The machine learns from a dataset that includes both labeled and unlabeled data, usually most
unlabeled.
Supervised Learning
Unsupervised Learning
Semi-Supervised Learning
Reinforcement Learning
The machine learns through trial and error. It is often used for robotics, gaming, and navigation. It has three (3) primary components.
Supervised Learning
Unsupervised Learning
Semi-Supervised Learning
Reinforcement Learning
What are the categories of Supervised Learning under Machine Learning Model? (2)
Classification
Regression
Inference
Insertion
Predicting the values of a continuous variable.
Ex. Weather forecasting provides a prediction on the weather based on historical weather patterns and the current conditions.
Supervised Learning under Machine Learning Model?
Classification
Regression
Inference
Insertion
What are the components of Reinforcement Learning under Machine Learning Model? (3)
Agent
Environment
Action
Equation
The learner or decision maker (self-driving car)
Agent
Environment
Action
Equation
Everything the agent interacts with (streets other cars, human drivers, etc.)
Agent
Environment
Action
Equation
What the agent can do (drive, pick lane, etc.)
Agent
Environment
Action
Equation
Identifying whether an e-mail is a spam or not is an example of which machine learning model?
Supervised Learning
Unsupervised Learning
Semi-Supervised Learning
Reinforcement Learning
A self-driving car is an example of which machine learning model?
Supervised Learning
Unsupervised Learning
Semi-Supervised Learning
Reinforcement Learning
