Computer Knowledge

Data Structures and Algorithms

1,256 Questions

Data Structures and Algorithms form the core of computer science, focusing on arrays, linked lists, trees, and sorting mechanisms. These concepts are essential for solving complex computational problems efficiently. Test takers preparing for technical and administrative IT exams will find these questions highly relevant.

Array OperationsLinked List ApplicationsSorting AlgorithmsTree Data StructuresMultilevel IndexingAlgorithm Time Complexity

Data Structures and Algorithms Questions

Multiple choice technology programming languages
  1. By calling ReverseSort()

  2. By calling SortReverse()

  3. By calling Descend()

  4. By calling Sort() and then Reverse() method

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To sort an array in descending order in C#, you first call Sort() to arrange elements in ascending order, then call Reverse() to invert the sequence. There is no built-in ReverseSort() or SortReverse() method in the Array class, and Descend() is not a standard array method.

Multiple choice technology programming languages
  1. By calling ReverseSort()

  2. By calling SortReverse()

  3. By calling Descend()

  4. By calling Sort() and then Reverse() method

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To sort an array in descending order, you typically first sort the array in ascending order using Sort(), then reverse the sorted array using Reverse(). While some languages may have dedicated methods, this two-step approach is common and reliable.

Multiple choice technology programming languages
  1. Table

  2. Array of Arrays

  3. list of arrays

  4. both a and b

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A two-dimensional array can be conceptualized in multiple equivalent ways: as a Table (with rows and columns), as an Array of Arrays (where each element is itself an array), or as a list of arrays. All three perspectives are valid and useful in different contexts - the table view is intuitive for data representation, while the array-of-arrays view reflects the underlying memory structure. Since both 'Table' and 'Array of Arrays' are correct interpretations, option D ('both a and b') is the right choice.

Multiple choice technology databases
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Bitmap indexes are best for columns with LOW cardinality (few distinct values like gender, status, or boolean flags). They use bitmaps to represent which rows have each value. High cardinality columns (many distinct values) are better served by B-tree indexes, which would be more efficient for that data distribution.

Multiple choice technology databases
  1. HASH

  2. MODULUS

  3. RANGE

  4. RANDOM

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Interval partitioning is an extension of range partitioning where Oracle automatically creates new partitions at specified intervals when data exceeds existing ranges. It inherits the range-based concept of partitioning data along a continuous spectrum (dates or numbers) but automates the partition boundary creation.

Multiple choice technology programming languages
  1. sort @a

  2. sort {$1 <=> $2} @a
  3. sort {$a <=> $b} @a
  4. sort {$_[0] <=> $_[1]} @a
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Perl uses the spaceship operator &lt;=&gt; inside a block to perform numerical comparisons for sorting, using the special package variables $a and $b. The default sort function performs ASCII-alphabetical sorting, while using $1 and $2 or $_[0] and $_[1] inside the sort block is syntactically incorrect.

Multiple choice technology programming languages
  1. set

  2. ConcurrentSkipListSet

  3. Hashmap

  4. Queue

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SortedSet is an interface in Java. ConcurrentSkipListSet is a concrete class that implements the SortedSet interface, providing a thread-safe sorted set implementation based on a skip list data structure. HashMap and Queue are unrelated to SortedSet implementation.

Multiple choice technology databases
  1. bitmap indexes

  2. b*-tree indexes

  3. composite unique index

  4. cluster index

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Bitmap indexes are ideal for columns with low cardinality (non-unique values) because they store bitmaps efficiently for repetitive values. B-tree indexes work better for unique or high-cardinality columns. A composite unique index would require unique values, and cluster index is not the standard term for non-unique column indexing.

Multiple choice technology databases
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Similar to the previous question, there is no fixed rule that 50000-250000 leaf blocks automatically equals degree 16 parallelism. The degree of parallelism is calculated by the optimizer based on multiple factors including system resources, operation cost, and initialization parameters, not just block count ranges.

Multiple choice technology programming languages
  1. O(n2)

  2. O(log n)

  3. O(nlogn)

  4. O(n2 logn)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The average-case time complexity of Quick Sort is O(n log n), which occurs when the pivot consistently divides the array into reasonably balanced partitions. Distractors like O(n^2) represent the worst-case complexity, while O(log n) is too low and O(n^2 log n) is inefficient.

Multiple choice technology programming languages
  1. O(n)

  2. O(log n)

  3. O(n^2)

  4. O(n log n)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Bubble Sort has a time complexity of O(n^2) in both average and worst cases because it uses nested loops - each element may need to be compared with every other element. In the best case (already sorted), it can be O(n) with optimization, but its standard complexity is quadratic. Option A is for linear algorithms, B for logarithmic, and D for efficient sorts like merge sort.