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 security
  1. 5

  2. 2

  3. 9

  4. 13

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

DES (Data Encryption Standard) has two primary versions: the original DES and Triple DES (3DES). Triple DES was developed to address DES's vulnerability by applying the cipher three times with different keys, effectively strengthening the encryption.

Multiple choice technology programming languages
  1. a. arr.length

  2. b. arr.length - 1

  3. c. arr.size

  4. d. arr.size - 1

  5. e. arr.length()

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

In Java, 'length' is a public final field of an array object that stores the number of elements. Unlike Strings (which use length()) or Collections (which use size()), arrays use the '.length' property.

Multiple choice technology programming languages
  1. Sorter

  2. Connected Lookup

  3. Expression

  4. Unconnected Lookup

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

Active transformations change the number of rows passing through them. The Sorter transformation is active because it changes the row order. In contrast, Expression transformations are passive (same number of input and output rows), and Lookup transformations can be active or passive depending on whether they're connected or unconnected.

Multiple choice technology web technology
  1. Pipeline parallelism

  2. Costly in terms of space and time

  3. Removes duplicates on the key specified

  4. None of the above

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

Sorting is a resource-intensive operation in data processing (such as Ab Initio). It is costly in terms of temporary disk space and CPU time because it requires comparing and reorganizing all records.

Multiple choice technology databases
  1. B-tree index used for table having completely unique colum

  2. REVERSE key index used for oracle parallel serve

  3. BIT MAP index is used for low cardinality

  4. None of these

Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

B-tree indexes are ideal for unique columns, reverse key indexes are designed to avoid contention in Oracle Parallel Server (RAC) environments, and bitmap indexes are highly efficient for columns with low cardinality.

Multiple choice technology programming languages
  1. multidimensional arrays are allowed. The maximum number of dimensions is 15.

  2. the elements in an array can only be of the numeric datatype

  3. a reference towards an element in an array is done by means of a subscript. The first occurrence of an element in an array has subscript 0.

  4. arrays are used to read in DB2 tables

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

PL I permits arrays with up to 15 dimensions and elements can be any data type not just numeric. Array subscripts start at 1 by default, not 0, and arrays are memory structures not directly tied to DB2.

Multiple choice technology mainframe
  1. Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array.

  2. An index can only be modified using PERFORM, SEARCH & SET.

  3. Need to have index for a table in order to use SEARCH, SEARCH ALL.

  4. None of the above

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

Statement A correctly distinguishes subscript (array occurrence number) from index (byte displacement). Statement B is true - index manipulation requires PERFORM VARYING, SEARCH, or SET statements. Statement C is true - SEARCH/SEARCH ALL require an indexed table. Since A, B, C are all true, 'None of the above' (D) is the correct false statement.

Multiple choice technology programming languages
  1. LinkedHashMap

  2. LinkedHashSet

  3. TreeSet

  4. HashMap

  5. HashSet

  6. Hashtable

Reveal answer Fill a bubble to check yourself
A,D,F Correct answer
Explanation

The question asks for classes that store key/value pairs, replace old entries on duplicates, and offer constant-time performance. LinkedHashMap, HashMap, and Hashtable implement the Map interface (storing key/value pairs) and provide constant-time performance. LinkedHashSet, TreeSet, and HashSet are Set implementations, not Maps.

Multiple choice technology programming languages
  1. ArrayList

  2. LinkedHashMap

  3. LinkedHashSet

  4. LinkedList

  5. TreeMap

  6. Vector

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

A FIFO queue requires efficient add-at-end and remove-from-front operations. LinkedList provides O(1) for both operations. ArrayList requires O(n) for front removal. LinkedHashMap/LinkedHashSet/TreeMap don't provide queue semantics. Vector has same issues as ArrayList. Option D (LinkedList) is optimal.

Multiple choice technology web technology
  1. AVG

  2. COUNT

  3. MAX

  4. STDDEV

  5. LENGTH

  6. All the above.

Reveal answer Fill a bubble to check yourself
A,B,C,D Correct answer
Explanation

SQL GROUP functions (also called aggregate functions) perform calculations on sets of rows and return a single result. AVG, COUNT, MAX, and STDDEV are all GROUP functions that compute statistics across multiple rows. LENGTH, however, is a single-row function that operates on individual string values, not groups. The option 'All the above' is incorrect because it includes LENGTH which doesn't belong to GROUP functions.

Multiple choice technology
  1. Merge sort

  2. Heap sort

  3. Counting sort

  4. Bubble sort

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

With infinite memory, Counting sort achieves O(n + k) time complexity where k is the range of values. Since we have infinite memory and are sorting natural numbers, Counting sort is optimal. Comparison sorts like Merge sort and Heap sort are O(n log n), while Bubble sort is O(n^2).

Multiple choice technology
  1. n^2

  2. n

  3. logn

  4. nlogn

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

Merge sort consistently performs at O(n log n) time complexity across all cases - best, average, and worst. This is because it always divides the array in half (log n levels) and merges n elements at each level. The n log n complexity is its fundamental characteristic.