wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

BSCS 2-2 - DAA - Midterm Examination - 2nd Sem 2022-2023

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.

The following functions are linear data structure, except:

a)

Queue

b)

Array

c)

Tree

d)

Stack

2.

Which of the following data structures are in “Last-In-First-Out” structure?

a)

Queue

b)

Array

c)

Tree

d)

Stack

3.

This data structure uses pointer/s to connect nodes.

a)

Linked List

b)

Variable

c)

Trees

d)

Stack

4.

A function we used in inserting item/value into stack

a)

Popping

b)

Pop

c)

Pushing

d)

Push

5.

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?

a)

WXYZ

b)

ZYXW

c)

WXZY

d)

ZYWX

6.

Which of the following statements that best describes an Array?

a)

Container of objects of similar types

b)

A data structure that shows a hierarchical behavior.

c)

Arrays are immutable once initialized

d)

Array can do non-linear data structure

7.

Which of the following function is the proper way to declare multi-dimensional array in Java?

a)

int[][]arr:

b)

int[] arr;

c)

int[][]arr;

d)

int[[]] arr;

8.

What is the output of the following Java Code ?

a)

5 and 3

b)

3 and 5

c)

2 and 4

d)

4 and 2

9.

The elements we inserted in an Array are accessed                      .

a)

Sequentially

b)

Exponentially

c)

Logarithmically

d)

Randomly

10.

From Non-linear data structure, what is the reason why tree traversal is different from graph traversal?

a)

Because graphs may have loops.

b)

Because trees are not connected.

c)

Because trees have root.

d)

None of the mention, because tree is a subset of graph.

11.

Every entry in a Stack are in “ordered”. What is the meaning of this statement?

a)

The entries are stored in a linked list

b)

Stack entries may be compared with the ‘<‘ operation

c)

The entries are stored in a linked list

d)

There is a Sequential entry that is one by

12.

What will be the result of the given postfix expression: 8 4 2 4 + - *?

a)

16

b)

12

c)

-12

d)

-16

13.

In AVL tree, AVL stands for what?

a)

Adelson, Velski, Landis

b)

Andelson, Velski, Landis

c)

Andelson, Vetski, Landis

d)

Adelsonn, Velski, Landis

14.

The searching and sorting algorithms are best implemented with which data structure?

a)

Array Based List

b)

Linked List

c)

Both a and b

d)

None of the mention

15.

Which search algorithm is best for large list?

a)

For each loop

b)

Binary Search

c)

Sequential Search

d)

For loop

16.

A function we used to map every input values to convert it into a range of indexes of an array.

a)

Hashing

b)

Hash Table

c)

Hash Code

d)

Hash Key

17.

Which of the following data structure uses FIFO method.

a)

Queue

b)

Array

c)

Tree

d)

Stack

18.

Which of the following statements is true about B Trees

a)

Every complete binary tree is also a full B tree

b)

Self-balancing tree that maintains sorted data and does not allow searches, sequential access, insertions, and deletions in logarithmic time.

c)

A tree structure that has many more than two children

d)

Each and every node only contains elements lesser than itself on the left side and elements greater than itself on the right side

19.

In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?

a)

Pointer to integer

b)

Node

c)

Pointer to link

d)

Pointer to node

20.

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.

a)

Recurrence Relation

b)

Iterative Method

c)

Mathematical Induction

d)

Tracing Tree

21.

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.

a)

Deciding on Appropriate Data Structure

b)

Analyzing an Algorithm

c)

Proving an Algorithm’s Correctness

d)

Algorithm Design Techniques

22.

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.

a)

Deciding on Appropriate Data Structure

b)

Analyzing an Algorithm

c)

Proving an Algorithm’s Correctness

d)

Algorithm Design Techniques

23.

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.

a)

Deciding on Appropriate Data Structure

b)

Analyzing an Algorithm

c)

Proving an Algorithm’s Correctness

d)

Algorithm Design Techniques

24.

A step in a proof by induction where to prove the validity of the statement based on the steps we assumed to exist.

a)

Base Case

b)

Inductive Hypothesis

c)

Inductive Steps

d)

None of the above

25.

In writing recurrence relation, the T(n) or F(n) represents what?

a)

Recursion

b)

Recursive Call

c)

Running Times

d)

Recursive Function

26.

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.

a)

Recursion

b)

Recursive Call

c)

Running Times

d)

Recursive Function

27.

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.

a)

Substitution Method

b)

Iteration Method

c)

Tracing Tree

d)

Recursion Tree

28.

Which of the following expression is correct, that best describes the Summation/Sigma sign?

a)

b)

c)

d)

None of the above

29.

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

a)

b)

c)

d)

30.

Consider an algorithm with a time complexity of O(n^2). Which of the following statements is true?

a)

The algorithm will always run faster than an algorithm with a time complexity of O(n log n)

b)

The algorithm will always run slower than an algorithm with a time complexity of O(n log n)

c)

The algorithm's running time will increase quadratically as the input size increases

d)

The algorithm's running time will increase linearly as the input size increases

31.

If an algorithm has a time complexity of O(1), what does this imply?

a)

The algorithm's running time remains constant regardless of the input size.

b)

The algorithm's running time grows logarithmically with the input size.

c)

The algorithm's running time grows linearly with the input size

d)

The algorithm's running time is undefined

32.

Consider the given algorithm, what is the time complexity of this algorithm?

a)

O(n)

b)

O(n log n)

c)

O(2^n)

d)

O(n^2)

33.

What is the base case in a recurrence relation?

a)

The case with the largest input size where the solution is known.

b)

The case where the recurrence relation recurses indefinitely.

c)

The case that determines when the recursion stops and provides a known solution.

d)

The case where the recurrence relation terminates.

34.

In the context of recurrence relations, what does the concept of "recursion in depth" represent?

a)

The number of base cases in the recurrence relation.

b)

The maximum level of recursion reached during the execution of the algorithm.

c)

The number of distinct subproblems generated by the recurrence relation.

d)

The number of recursive calls made within a single recursive step

35.

When solving a recurrence relation using the iterative method, which of the following statements is true?

a)

The iterative method involves breaking down the problem into smaller subproblems and solving them recursively.

b)

The iterative method utilizes a loop structure to iteratively compute the solution based on the recurrence relation.

c)

The iterative method requires the identification of a base case to terminate the recursion.

d)

The iterative method is generally more efficient than the recursive method in solving recurrence relations.