Computer Knowledge

Data Structures and Algorithms

1,518 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. Stack

  2. Array

  3. Queue

  4. Linked List

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

A buffer operates as a Queue (FIFO - First In First Out) data structure. Items are added to the end and removed from the front, which matches the fundamental behavior of buffers in computer systems.

Multiple choice technology programming languages
  1. True

  2. False

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

For binary search methods (like Arrays.binarySearch or Collections.binarySearch) to work correctly, the array or collection must be sorted in the same natural order that the search expects. If the sort order differs from the search order, results are unpredictable. Therefore, the sort and search order MUST be the same.

Multiple choice technology programming languages
  1. Array

  2. Vector

  3. List

  4. Pointers

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

Arrays offer direct, contiguous memory allocation and index-based access without the overhead of synchronization (like Vector) or node traversal (like List), making basic operations faster.

Multiple choice technology programming languages
  1. a

  2. b

  3. same

  4. can't say

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

The countdown loop (a) is marginally faster because comparing to zero is more efficient than comparing to 100001 on most processor architectures. However, this difference is negligible in modern JVMs with optimization. The question tests knowledge of low-level loop optimization.

Multiple choice technology databases
  1. Only nested tables need initilization.

  2. Index-by tables is a persistent collection

  3. nested tables are known as associative arrays.

  4. VARRAYs hold fixed number of elements

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

In PL/SQL, VARRAYs (variable-size arrays) are defined with a maximum limit and hold a fixed maximum number of elements. Associative arrays are known as index-by tables, and nested tables do not persist in database columns without a storage table.

Multiple choice technology
  1. Collection of SAS files,such as SAS data sets and catalogs

  2. In some OS, a physical collection of SAS files

  3. In some OS, a logically related collection of SAS files

  4. All of above

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

A SAS Data Library is a collection of SAS files that can include both SAS data sets and catalogs. Depending on the operating system, this can be a physical directory (like in Unix/Linux/Windows) or a logically related collection (like in mainframe environments). The library serves as a container that groups related SAS files together and is referenced through a libref (library reference). Options A, B, and C each describe partial truths, while D captures all aspects across different operating environments.

Multiple choice technology operating systems
  1. True

  2. False

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

Indexing is primarily used to speed up data retrieval, not sorting. While indexes store data in sorted order (B-tree, etc.), their purpose is fast lookups via search keys, not data organization for sorting operations.

Multiple choice technology web technology
  1. Using lookup() function

  2. Using Generate Records component

  3. Using re_index() function

  4. Using next_in_sequence() function

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

In Ab Initio, the next_in_sequence() function is standardly used to generate unique, sequential integer values, which serve as surrogate keys during data transformation.

Multiple choice technology mainframe
  1. DATASORT

  2. SUBSET

  3. both a and b

  4. None of the above

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

DATASORT statement is used to sort data within a file between headers and trailers in mainframe/legacy systems like Easytrieve. This statement specifically handles sorting of data records while preserving the header and trailer records. SUBSET is used for record selection/filtering, not sorting.

Multiple choice technology mainframe
  1. INCLUDE COND = (10,3,CH,EQ,C'YES') SORT FIELDS = (1,5,CH,A)

  2. SORT FIELDS = (1,5,CH,A) INCLUDE COND = (10,3,CH,EQ,C'YES')

  3. Order doesn't matter

  4. INCLUDE COND = (10,3,CH,EQ,C'YES') SORT FIELDS = COPY

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

Filtering records with INCLUDE COND before sorting them with SORT FIELDS is much more efficient because it reduces the volume of data that the sort engine needs to process and order in memory.

Multiple choice technology web technology
  1. All the rows from master and detail table

  2. Matching rows from detail table and all rows from master table

  3. Matching rows from master table and all rows from detail table

  4. Only matching from master and detail table

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

Detail Outer Join returns all rows from the master table plus matching rows from the detail table. If no match exists in detail, NULLs are returned for detail columns. Master is the driving table in Joiner transformations - this is the table with fewer rows for optimal performance.