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 architecture
  1. Deque

  2. Priority

  3. Tree

  4. All of above

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

Trees are the standard data structure for representing hierarchical relationships because each node can have multiple children, forming a parent-child hierarchy. Deques (double-ended queues) are linear structures for adding/removing from both ends, not hierarchies. Priority queues are for ordered access by priority, not hierarchy. Option C is correct.

Multiple choice technology architecture
  1. Complete binary tree

  2. Binary search tree

  3. Extended binary tree

  4. None of above

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

An extended binary tree (also called a full binary tree or proper binary tree) is defined as a binary tree where every node has either 0 or 2 children - never just 1 child. A complete binary tree fills all levels except possibly the last, which must be left-filled. A binary search tree is ordered by key values, not by child count. Option C is correct.

Multiple choice technology mainframe
  1. a) INDEXED

  2. b) NUMBERED

  3. c) LINEAR

  4. d) NONINDEXED

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

KSDS (Key Sequenced Data Set) organizes data using an INDEXED structure. Records are stored and accessed based on their key values, which are maintained in a separate index component. This indexed organization enables efficient direct access by key. Option A is correct.

Multiple choice technology architecture
  1. elementary items

  2. atoms

  3. scalars

  4. all of above

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

Indecomposable items in a record that cannot be broken down further are called elementary items, atoms, or scalars - all three terms refer to the same concept of primitive data types that contain a single value. Therefore 'all of the above' is correct.

Multiple choice technology architecture
  1. linear arrays

  2. linked lists

  3. both of above

  4. none of above

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

Linear arrays are indexed structures because they allow direct access to any element using its index in constant time O(1). The index is used to calculate the memory address directly. Linked lists are sequential structures that require traversal from the head to access a specific element, making them non-indexed.

Multiple choice technology architecture
  1. The list must be sorted

  2. there should be the direct access to the middle element in any sublist

  3. There must be mechanism to delete and/or insert elements in list

  4. none of above

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

Binary search requires the search space/list to be sorted and allows random access to the middle element to achieve logarithmic time complexity. It does not require a mechanism to insert or delete elements; in fact, binary search is often performed on static arrays.

Multiple choice technology architecture
  1. must use a sorted array

  2. requirement of sorted array is expensive when a lot of insertion and deletions are needed

  3. there must be a mechanism to access middle element directly

  4. binary search algorithm is not efficient when the data elements are more than 1000.

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

Binary search has O(log n) time complexity, which remains efficient even for large datasets. The efficiency depends on the logarithmic growth rate, not on a fixed number like 1000. Options A, B, and C are actual limitations: binary search requires sorted data and direct access to the middle element, which can be expensive to maintain with frequent insertions/deletions.

Multiple choice technology architecture
  1. tables arrays

  2. matrix arrays

  3. both of above

  4. none of above

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

Two-dimensional arrays are commonly referred to as both tables (for tabular data representation) and matrices (especially in mathematical contexts involving rows and columns). Both terms describe the same conceptual structure of data arranged in a grid format with rows and columns.

Multiple choice technology architecture
  1. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array

  2. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the array

  3. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the array

  4. None of above

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

The address of any array element is calculated as: Base Address + (Index - Lower Bound) × Word Size. For the 5th element, this is LOC(Array[5]) = Base(Array) + w(5 - lower bound), where w represents bytes per memory cell. Options B and C are incorrect because they omit the word size multiplier or use wrong bounds.

Multiple choice technology architecture
  1. Linked lists

  2. Stacks

  3. Queues

  4. Deque

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

A deque (double-ended queue) specifically allows insertion and deletion at both ends. Stacks only allow operations at one end (LIFO), queues restrict insertion to rear and deletion to front (FIFO), and linked lists allow insertion/deletion anywhere but not with the same efficiency at both ends as a deque.

Multiple choice technology architecture
  1. FAEKCDBHG

  2. FAEKCDHGB

  3. EAFKHDCBG

  4. FEAKDCHBG

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

The inorder sequence E A C K F H D B G and preorder F A E K C D H G B correspond to a specific binary tree structure. Preorder traversal always visits root first, then left subtree, then right subtree. Option B is the correct preorder for this tree configuration.

Multiple choice technology architecture
  1. grounded header list

  2. circular header list

  3. linked list with header and trailer nodes

  4. none of above

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

A two-way list (doubly linked list) has nodes with pointers to both next and previous nodes. None of the given options (grounded header list, circular header list, linked list with header and trailer) specifically describe a doubly linked list. These are variations of singly linked lists or specific implementations, not two-way lists.

Multiple choice technology architecture
  1. An array is suitable for homogeneous data but hte data items in a record may have different data type

  2. In a record, there may not be a natural ordering in opposed to linear array.

  3. A record form a hierarchical structure but a lienear array does not

  4. All of above

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

Arrays store homogeneous elements (same type) with natural ordering by index. Records can store heterogeneous elements (different types) without requiring a natural ordering among fields. Records can form hierarchical structures through nested records, unlike simple linear arrays. All three statements correctly distinguish arrays from records.