Online Test On Data Structures

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Maheshjangid
M
Maheshjangid
Community Contributor
Quizzes Created: 2 | Total Attempts: 631
| Attempts: 141
SettingsSettings
Please wait...
  • 1/67 Questions

    Which of the following data structure is linear data structure?

    • Trees
    • Graphs
    • Arrays
    • None of above
Please wait...
About This Quiz


Attempt All of the following questions. Each question carry equal mark

Online Test On Data Structures - Quiz

Quiz Preview

  • 2. 

    Which of the following case does not exist in complexity theory

    • Best case

    • Worst case

    • Average case

    • Null case

    Correct Answer
    A. Null case
    Explanation
    The null case does not exist in complexity theory because it represents the absence of any input or operation. In complexity theory, we analyze the performance of algorithms based on different inputs and their sizes. The best case, worst case, and average case are all scenarios that can occur and have an impact on the algorithm's complexity. However, the null case, where there is no input or operation to analyze, is not considered in complexity theory.

    Rate this question:

  • 3. 

    The complexity of merge sort algorithm is

    • O(n)

    • O(log n)

    • O(n2)

    • O(n log n)

    Correct Answer
    A. O(n log n)
    Explanation
    Merge sort is a divide and conquer algorithm that divides the input array into two halves, recursively sorts them, and then merges the sorted halves. The time complexity of merge sort is O(n log n) because at each recursion level, the array is divided into two halves, resulting in log n levels. And at each level, the merge operation takes O(n) time to merge the two sorted halves. Therefore, the overall time complexity of merge sort is O(n log n).

    Rate this question:

  • 4. 

    The Average case occur in linear search algorithm

    • When Item is somewhere in the middle of the array

    • When Item is not in the array at all

    • When Item is the last element in the array

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

    Correct Answer
    A. When Item is somewhere in the middle of the array
    Explanation
    In the average case of a linear search algorithm, the item being searched for is assumed to be present in the array. However, the position of the item in the array is not known. Therefore, the algorithm needs to iterate through the array, comparing each element with the item being searched for until a match is found. In the case where the item is somewhere in the middle of the array, the algorithm would need to iterate through approximately half of the array before finding the item. This results in a time complexity of O(n/2), which is equivalent to O(n), where n is the size of the array.

    Rate this question:

  • 5. 

    The complexity of Bubble sort algorithm is

    • O(n)

    • O(log n)

    • O(n2)

    • O(n log n)

    Correct Answer
    A. O(n2)
    Explanation
    Bubble sort algorithm has a time complexity of O(n2). This means that the time taken by the algorithm to sort an array of n elements is proportional to the square of the number of elements. In other words, as the number of elements increases, the time taken to sort them increases exponentially. This is because the algorithm compares each element with every other element in the array, resulting in a nested loop structure. Therefore, the correct answer is O(n2).

    Rate this question:

  • 6. 

    The operation of processing each element in the list is known as

    • Sorting

    • Merging

    • Inserting

    • Traversal

    Correct Answer
    A. Traversal
    Explanation
    Traversal refers to the process of visiting and accessing each element in a list or data structure. It involves iterating through the elements one by one, without any specific order or arrangement. In this case, the operation described is the act of processing each element in the list, which aligns with the concept of traversal. Sorting, merging, and inserting, on the other hand, involve specific operations to rearrange or modify the elements in a list, which is not the case here.

    Rate this question:

  • 7. 

    Linked lists are best suited

    • For relatively permanent collections of data

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

    • For both of above situation

    • For none of above situation

    Correct Answer
    A. for the size of the structure and the data in the structure are constantly changing
    Explanation
    Linked lists are best suited for situations where the size of the structure and the data within the structure are constantly changing. This is because linked lists allow for efficient insertion and deletion of elements, as they do not require shifting of elements like arrays do. Additionally, linked lists can easily accommodate changes in size, as they can dynamically allocate memory as needed. Therefore, linked lists provide a flexible and efficient solution for managing data that is constantly changing in size.

    Rate this question:

  • 8. 

    The complexity of linear search algorithm is

    • O(n)

    • O(log n)

    • O(n2)

    • O(n log n)

    Correct Answer
    A. O(n)
    Explanation
    The complexity of a linear search algorithm is O(n) because in the worst-case scenario, the algorithm needs to iterate through each element in the list until it finds the desired element or reaches the end of the list. Therefore, the time taken by the algorithm is directly proportional to the size of the input list, making it a linear time complexity.

    Rate this question:

  • 9. 

    Two main measures for the efficiency of an algorithm are

    • Processor and memory

    • Complexity and capacity

    • Time and space

    • Data and space

    Correct Answer
    A. Time and space
    Explanation
    The efficiency of an algorithm is typically measured by two main factors: time and space. Time refers to the amount of time it takes for the algorithm to execute and complete its task, while space refers to the amount of memory or storage that the algorithm requires to run. By considering both time and space, we can determine how efficiently an algorithm utilizes computational resources.

    Rate this question:

  • 10. 

    Finding the location of the element with a given value is:

    • Traversal

    • Search

    • Sort

    • None of above

    Correct Answer
    A. Search
    Explanation
    The correct answer is "Search" because finding the location of an element with a given value involves searching through a data structure or collection to locate the desired element. Traversal refers to the process of visiting and accessing each element in a data structure, while sorting involves arranging elements in a specific order. Therefore, "Search" is the most appropriate term for this particular action of locating an element.

    Rate this question:

  • 11. 

    Arrays are best data structures

    • For relatively permanent collections of data

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

    • For both of above situation

    • For none of above situation

    Correct Answer
    A. For relatively permanent collections of data
    Explanation
    Arrays are best data structures for relatively permanent collections of data because arrays provide efficient random access to elements. Once an array is created, its size cannot be changed, making it suitable for storing data that does not need to be frequently modified or resized. Arrays also have a fixed size, which allows for efficient memory allocation. Therefore, arrays are a good choice when the collection of data is not expected to change frequently and when random access to elements is required.

    Rate this question:

  • 12. 

    The Worst case occur in linear search algorithm when

    • Item is somewhere in the middle of the array

    • Item is not in the array at all

    • Item is the last element in the array

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

    Correct Answer
    A. Item is the last element in the array or is not there at all
    Explanation
    The worst case for a linear search algorithm occurs when the item being searched for is the last element in the array or is not present in the array at all. In both of these scenarios, the algorithm has to iterate through the entire array to determine that the item is either at the last position or not present. This results in the maximum number of comparisons and makes it the worst case for the linear search algorithm.

    Rate this question:

  • 13. 

    Which of the following data structure is not linear data structure?

    • Arrays

    • Linked lists

    • Both of above

    • None of above

    Correct Answer
    A. 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 direct access to any element. Linked lists, on the other hand, consist of nodes that are connected through pointers, forming a linear sequence. Therefore, both arrays and linked lists are examples of linear data structures.

    Rate this question:

  • 14. 

    Each array declaration need not give, implicitly or explicitly, the information about

    • The name of array

    • the data type of array

    • The first data from the set to be stored

    • The index set of the array

    Correct Answer
    A. The first data from the set to be stored
    Explanation
    When declaring an array, it is not necessary to provide the information about the first data from the set to be stored. The declaration only needs to include the name of the array and the data type of the array. The first data from the set to be stored can be assigned later when the array is initialized or when individual elements of the array are assigned values.

    Rate this question:

  • 15. 

    The space factor when determining the efficiency of algorithm is measured by

    • Counting the maximum memory needed by the algorithm

    • Counting the minimum memory needed by the algorithm

    • Counting the average memory needed by the algorithm

    • Counting the maximum disk space needed by the algorithm

    Correct Answer
    A. Counting the maximum memory needed by the algorithm
    Explanation
    The space factor when determining the efficiency of an algorithm is measured by counting the maximum memory needed by the algorithm. This means that the efficiency of the algorithm is evaluated based on the maximum amount of memory it requires to perform its tasks. By considering the maximum memory usage, we can assess the algorithm's performance in terms of space utilization and make informed decisions about its efficiency.

    Rate this question:

  • 16. 

    The elements of an array are stored successively in memory cells because

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

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

    • Both of above

    • None of above

    Correct Answer
    A. By this way 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 because by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated. This means that the computer only needs to know the starting address of the array, and it can easily calculate the address of any other element by adding the appropriate offset to the starting address. This allows for efficient access and manipulation of array elements in memory.

    Rate this question:

  • 17. 

    The complexity of Binary search algorithm is

    • O(n)

    • O(log )

    • O(n2)

    • O(n log n)

    Correct Answer
    A. O(log )
    Explanation
    The correct answer is O(log ). The complexity of the Binary search algorithm is logarithmic because it divides the search space in half with each comparison. This means that as the size of the input increases, the number of steps required to find the desired element increases at a much slower rate compared to linear or quadratic time complexities. Therefore, the time complexity of the Binary search algorithm is O(log ).

    Rate this question:

  • 18. 

    The time factor when determining the efficiency of algorithm is measured by

    • Counting microseconds

    • Counting the number of key operations

    • Counting the number of statements

    • Counting the kilobytes of algorithm

    Correct Answer
    A. Counting the number of key operations
    Explanation
    The efficiency of an algorithm is determined by measuring the time factor, which is commonly done by counting the number of key operations. Key operations refer to the essential steps or operations performed by the algorithm that directly impact its execution time. By counting the number of key operations, we can get a rough estimate of the algorithm's efficiency and compare it with other algorithms.

    Rate this question:

  • 19. 

    The complexity of the average case of an algorithm is

    • Much more complicated to analyze than that of worst case

    • Much more simpler to analyze than that of worst case

    • Sometimes more complicated and some other times simpler than that of worst case

    • None or above

    Correct Answer
    A. Much more complicated to analyze than that of worst case
    Explanation
    The complexity of the average case of an algorithm is much more complicated to analyze than that of the worst case because the average case takes into account a wide range of inputs and their probabilities, making it more difficult to determine the exact time or space complexity. In contrast, the worst case analysis focuses on the input that would result in the maximum amount of time or space required, which is usually easier to identify and analyze. Therefore, analyzing the average case complexity requires more detailed calculations and considerations, making it more complex than analyzing the worst case complexity.

    Rate this question:

  • 20. 

    In linked lists there are no NULL links in

    • Single linked list

    • Linear doubly linked list

    • Circular linked list

    • None of these

    Correct Answer
    A. Circular linked list
    Explanation
    In a circular linked list, there are no NULL links because the last node in the list points back to the first node, creating a circular structure. This means that every node has a valid link to another node, and there are no NULL pointers. In contrast, both single linked lists and linear doubly linked lists have NULL links at the end of the list to indicate the end of the structure.

    Rate this question:

  • 21. 

    In a balance binary tree the height of two sub trees of every node can not differ by more than

    • 2

    • 1

    • 0

    • 3

    Correct Answer
    A. 1
    Explanation
    In a balanced binary tree, the height of two sub trees of every node cannot differ by more than 1. This means that the heights of the left and right sub trees of a node should differ by at most 1 level. This ensures that the tree remains balanced and allows for efficient searching and insertion operations. If the height difference is more than 1, the tree is considered unbalanced and may lead to performance issues. Therefore, the correct answer is 1.

    Rate this question:

  • 22. 

    Running time T(n), where 'n' is input size of recursive algorithm is given as follows:T(n) = c + T(n-1), if n>1,T(n) = d if n<1. The order of algorithm is

    • N2

    • N

    • N3

    • Nn

    Correct Answer
    A. N
    Explanation
    The given recursive algorithm has a running time equation T(n) = c + T(n-1), which means that the running time of the algorithm is constant (c) plus the running time of the algorithm with input size reduced by 1 (T(n-1)). This indicates that the algorithm has a linear time complexity, as it performs a constant amount of work for each input size. Therefore, the order of the algorithm is n.

    Rate this question:

  • 23. 

    The indirect change of the values of a variable in one module by another module is called

    • Internal change

    • Inter-module change

    • Side effect

    • Side-module update

    Correct Answer
    A. Side effect
    Explanation
    When the values of a variable in one module are changed indirectly by another module, it is referred to as a side effect. This term is commonly used in programming to describe the unintended consequences that can occur when one module modifies the state of another module. Side effects can sometimes lead to unexpected behavior and can make code harder to understand and maintain.

    Rate this question:

  • 24. 

    The result of evaluating prefix expression */b+0dacd, where a=3, b=6, c=1, d=5 is

    • 0

    • 5

    • 10

    • 15

    Correct Answer
    A. 10
    Explanation
    In the given prefix expression, the operator '*' multiplies the values of 'b' and the result of the next operation. The operator '+' adds the values of '0' and 'd'. The operator '/' divides the result of the previous operation by the value of 'a'. Finally, the operator '+' adds the result of the previous operation to the value of 'c'. Substituting the given values, the expression becomes (6 * (0 + 5) / 3) + 1 = 10. Therefore, the result of evaluating the prefix expression is 10.

    Rate this question:

  • 25. 

    Hash function f is defined as f(key) = key mod 7. If linear probing is used to insert the key 37, 38, 72, 48, 98, 11, 56 into a table indexed from 0 to 6,  11 will be stored at the location

    • 3

    • 4

    • 5

    • 6

    Correct Answer
    A. 5
    Explanation
    The hash function f(key) = key mod 7 maps each key to a value between 0 and 6. When linear probing is used, if a collision occurs, the next available slot is checked. In this case, the keys 37, 38, 72, 48, 98, 11, and 56 are being inserted. When the key 11 is inserted, it is hashed to the value 4. However, since that slot is already occupied by the key 48, linear probing is used to check the next slot, which is 5. Since slot 5 is available, the key 11 will be stored at location 5.

    Rate this question:

  • 26. 

    Number of possible ordered trees with 3 nodes A,B,C is

    • 16

    • 12

    • 6

    • 10

    Correct Answer
    A. 6
    Explanation
    The number of possible ordered trees with 3 nodes A, B, C can be calculated using the formula for the number of rooted trees. In this case, there are 3 nodes, so the formula is 3^(3-1) = 3^2 = 9. However, since the trees are ordered, we need to divide by the number of ways the nodes can be arranged, which is 3! (factorial). Therefore, the total number of possible ordered trees is 9 / 3! = 9 / 6 = 1.5. Since the number of trees must be a whole number, the correct answer is 6, which is the closest whole number to 1.5.

    Rate this question:

  • 27. 

    A hash tabale with 10 buckets with one slot per bucket is depicted in following diagram. Symbols S1 to S7 are initially entered using a hashing function with linear probing. Maximum number of comparisions needed in searching an item that is not present is 

    • 4

    • 5

    • 6

    • 3

    Correct Answer
    A. 5
  • 28. 

    Time complexity of an algorithm T(n), where n is the input size is given by T(n) = T (n-1) + 1/n, if n>1 otherwise T(n) = 1. The order of algorithm is

    • Log n

    • N

    • N2

    • Nn

    Correct Answer
    A. N2
    Explanation
    The given algorithm has a recurrence relation T(n) = T(n-1) + 1/n, which means that for each input size n, the algorithm calls itself with an input size of n-1 and performs an additional operation of 1/n. This indicates that the algorithm has a linear relationship with the input size.

    By solving the recurrence relation, we find that the time complexity of the algorithm is O(n^2). This means that the algorithm has a quadratic order, as the time taken by the algorithm grows quadratically with the input size.

    Rate this question:

  • 29. 

    If yyy, xxx and zzz are the elements of a binary binary tree, then in preorder traversal which node will be traverse first

    • Xxx

    • Yyy

    • Zzz

    • Can not be determined

    Correct Answer
    A. Yyy
    Explanation
    In a preorder traversal of a binary tree, the root node is always traversed first, followed by the left subtree and then the right subtree. Therefore, in the given options, "yyy" will be traversed first as it is mentioned before "xxx" and "zzz".

    Rate this question:

  • 30. 

    A queue has configuration a,b,c,d. To get configuration d,c,b,a. One needs a minimum of 

    • 2 deletion and 3 additions

    • 3 deletions and 2 additions

    • 3 deletions and 3 additions

    • 3 deletions and 4 additions

    Correct Answer
    A. 3 deletions and 3 additions
    Explanation
    To get from configuration a,b,c,d to configuration d,c,b,a, we need to move the elements in the queue in reverse order. This means we need to delete the elements in the original queue and add them to a new queue in the reverse order. Since there are 4 elements in the original queue, we need to perform 3 deletions (to remove a,b,c) and 3 additions (to add d,c,b) in order to achieve the desired configuration. Therefore, the correct answer is 3 deletions and 3 additions.

    Rate this question:

  • 31. 

    A binary tree in which every non-leaf node has non-empty left and right sub trees is called a strictly binary tree. Such a tree with 10 leaves

    • Has 19 nodes

    • Has 16 nodes

    • Has 15 nodes

    • None of the above

    Correct Answer
    A. Has 19 nodes
    Explanation
    A strictly binary tree is defined as a binary tree where every non-leaf node has both left and right sub trees. In this case, the tree has 10 leaves. Since each non-leaf node has two sub trees, there will be 9 non-leaf nodes in total (10 leaves - 1 root node). Therefore, the total number of nodes in the tree will be 10 leaves + 9 non-leaf nodes = 19 nodes.

    Rate this question:

  • 32. 

    If the out degree of every node is exactly equal to M or 0 and the num ber of nodes at level K is Mk-1 [con sider root at level 1], then tree is called as  (i) Full m-ary try(ii) Com plete m-ary tree(iii)Positional m-ary tree

    • Only (i)

    • Only (ii)

    • Both (i) and (ii)

    • Both (ii) and (III)

    Correct Answer
    A. Both (i) and (ii)
    Explanation
    A tree where the out degree of every node is exactly equal to M or 0 and the number of nodes at level K is Mk-1 is called a full m-ary tree. This is because in a full m-ary tree, each node has exactly M children or no children, and the number of nodes at each level follows the pattern of Mk-1. Additionally, this tree can also be called a complete m-ary tree because it satisfies the condition of a complete tree, where all levels except the last are completely filled and all nodes are as far left as possible. Therefore, the correct answer is both (i) and (ii).

    Rate this question:

  • 33. 

    To arrange a binary tree in ascending order we need 

    • Post order traversal

    • Inorder traversal

    • Preorder traversal

    • None of above

    Correct Answer
    A. Inorder traversal
    Explanation
    Inorder traversal is the correct answer because it visits the nodes of a binary tree in ascending order. In this traversal, the left subtree is visited first, then the root node, and finally the right subtree. By visiting the nodes in this order, we can arrange the elements of the binary tree in ascending order. Therefore, inorder traversal is the appropriate method to arrange a binary tree in ascending order.

    Rate this question:

  • 34. 

    Write the output of following program:int a[ ] = {1,2,3,} *p;

    • 3

    • Junk value

    • Run time error

    • Address of the third element

    Correct Answer
    A. Junk value
    Explanation
    The program is attempting to assign a value to a pointer variable without initializing it. As a result, the pointer variable will contain a random or junk value.

    Rate this question:

  • 35. 

    Consider two sorted lists of size L1, L2. Number of comparisions needed in worst case my merge sort algorithm will be

    • L1,L2

    • Max(L1,L2)

    • Min(L1,L2)

    • L1+L2-1

    Correct Answer
    A. L1+L2-1
    Explanation
    The merge sort algorithm works by recursively dividing the list into smaller sublists, sorting them, and then merging them back together. In the worst case scenario, the algorithm will need to compare every element in both lists before merging them. Since there are L1 elements in the first list and L2 elements in the second list, the total number of comparisons needed would be L1 + L2. However, we subtract 1 from the sum because the last element of the first list does not need to be compared with the first element of the second list during the merging process. Therefore, the correct answer is L1 + L2 - 1.

    Rate this question:

  • 36. 

    Average successful search time for sequential search on 'n' item is 

    • N/2

    • (n-1)/2

    • (n+1)/2

    • Log (n) + 1

    Correct Answer
    A. (n+1)/2
    Explanation
    The average successful search time for sequential search on 'n' items is (n+1)/2. This can be explained by considering that in a sequential search, the algorithm starts searching from the beginning of the list and continues until it finds the desired item. On average, the item being searched for is likely to be found in the middle of the list. Therefore, the time it takes to find the item can be approximated as (n+1)/2.

    Rate this question:

  • 37. 

    Four altorithm A1, A2, A3, A4 solves a problem with order log(n), log log(n), nlog(n), n. Which is best algorithm

    • A1

    • A2

    • A3

    • A4

    Correct Answer
    A. A1
    Explanation
    Algorithm A1 is the best algorithm because it has the lowest time complexity of O(log(n)). This means that as the input size increases, the time taken by A1 to solve the problem will increase at a much slower rate compared to the other algorithms. A2 has a time complexity of O(log log(n)), which is slightly worse than A1. A3 has a time complexity of O(n log(n)), which is worse than both A1 and A2. A4 has a time complexity of O(n), which is the worst among all the algorithms. Therefore, A1 is the most efficient algorithm for solving the given problem.

    Rate this question:

  • 38. 

    A sorting technique which guarrantees that records with same primary key occurs in the sorted list as in the original unsorted list is said to be

    • Stable

    • Consistent

    • External

    • Linear

    Correct Answer
    A. Stable
    Explanation
    A sorting technique is considered stable if it preserves the relative order of records with the same primary key in the sorted list as they were in the original unsorted list. This means that if two records have the same primary key, the one that appeared first in the unsorted list will also appear first in the sorted list.

    Rate this question:

  • 39. 

    Arranging a pack of cards by picking one by one is an example of

    • Bubble sort

    • Selection sort

    • Insertion sort

    • Merge sort

    Correct Answer
    A. Insertion sort
    Explanation
    Arranging a pack of cards by picking one by one is an example of insertion sort because in insertion sort, each element is compared to the elements on its left and inserted at the correct position, similar to how cards are picked and inserted into their correct positions in a pack. This process continues until all the cards are arranged in the correct order.

    Rate this question:

  • 40. 

    The total number of comparisons in a bubble sort is

    • O(n logn)

    • O(2n)

    • O(n2)

    • None of above

    Correct Answer
    A. O(n logn)
    Explanation
    The correct answer is O(n2). In a bubble sort, each element of the array is compared with its adjacent element and swapped if necessary. This process is repeated until the array is sorted. As there are n elements in the array and for each element, we need to compare it with n-1 other elements, the total number of comparisons in a bubble sort is n * (n-1), which simplifies to O(n2).

    Rate this question:

  • 41. 

    The average number of comparisions performed by merge sort alrotithm in merging two sorted list of length 2 is

    • 8/3

    • 8/5

    • 11/7

    • 11/6

    Correct Answer
    A. 8/3
    Explanation
    Merge sort algorithm divides the list into two halves until each sublist has only one element. Then it merges the sublists by comparing and sorting them. In this case, we have two sorted lists of length 2, which means each list has two elements. To merge these two lists, a total of 8 comparisons will be performed. Therefore, the average number of comparisons performed by the merge sort algorithm in merging two sorted lists of length 2 is 8/3.

    Rate this question:

  • 42. 

    In array representation of binary tree teh right child of root will be at location of

    • 2

    • 5

    • 3

    • 0

    Correct Answer
    A. 3
    Explanation
    In an array representation of a binary tree, the right child of the root will be at location 3. This is because the array starts indexing from 0, and the right child is typically located at 2 * index + 2. In this case, the root's index is 0, so the right child would be at 2 * 0 + 2, which is 2. Therefore, the correct answer is 3.

    Rate this question:

  • 43. 

    Depth of a binary tree with n node is

    • Log (n +1) - 1

    • Log (n)

    • Log (n -1)n -1

    • Log (n) + 1

    Correct Answer
    A. Log (n +1) - 1
    Explanation
    The correct answer is log (n +1) - 1. The depth of a binary tree is the maximum number of edges from the root to a leaf node. In a binary tree with n nodes, the maximum number of edges is n-1. Taking the logarithm of n+1 and subtracting 1 gives the depth of the tree.

    Rate this question:

  • 44. 

    An algorithm consists of two modules X1, X2. Their order is f(n) and g(n), respectively. The order of algorithm is

    • Max(f(n),g(n))

    • Min(f(n),g(n))

    • F(n)+g(n)

    • F(n)*g(n)

    Correct Answer
    A. Max(f(n),g(n))
    Explanation
    The order of an algorithm is determined by the module that takes the longest time to execute. In this case, the algorithm consists of two modules X1 and X2, with orders f(n) and g(n) respectively. The order of the algorithm will be the maximum of f(n) and g(n) because the module that takes the longest time will determine the overall time complexity of the algorithm. Therefore, the correct answer is Max(f(n),g(n)).

    Rate this question:

  • 45. 

    Number of swapping, operations need to sort numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order using bubble sort

    • 11

    • 12

    • 13

    • 14

    Correct Answer
    A. 13
    Explanation
    The given answer, 13, represents the number of swapping operations needed to sort the given numbers using bubble sort. Bubble sort works by repeatedly swapping adjacent elements if they are in the wrong order. In this case, there are a total of 8 numbers to sort. Therefore, the number of swapping operations required would be 8 - 1 = 7. However, since the question asks for the number of swapping operations needed to sort the numbers in ascending order, we need to add 6 more swapping operations to bring the largest number, 31, to its correct position. Hence, the total number of swapping operations needed is 7 + 6 = 13.

    Rate this question:

  • 46. 

    In which of the following cases linked list implementaion of sparse matrices consumes same memory as a normal array

    • 5 x 6 matrix with 9 non-zero entries

    • 5 x 6 matrix with 8 non-zero entries

    • 6 x 5 matrix with 8 non-zero entries

    • 6 x 5 matrix with 9 non-zero entries

    Correct Answer
    A. 6 x 5 matrix with 8 non-zero entries
    Explanation
    In a linked list implementation of a sparse matrix, memory consumption is reduced as it only stores the non-zero entries. The size of the matrix is determined by the number of rows and columns, and the size of each entry. In this case, a 6 x 5 matrix with 8 non-zero entries would consume the same memory as a normal array because both would require space for all 30 elements (6 rows x 5 columns) regardless of the number of non-zero entries.

    Rate this question:

  • 47. 

    The advantage of sparse matrix linked list representationn over dope vector method is, that the former is

    • Conceptually easier

    • Completely dynamic

    • Efficient in accessing an entry

    • Efficient if the sparse matr4ix is a band matrix

    Correct Answer
    A. Completely dynamic
    Explanation
    The advantage of sparse matrix linked list representation over the dope vector method is that it is completely dynamic. This means that the linked list representation can handle matrices of any size and shape, while the dope vector method requires pre-allocation of memory for all possible matrix elements, even if they are not used. The linked list representation only stores the non-zero elements of the matrix, resulting in more efficient memory usage. Additionally, the linked list representation allows for efficient insertion and deletion of elements, making it a flexible and dynamic approach for representing sparse matrices.

    Rate this question:

  • 48. 

    In a stack the command to access nth element from the top of the stack S will be

    • S [Top-n]

    • S [Top+n]

    • S [Top-n-1]

    • None of the above

    Correct Answer
    A. S [Top-n]
    Explanation
    To access the nth element from the top of the stack, the correct command is S [Top-n]. This command indicates that we start from the top of the stack (Top) and move n positions downwards to access the desired element. The other options are incorrect because they either indicate moving upwards or do not account for the correct number of positions to move.

    Rate this question:

  • 49. 

    IThe dummy header in linked list contain

    • First record of the actual data

    • Last record of the actual data

    • Pointer to the last record of the actual data

    • None of above

    Correct Answer
    A. First record of the actual data
    Explanation
    The dummy header in a linked list contains the first record of the actual data. This dummy header is used to simplify operations on the linked list by providing a consistent starting point. It allows for easier insertion and deletion of nodes without having to handle special cases for an empty list. By pointing to the first record of the actual data, the dummy header ensures that the list always has a valid starting point for traversal and manipulation.

    Rate this question:

Quiz Review Timeline (Updated): Apr 16, 2024 +

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

  • Current Version
  • Apr 16, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 21, 2014
    Quiz Created by
    Maheshjangid
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.