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
-
$index
-
$iteration
-
$count
-
$ListCount
B
Correct answer
Explanation
In webMethods Developer, when iterating through a list using a LOOP construct, the built-in variable that provides the current iteration index is $iteration. This variable automatically tracks the current position in the loop, starting from 0 or 1 depending on configuration. The other options ($index, $count, $ListCount) are not the standard loop index variables in webMethods.
-
distributes a row to single output and another to the other output
-
distributes its input to one or more outputs
-
join two inputs
-
extract data from a connection
B
Correct answer
Explanation
Multicast Transformation in SSIS takes a single input row and distributes it to multiple outputs simultaneously. Each output receives a copy of the same row, enabling parallel processing paths.
-
Serial Search on sorted table
-
Binary Search on sorted table
-
Serial Search on Non sorted table
-
Binary Search on Non sorted table
B
Correct answer
Explanation
SEARCH ALL in COBOL implements binary search, which requires the table to be sorted. Binary search repeatedly divides the search interval in half, making it much faster than serial search (option C), but only works on sorted data. Regular SEARCH uses serial search.
-
Removing the duplicates for the records which statisfies the where clause
-
rows are only output down the link of the first Where clause they satisfy
-
rows output down the links of all Where clauses that they satisfy.
-
None of the above
B
Correct answer
Explanation
The Output rows only once option ensures each row goes down only the first matching output link. Once a row satisfies a where clause, it's output and doesn't evaluate subsequent clauses. This prevents duplicate routing when rows match multiple filter conditions.
-
SEARCH - is a binarysearch. : SEARCH ALL - is serial search & the table must be sorted
-
SEARCH - is a serial search : SEARCH ALL - is binary search & the table must be sorted
-
Both are binary search
-
SEARCH - is a binarysearch & the table is unsorted : SEARCH ALL - is serial search
B
Correct answer
Explanation
SEARCH is a serial (linear) search that examines table elements sequentially. SEARCH ALL implements a binary search algorithm, which requires the table to be sorted in ascending or descending order. Binary search is much faster for large tables but has the sorting prerequisite.
-
HashSet
-
Hashmap
-
Map
-
TreeMap
D
Correct answer
Explanation
TreeMap stores its elements in a red-black tree, which automatically keeps the keys sorted according to their natural ordering or a custom comparator. HashMap and HashSet use hashing and do not guarantee order, while Map is an interface that cannot be instantiated directly.
D
Correct answer
Explanation
In PowerCenter Update Strategy, DD_INSERT has the numeric value 4. Other constants include DD_UPDATE (1), DD_DELETE (2), and DD_REJECT (3). The value 4 is used when flagging rows for insertion.
B
Correct answer
Explanation
In DataStage, when a sequential file stage encounters a null value and the NullFieldValue property is not assigned, the row gets rejected. If no reject link is attached to handle rejected rows, the job aborts with a fatal error. This behavior ensures data quality by stopping execution rather than writing incomplete or inconsistent data.
B
Correct answer
Explanation
Oracle UNION and DataStage Merge serve different purposes. UNION combines result sets vertically by stacking rows, removing duplicates by default. DataStage Merge combines data horizontally based on key columns, acting more like a SQL JOIN. They are fundamentally different operations.
-
HashSet
-
Hashmap
-
Map
-
TreeMap
D
Correct answer
Explanation
TreeMap implements the SortedMap interface and uses a red-black tree structure to store key-value pairs in sorted order. HashMap uses hashing (no sorting), HashSet is for unique elements (not key-value pairs), and Map is an interface.
-
n
-
n squared
-
n log(n)
-
e raised to n
C
Correct answer
Explanation
Quicksort uses divide-and-conquer, recursively partitioning around a pivot element. Each level processes all n elements, and there are O(log n) levels on average (balanced partitions), giving n log(n) complexity. Best and average cases are n log(n), worst case (already sorted with poor pivot choice) degrades to n squared. Linear n and exponential e^n are incorrect.
-
Vector
-
Hash table
-
Linked list
-
Enumeration
B
Correct answer
Explanation
Hash tables index and store objects using key-value pairs where keys are hashed to determine storage location, enabling O(1) average lookup, insert, and delete operations. Vectors use sequential indexing, linked lists use node references, and enumerations provide sequential access without direct indexing. Only hash tables provide dictionary-style key-based object storage.
-
Vector
-
Hash table
-
Linked list
-
Enumeration
C
Correct answer
Explanation
A linked list is highly efficient for inserting or removing elements in the middle of a collection because it only requires updating node pointers. Arrays and Vectors require shifting subsequent elements, and hashtables map key-value pairs rather than ordered positions.
-
Set
-
List
-
Collections
-
None of the above
A
Correct answer
Explanation
A Set is a collection that cannot contain duplicate elements and does not maintain any specific order (like HashSet). Unlike Lists which allow duplicates and preserve order, Sets enforce uniqueness.
-
Vector
-
Hash table
-
Linked list
-
Enumeration
A
Correct answer
Explanation
Vector is a legacy collection class that implements a growable array of objects. Unlike standard arrays, Vector can dynamically resize itself when elements are added. HashTable stores key-value pairs, LinkedList is a linked list implementation, and Enumeration is an interface for traversing collections.