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
-
an actor
-
a director
-
a year
-
a movie
D
Correct answer
Explanation
In a movies database where you're organizing your Top 100 list, each record should represent one movie. The record would contain fields for Title, Actor(s), Director, Year, Genre, etc. A record representing an actor, director, or year would only capture partial information - you want the complete entity (the movie) as your primary record.
-
loads a new record into the input buffer if an end-of-record is found in the current record
-
holds the current data line in the buffer for another input statement to process
-
can be used to read multiple observations from a single data line
-
is a syntax error
B,C
Correct answer
Explanation
In SAS, double trailing @@ in an INPUT statement holds the current data line in the input buffer, allowing multiple INPUT statements to read data from the same line. This enables reading multiple observations from a single data line, which is the practical use case.
-
SortedMap
-
Tree
-
Set
-
SortedSet
A
Correct answer
Explanation
TreeMap implements the SortedMap interface (now NavigableMap in newer Java versions). It maintains keys in sorted order. It does not implement Tree (not a standard interface), Set, or SortedSet.
-
Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array.
-
An index can only be modified using PERFORM, SEARCH & SET.
-
Need to have index for a table in order to use SEARCH, SEARCH ALL.
-
None of the above
D
Correct answer
Explanation
All statements are true. A subscript represents the occurrence number, while an index represents the displacement. An index can only be modified using PERFORM, SEARCH, and SET. An index is required on a table to use SEARCH or SEARCH ALL. Thus, none of the statements are false.
-
The start value of the sequence is always 1.
-
The sequence always increments by 1.
-
The minimum value of an ascending sequence defaults to 1.
-
The maximum value of descending sequence defaults to 1.
C
Correct answer
Explanation
In database sequences (such as Oracle), the default minimum value for an ascending sequence is 1. The start value and increment can be customized, and descending sequences default to a different maximum value.
A
Correct answer
Explanation
In Java, ArrayList operations are generally faster than Vector because ArrayList is unsynchronized (not thread-safe) while Vector is synchronized. The synchronization overhead in Vector makes it slower for single-threaded operations. This is a key reason ArrayList was introduced in Java 1.2 as a modern alternative to the legacy Vector class.
-
Binary Tree
-
Hash Table
-
Stack
-
None of the Above
B
Correct answer
Explanation
Hash tables provide O(1) average time complexity for key-based lookups, making them ideal for scenarios requiring fast data retrieval by key. Binary trees have O(log n) lookup time, while stacks follow LIFO order and don't support efficient key-based access.
-
Binary Tree
-
Hash Table
-
Stack
-
None of the Above
A
Correct answer
Explanation
A stack is a Last-In, First-Out (LIFO) data structure. When you push 1, 3, and 5 onto the stack in that order, 5 is the last element added and therefore the first element to be popped out.
-
Binary Tree
-
Hash Table
-
Stack
-
None of the Above
B
Correct answer
Explanation
Hash tables provide average O(1) lookup time due to direct indexing through hash functions. Binary trees provide O(log n) lookup. Stacks provide O(1) but only for LIFO access, not general retrieval. Hash tables are fastest on average for general data retrieval.
-
Sorter transform increases the number of rows
-
Sorter transform returns the same number of rows
-
Sorter transformation decreases the number of rows
-
None of the above
-
Reformat
-
Replicate
-
Broadcast
-
Partition by Key
A
Correct answer
Explanation
The Reformat component specifically transforms the structure or format of data records passing through it. It can change field names, data types, and record layouts. Replicate duplicates data, Broadcast distributes copies, and Partition by Key splits data; none change the record format itself.
-
Partitioning the records
-
Sorting the records
-
Validating the records
-
Discarding the records
D
Correct answer
Explanation
The Trash component in Ab Initio is used to discard records from the data flow. It provides a way to filter out unwanted records by routing them to a trash output, effectively removing them from further processing.
A
Correct answer
Explanation
In Ab Initio Co>Operating system architecture, the Enterprise Server can have exactly one Gateway Server configured. The Gateway handles client connections and routes requests to the Enterprise Server, and this single-instance architecture prevents routing conflicts and maintains centralized control.
-
Sorter
-
Connected Lookup
-
Expression
-
Unconnected Lookup
A
Correct answer
Explanation
In Informatica, an Active transformation changes the number of rows passing through it. The Sorter transformation is active because it can change the row order and, based on configuration, can filter rows (like using 'distinct' sort which removes duplicates). Lookup (both connected and unconnected) and Expression are passive transformations as they maintain the same number of rows.