NEW
Font size
WorksheetsBSCS 2-2 - DAA - Midterm Examination - 2nd Sem 2022-2023
Total questions: 35
Worksheet time: 18mins
The following functions are linear data structure, except:
Queue
Array
Tree
Stack
Which of the following data structures are in “Last-In-First-Out” structure?
Queue
Array
Tree
Stack
This data structure uses pointer/s to connect nodes.
Linked List
Variable
Trees
Stack
A function we used in inserting item/value into stack
Popping
Pop
Pushing
Push
If we placed the following elements: “W”, “X”, “Y”, and “Z” in a stack and removed one at a time, in what order will they become?
WXYZ
ZYXW
WXZY
ZYWX
Which of the following statements that best describes an Array?
Container of objects of similar types
A data structure that shows a hierarchical behavior.
Arrays are immutable once initialized
Array can do non-linear data structure
Which of the following function is the proper way to declare multi-dimensional array in Java?
int[][]arr:
int[] arr;
int[][]arr;
int[[]] arr;
What is the output of the following Java Code ?
5 and 3
3 and 5
2 and 4
4 and 2
The elements we inserted in an Array are accessed .
Sequentially
Exponentially
Logarithmically
Randomly
From Non-linear data structure, what is the reason why tree traversal is different from graph traversal?
Because graphs may have loops.
Because trees are not connected.
Because trees have root.
None of the mention, because tree is a subset of graph.
Every entry in a Stack are in “ordered”. What is the meaning of this statement?
The entries are stored in a linked list
Stack entries may be compared with the ‘<‘ operation
The entries are stored in a linked list
There is a Sequential entry that is one by
What will be the result of the given postfix expression: 8 4 2 4 + - *?
16
12
-12
-16
In AVL tree, AVL stands for what?
Adelson, Velski, Landis
Andelson, Velski, Landis
Andelson, Vetski, Landis
Adelsonn, Velski, Landis
The searching and sorting algorithms are best implemented with which data structure?
Array Based List
Linked List
Both a and b
None of the mention
Which search algorithm is best for large list?
For each loop
Binary Search
Sequential Search
For loop
A function we used to map every input values to convert it into a range of indexes of an array.
Hashing
Hash Table
Hash Code
Hash Key
Which of the following data structure uses FIFO method.
Queue
Array
Tree
Stack
Which of the following statements is true about B Trees
Every complete binary tree is also a full B tree
Self-balancing tree that maintains sorted data and does not allow searches, sequential access, insertions, and deletions in logarithmic time.
A tree structure that has many more than two children
Each and every node only contains elements lesser than itself on the left side and elements greater than itself on the right side
In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?
Pointer to integer
Node
Pointer to link
Pointer to node
When designing a new algorithm, a very thorough analysis of its correctness and efficiency is needed. It is said to be the essential tool that proves an algorithm's correctness.
Recurrence Relation
Iterative Method
Mathematical Induction
Tracing Tree
As programmers, we code with the future in mind and to do that, this is one of the steps in solving a problem that we indicate the Algorithm’s efficiency.
Deciding on Appropriate Data Structure
Analyzing an Algorithm
Proving an Algorithm’s Correctness
Algorithm Design Techniques
For many problems, algorithms are very complex. Reliability of an algorithm cannot be claimed unless and until it gives the correct output for each of the valid inputs. This is one of the steps in solving a problem that the correctness of an algorithm can be quickly proved by checking certain conditions.
Deciding on Appropriate Data Structure
Analyzing an Algorithm
Proving an Algorithm’s Correctness
Algorithm Design Techniques
This step in solving a problem is essential because this step will help us to structure and organize data in a way that enables it to be searched in a particular way in less than linear time.
Deciding on Appropriate Data Structure
Analyzing an Algorithm
Proving an Algorithm’s Correctness
Algorithm Design Techniques
A step in a proof by induction where to prove the validity of the statement based on the steps we assumed to exist.
Base Case
Inductive Hypothesis
Inductive Steps
None of the above
In writing recurrence relation, the T(n) or F(n) represents what?
Recursion
Recursive Call
Running Times
Recursive Function
Recurrence relations is an equation that describes a function in terms of its values on smaller inputs. It is useful when expressing the ______of the recursive functions.
Recursion
Recursive Call
Running Times
Recursive Function
This approach in solving recurrence relation is to iteratively substitute the value of the recurrent part of the equation until a pattern (usually a summation) is noticed, at which point the summation can be used to evaluate the recurrence.
Substitution Method
Iteration Method
Tracing Tree
Recursion Tree
Which of the following expression is correct, that best describes the Summation/Sigma sign?
None of the above
Algorithms for which the running time is logarithmic are those where processing discards a large quantity of values in each iteration. We usually encounter algorithms that run in time proportional to log ‘n’ for some suitable defined ‘n’. Which of the following best describes the log for the given expression: k = 2n
Consider an algorithm with a time complexity of O(n^2). Which of the following statements is true?
The algorithm will always run faster than an algorithm with a time complexity of O(n log n)
The algorithm will always run slower than an algorithm with a time complexity of O(n log n)
The algorithm's running time will increase quadratically as the input size increases
The algorithm's running time will increase linearly as the input size increases
If an algorithm has a time complexity of O(1), what does this imply?
The algorithm's running time remains constant regardless of the input size.
The algorithm's running time grows logarithmically with the input size.
The algorithm's running time grows linearly with the input size
The algorithm's running time is undefined
Consider the given algorithm, what is the time complexity of this algorithm?
O(n)
O(n log n)
O(2^n)
O(n^2)
What is the base case in a recurrence relation?
The case with the largest input size where the solution is known.
The case where the recurrence relation recurses indefinitely.
The case that determines when the recursion stops and provides a known solution.
The case where the recurrence relation terminates.
In the context of recurrence relations, what does the concept of "recursion in depth" represent?
The number of base cases in the recurrence relation.
The maximum level of recursion reached during the execution of the algorithm.
The number of distinct subproblems generated by the recurrence relation.
The number of recursive calls made within a single recursive step
When solving a recurrence relation using the iterative method, which of the following statements is true?
The iterative method involves breaking down the problem into smaller subproblems and solving them recursively.
The iterative method utilizes a loop structure to iteratively compute the solution based on the recurrence relation.
The iterative method requires the identification of a base case to terminate the recursion.
The iterative method is generally more efficient than the recursive method in solving recurrence relations.
