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
  1. Inmemory scan

  2. Sort and dedup

  3. Rollup

  4. All of the above

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

In-memory deduplication uses a hash set to track seen records, operating in O(n) time with a single pass. Sort-based dedup requires O(n log n) for sorting plus a pass to remove duplicates. Rollup performs aggregation, not duplicate removal. With sufficient memory, in-memory is fastest.

Multiple choice technology programming languages
  1. Binary Tree

  2. Hash Table

  3. Stack

  4. Queue

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

Hash tables provide the fastest average-case data retrieval at O(1) time complexity, assuming a good hash function and minimal collisions. Binary trees are O(log n), while stacks and queues are O(n) for searching since you must traverse elements sequentially.

Multiple choice technology programming languages
  1. Bubble Sort

  2. Quick Sort

  3. Merge Sort

  4. Radix Sort

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

For the nearly-sorted array [1,2,3,5,4], Bubble Sort only needs one pass to swap 5 and 4, completing in O(n) time. More complex sorts like Quick Sort have overhead that makes them slower for small, nearly-sorted datasets. This illustrates that 'fastest' depends on initial data state.

Multiple choice technology web technology
  1. True

  2. False

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

Java arrays are strongly typed - they can only store elements of one declared type. A primitive array like int[] can hold only integers, while an Object[] can hold different types but only those within the same inheritance hierarchy. An array cannot store arbitrary different types like an integer, a string, and a boolean together.

Multiple choice technology databases
  1. Intermediate level

  2. Header level

  3. Data level

  4. Binary level

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

SQL Server indexes use a B-tree structure with multiple levels: the root level at the top, intermediate levels that branch between root and leaves, and the leaf level containing actual data or data pointers. 'Intermediate level' is the correct structural term for non-leaf levels between root and leaf.

Multiple choice technology operating systems
  1. Reference on Stack

  2. Reference on Heap

  3. Reference on Stack and the Data it points to on Heap

  4. None of the Above

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

For reference types in C#, the reference variable itself is stored on the stack (holding the memory address), whereas the actual object instance and its data are allocated on the garbage-collected heap.

Multiple choice technology programming languages
  1. BITMAP

  2. B-TREE

  3. FUNCTION BASED

  4. None

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

B-TREE is the default index type in Oracle and most relational databases. When you create an index without specifying the type, B-TREE is used. Bitmap indexes and function-based indexes require explicit specification.

Multiple choice technology databases
  1. Color

  2. example

  3. No base type

  4. Both (A) and (B)

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

In the array declaration Color[] example = new Color[20], Color is the base type (component type) of the array. The variable name is example, but the array's base type - the type of elements it stores - is Color. Every array in Java has a base type that specifies what kind of objects it can hold.

Multiple choice technology databases
  1. OrderedDictionary class

  2. ListDictionary class

  3. HybridDictionary class

  4. Hashtable class

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

The HybridDictionary class is optimized for both small and large collections by starting as a lightweight ListDictionary when the collection has few items, and automatically switching to a Hashtable as the collection grows. ListDictionary is only fast for small lists, while Hashtable has higher overhead.

Multiple choice technology programming languages
  1. Using Redim Keyword

  2. Using Preserve Keyword

  3. Using Reserve Keyword

  4. None of the above

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

The Preserve keyword in VB.NET is used with ReDim to resize an array while retaining existing values. Without Preserve, ReDim would create a new array and lose all existing data. Options A and C are not valid keywords for this purpose.

Multiple choice technology programming languages
  1. Using Redim Keyword

  2. Using Preserve Keyword

  3. Using Reserve Keyword

  4. None of the above

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

The Preserve keyword in VB.NET is used with ReDim to resize an array while retaining existing values. Without Preserve, ReDim would create a new array and lose all existing data. Options A and C are not valid keywords for this purpose.

Multiple choice technology
  1. a. duplicate rows are sorted based on the case.

  2. b. You can configure the Sorter transformation to treat output rows as distinct.

  3. c. The Integration Service rejects duplicate rows compared during the sort operation.

  4. d.none of the above

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

The Sorter transformation can be configured with the 'Distinct' output option to treat output rows as distinct, removing duplicates during the sort operation. When enabled, the Sorter uses the sort key columns to identify and eliminate duplicate rows, passing only unique rows to downstream transformations. This is more efficient than using an Aggregator or Expression transformation after sorting to remove duplicates. The other options are incorrect: duplicates are not rejected, they can be eliminated; there's no case-based duplicate sorting behavior.

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

  2. By calling SortReverse()

  3. By calling Descend()

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

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

Standard arrays in languages like C# or JavaScript do not have direct methods like ReverseSort or Descend. Sorting in descending order is typically accomplished by sorting in ascending order first and then reversing the array.