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. splice (@array, 0, 1);

  2. splice (@array, @array-1, 1);

  3. splice (@array, scalar(@array), 0, @sublist);

  4. splice (@array, 0, 0, @sublist);

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

push appends @sublist to the end of @array. splice(@array, scalar(@array), 0, @sublist) inserts @sublist at position equal to the array's length (the end), without removing any elements (0 elements removed).

Multiple choice technology databases
  1. BALANCED TREE

  2. BITMAP

  3. FUNCTIONAL

  4. BINARY TREE

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

Oracle's default and most common indexing system is B-Tree (Balanced Tree) indexing. Bitmap indexing is an optional feature in Oracle used for low-cardinality columns, not the default. Functional indexing exists but is not a separate indexing system - it's just indexing on function results. Binary tree is not a standard Oracle indexing term.

Multiple choice technology testing
  1. length(array)

  2. unbound(array)

  3. ubound(array)

  4. count(array)

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

In VBScript (used by QTP), UBound(array) returns the highest index of an array, which equals length minus one for zero-based arrays. LBound returns the lowest index, typically zero.

Multiple choice technology databases
  1. One or Two AMP operation depends on the base row location

  2. Always two AMP operation irrespective of the base row location

  3. Many AMP operation

  4. All AMP operation

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

A Unique Secondary Index typically involves a two-AMP operation: one AMP to access the index subtable (which contains the PI value), then a second AMP to retrieve the base row using that PI value. However, if the index row and base row happen to reside on the same AMP, it becomes a single-AMP operation. The exact number depends on row location.

Multiple choice technology
  1. Algorithm

  2. Logarithm

  3. Boolean Algebra

  4. Syntax

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

An Algorithm is a step-by-step sequential process that a computer follows to perform computations or solve problems. Logarithm is a mathematical function, Boolean Algebra deals with logical operations, and Syntax refers to language structure rules. Only Algorithm correctly describes a computational procedure.

Multiple choice technology programming languages
  1. Collections.reverseSort(list, new MyComparator());

  2. Collections.sort(list, new MyComparator());

  3. Collections.sort(list, new InverseComparator(

  4. Collections.sort(list, Collections.reverseOrder(

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

Collections.reverseOrder() accepts a Comparator and returns a new Comparator that imposes the reverse ordering. When passed to Collections.sort(), it sorts the list in the opposite order of the original comparator. This is the standard way to reverse sort order in Java.

Multiple choice technology programming languages
  1. <>

  2. >

  3. <=>

  4. cmp

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

The <=> operator (spaceship operator) is Perl's numeric comparison operator, returning -1, 0, or 1. It's the standard way to sort numerically: sort { $a <=> $b } @array. The cmp operator is for string comparison, while < and > are simple comparison operators not typically used directly in sort.

Multiple choice technology programming languages
  1. unshift

  2. delete

  3. shift

  4. move

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

The shift function removes and returns the first element of an array, shortening the array by one. It's commonly used to process array elements sequentially. unshift adds to the beginning, delete removes hash elements, and move is not a built-in Perl function.

Multiple choice technology programming languages
  1. work on first eleemnt of array

  2. work on last element of array

  3. works on all elements of array

  4. wont work on array

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

When chomp is used on an array (@array), it operates on ALL elements, removing trailing newlines from each one. It doesn't just work on first or last element. This is a useful feature for cleaning up multiple lines at once. The option 'wont work on array' is incorrect.

Multiple choice technology mainframe
  1. INDEXED STANDARD ACCESS METHOD

  2. INTERNAL SEQUENCE ACCESS METHOD

  3. INDEXED SEQUENTIAL ACCESS METHOD

  4. INDEXED SEQUENCE ACCESS METHOD

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

ISAM stands for Indexed Sequential Access Method, which is a file organization method that allows both sequential and direct access to records using an index structure.