# Data Structures And Algorithms Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Cr4satya
C
Cr4satya
Community Contributor
Quizzes Created: 3 | Total Attempts: 16,369
Questions: 16 | Attempts: 15,712

Settings

Check out our super fun and informational data structures and algorithms quiz! The questions are set from the topics such as arrays, records, pointers, linked lists, stacks, queues, recursion, trees, sorting, and searching. Attempt them carefully. Let's see how well versed are you with the various concepts of data structures & algorithms. For a better conceptual understanding and to expand your knowledge, this quiz is very useful. Let's go for it. Best of luck to you!

• 1.

### How can you measure the efficiency of an the algorithm?

• A.

Processor and memory

• B.

Complexity and capacity

• C.

Time and space

• D.

Data and space

C. Time and space
Explanation
To measure the efficiency of an algorithm, two important factors need to be considered: time and space. Time refers to the amount of time it takes for the algorithm to execute and complete its task. This can be measured in terms of the number of operations or steps performed. Space, on the other hand, refers to the amount of memory or storage required by the algorithm to execute. It can be measured in terms of the amount of memory used or the number of variables and data structures used. By considering both time and space, we can evaluate the efficiency of an algorithm and compare it with other algorithms to determine which one is more efficient.

Rate this question:

• 2.

### How can we measure the time factor when determining the efficiency of the algorithm?

• A.

Counting microseconds

• B.

Counting the number of key operations

• C.

Counting the number of statements

• D.

Counting the kilobytes of algorithm

B. Counting the number of key operations
Explanation
To measure the time factor when determining the efficiency of an algorithm, one can count the number of key operations. Key operations refer to the fundamental operations performed in the algorithm, such as comparisons, assignments, arithmetic operations, etc. By counting these key operations, we can get an estimate of the algorithm's time complexity, which helps in analyzing and comparing different algorithms based on their efficiency. This approach allows us to focus on the essential operations and disregard the specific details of the hardware or implementation.

Rate this question:

• 3.

### The complexity theory does not contain the following case, which is?

• A.

Best case

• B.

Worst case

• C.

Average case

• D.

Null case

D. Null case
Explanation
The complexity theory does not consider the "Null case" because it refers to the scenario where there is no input or the input size is zero. Since the complexity theory focuses on analyzing the performance of algorithms based on input size, the null case is not applicable as there is no input to analyze. Therefore, the null case is not included in the complexity theory.

Rate this question:

• 4.

### The Average case occurs in the linear search algorithm.

• A.

When Item is somewhere in the middle of the array

• B.

When Item is not in the array at all

• C.

When Item is the last element in the array

• D.

When Item is the last element in the array or is not there at all

A. When Item is somewhere in the middle of the array
Explanation
In the linear search algorithm, the average case occurs when the item being searched for is somewhere in the middle of the array. This means that the algorithm will have to iterate through a significant portion of the array before finding the item. In the other cases mentioned, such as when the item is not in the array at all or when it is the last element, the algorithm may find the item more quickly. Therefore, the average case specifically refers to the scenario where the item is located in the middle of the array.

Rate this question:

• 5.

### The complexity of the linear search algorithm is

• A.

O(n)

• B.

O(log n)

• C.

O(n2)

• D.

O(n log n)

A. O(n)
Explanation
The complexity of the linear search algorithm is O(n) because it has a linear time complexity, meaning that the time it takes to search for an element in a list increases linearly with the size of the list. In other words, as the number of elements in the list increases, the time it takes to find a specific element also increases proportionally. This is because the linear search algorithm checks each element in the list one by one until it finds a match or reaches the end of the list.

Rate this question:

• 6.

### The complexity of the Binary search algorithm is

• A.

O(n)

• B.

O(log n)

• C.

O(n2)

• D.

O(n log n)

B. O(log n)
Explanation
In the Binary search algorithm, the search space is divided in half at each step, leading to a significant reduction in the number of elements that need to be examined. This results in a time complexity of O(log n), where "n" represents the number of elements in the sorted array being searched. This efficiency makes binary search one of the fastest searching algorithms for sorted arrays.

Rate this question:

• 7.

### The complexity of the Bubble sort algorithm is

• A.

O(n)

• B.

O(log n)

• C.

O(n2)

• D.

O(n log n)

C. O(n2)
Explanation
The complexity of the Bubble sort algorithm is O(n2) because it involves comparing and swapping adjacent elements multiple times until the entire array is sorted. In the worst-case scenario, where the array is sorted in descending order, the algorithm would require n-1 passes to sort n elements. Since each pass requires n-1 comparisons, the total number of comparisons would be (n-1) * (n-1) = n2 - 2n + 1, which is approximately equal to O(n2).

Rate this question:

• 8.

### The complexity of the merge sort algorithm is

• A.

O(n)

• B.

O(log n)

• C.

O(n2)

• D.

O(n log n)

