Algorithms and Data Structures

Covers algorithm complexity analysis, sorting and searching algorithms, arrays, linked lists, and fundamental data structure operations

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Benefits of the observer pattern include:

  1. Creates an abstract coupling between the subject and the observer
  2. Allows the subject and observer to belong to different layers of abstraction
  3. Supports notifications in the form of broadcasts
  4. All of the above
Question 2 Multiple Choice (Single Answer)

Key Concept for applying the Strategy Pattern:

  1. At any given time only one algorithm is instantiated and active
  2. The Strategy pattern encapsulates related classes that have different functionalities
  3. The name of the message to the strategy object and the context object must be the same
  4. None of the above
Question 3 Multiple Choice (Single Answer)

The complexity of Binary search algorithm is

  1. O(n)
  2. O(log n)
  3. O(n2)
  4. O(n log n)
Question 4 Multiple Choice (Single Answer)

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

  1. internal change
  2. inter-module change
  3. side effect
  4. side-module update
Question 5 Multiple Choice (Single Answer)

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

  1. Arrays
  2. Linked lists
  3. Both of above
  4. None of above
Question 6 Multiple Choice (Single Answer)

Which of the following data structure is linear data structure?

  1. Trees
  2. Graphs
  3. Arrays
  4. None of above
Question 7 Multiple Choice (Single Answer)

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

  1. Sorting
  2. Merging
  3. Inserting
  4. Traversal
Question 8 Multiple Choice (Single Answer)

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

  1. Traversal
  2. Search
  3. Sort
  4. None of above
Question 9 Multiple Choice (Single Answer)

Arrays are best data structures

  1. for relatively permanent collections of data
  2. for the size of the structure and the data in the structure are constantly changing
  3. for both of above situation
  4. for none of above situation
Question 10 Multiple Choice (Single Answer)

Linked lists are best suited

  1. for relatively permanent collections of data
  2. for the size of the structure and the data in the structure are constantly changing
  3. for both of above situation
  4. for none of above situation
Question 11 Multiple Choice (Single Answer)

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

  1. the name of array
  2. the data type of array
  3. the first data from the set to be stored
  4. the index set of the array
Question 12 Multiple Choice (Single Answer)

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

  1. by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
  2. the architecture of computer memory does not allow arrays to store other than serially
  3. both of above
  4. none of above
Question 13 Multiple Choice (Single Answer)

Two main measures for the efficiency of an algorithm are

  1. Processor and memory
  2. Complexity and capacity
  3. Time and space
  4. Data and space
Question 14 Multiple Choice (Single Answer)

Which of the following case does not exist in complexity theory

  1. Best case
  2. Worst case
  3. Average case
  4. Null case
Question 15 Multiple Choice (Single Answer)

The Average case occur in linear search algorithm

  1. When Item is somewhere in the middle of the array
  2. When Item is not in the array at all
  3. When Item is the last element in the array
  4. When Item is the last element in the array or is not there at all
Question 16 Multiple Choice (Single Answer)

The complexity of the average case of an algorithm is

  1. Much more complicated to analyze than that of worst case
  2. Much more simpler to analyze than that of worst case
  3. Sometimes more complicated and some other times simpler than that of worst case
  4. None or above
Question 17 Multiple Choice (Single Answer)

The Worst case occur in linear search algorithm when

  1. Item is somewhere in the middle of the array
  2. Item is not in the array at all
  3. Item is the last element in the array
  4. Item is the last element in the array or is not there at all
Question 18 Multiple Choice (Single Answer)

The complexity of linear search algorithm is

  1. O(n)
  2. O(log n)
  3. O(n2)
  4. O(n log n)
Question 19 Multiple Choice (Single Answer)

The complexity of Bubble sort algorithm is

  1. O(n)
  2. O(log n)
  3. O(n2)
  4. O(n log n)