D. O(n log n)
Explanation
The merge sort algorithm has a time complexity of O(n log n). This means that the time it takes to sort a list of n elements using merge sort is proportional to n multiplied by the logarithm of n. This time complexity is achieved by dividing the list into smaller sublists, sorting them individually, and then merging them back together in a sorted manner. As the size of the list increases, the time taken to sort it increases at a slower rate than the size itself, making merge sort an efficient algorithm for large datasets.

Rate this question:

• 9.

### When an indirect change of the values of a variable in one module by another module happens, it's called what?

• A.

Internal change

• B.

Inter-module change

• C.

Side effect

• D.

Side-module update

C. Side effect
Explanation
When an indirect change of the values of a variable in one module by another module happens, it is referred to as a side effect. This means that the values of the variable are modified unintentionally or unexpectedly due to the actions of another module. Side effects can occur when there is a lack of encapsulation or proper control over the access and manipulation of variables between different modules.

Rate this question:

• 10.

### Can you guess which of the following data structure is NOT a linear data structure?

• A.

Arrays

• B.

• C.

Both of above

• D.

None of above

D. None of above
Explanation
The correct answer is "None of above". This means that both arrays and linked lists are linear data structures. Arrays store elements in contiguous memory locations, allowing for easy random access. Linked lists, on the other hand, store elements in separate nodes that are connected through pointers, enabling efficient insertion and deletion operations. Therefore, both arrays and linked lists are examples of linear data structures.

Rate this question:

• 11.

### Can you guess which of the following data structure is linear data structure?

• A.

Trees

• B.

Graphs

• C.

Arrays

• D.

None of above

C. Arrays
Explanation
Arrays are a linear data structure because they store elements in a contiguous memory location. Each element is accessed using an index, and the elements are stored in a specific order. This allows for efficient traversal and manipulation of the elements in a linear manner. Trees and graphs, on the other hand, are non-linear data structures as they have a hierarchical or interconnected structure. Therefore, the correct answer is Arrays.

Rate this question:

• 12.

### Which function findings the location of the element with a given value is:

• A.

Traversal

• B.

Search

• C.

Sort

• D.

None of above

B. Search
Explanation
The function that finds the location of the element with a given value is called "Search". This function is used to search for a specific value within a data structure or array and returns the location or index where the value is found. It is commonly used in algorithms and programming to locate and retrieve specific elements from a collection of data.

Rate this question:

• 13.

### Arrays are the best data structures

• A.

For relatively permanent collections of data

• B.

For the size of the structure and the data in the structure are constantly changing

• C.

For both of the above situation

• D.

For none of the above situation

A. For relatively permanent collections of data
Explanation
Arrays are considered the best data structures for relatively permanent collections of data because they provide efficient random access to elements. Arrays have a fixed size and are suitable for situations where the size of the structure and the data in the structure do not change frequently. They allow for constant-time access to elements, making them ideal for scenarios where frequent access to elements is required. However, arrays may not be suitable for situations where the size of the structure and the data within it are constantly changing, as resizing arrays can be costly in terms of time and memory.

Rate this question:

• 14.

### Linked lists are the best suited

• A.

For relatively permanent collections of data

• B.

for the size of the structure and the data in the structure are constantly changing

• C.

For both of the above situation

• D.

For none of the above situation

B. for the size of the structure and the data in the structure are constantly changing
Explanation
Linked lists are the best suited for the size of the structure and the data in the structure are constantly changing. This is because linked lists allow for efficient insertion and deletion of elements at any position in the list, regardless of its size. Unlike arrays, linked lists do not require contiguous memory allocation, making it easier to resize and modify the structure as needed. Therefore, linked lists are a flexible data structure that can adapt to changes in the size and content of the data.

Rate this question:

• 15.

### Each array declaration does not give, implicitly or explicitly, the information about which of the following?

• A.

The name of the array

• B.

The exact data type of array

• C.

The first data from the set that will be stored

• D.

Index set

C. The first data from the set that will be stored
Explanation
The given question asks about the information that is not provided by each array declaration. The correct answer is "the first data from the set that will be stored." When declaring an array, we specify the name of the array, the exact data type of the array, and the index set (the range of valid indices for the array). However, the declaration does not specify what the first data element in the array will be. The initial values of the array elements are typically not determined during the declaration but are assigned separately.

Rate this question:

• 16.

### Why are the elements of an array are stored successively memory cells?

• A.

In this way, the computer can keep track only the address of the first element, and the addresses of other elements can be calculated

• B.

The architecture of computer memory does not allow arrays to store other than serially

• C.

Both of above

• D.

None of above

A. In this way, the computer can keep track only the address of the first element, and the addresses of other elements can be calculated
Explanation
The elements of an array are stored successively in memory cells so that the computer can keep track of only the address of the first element. This allows for efficient calculation of the addresses of other elements in the array. Storing the elements in a non-sequential manner would require additional memory management and make it more difficult to access and manipulate the elements of the array. Therefore, the elements of an array are stored successively in memory cells to optimize memory usage and access.

Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

• Current Version
• Feb 15, 2024
Quiz Edited by
ProProfs Editorial Team
• Jul 09, 2011
Quiz Created by
Cr4satya

Related Topics