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
C
Correct answer
Explanation
Accessing an element by index in an array takes O(1) time because arrays use direct memory addressing. In a linked list, finding an element at a specific index requires traversing from the head node, which takes O(n) time in the worst case. The ratio of array access time to linked list access time is therefore 1:n.
-
Non polynomial
-
Number periodicity
-
Non periodic
-
Nondeterministic polynomial
D
Correct answer
Explanation
NP stands for Nondeterministic Polynomial time in computational complexity theory. This class contains decision problems for which a proposed solution can be verified in polynomial time by a deterministic Turing machine, even though finding the solution might require exponential time.
-
Fullword Boundary
-
Halfword Boundary
-
Doubleword Boundary
-
None
A
Correct answer
Explanation
Data aligned on its natural boundary (fullword for 4-byte data) executes faster because the CPU can fetch it in a single memory cycle. Misaligned data may require multiple memory accesses, slowing execution. Halfword alignment is for 2-byte data; doubleword is for 8-byte data. Fullword boundary is optimal for typical 4-byte word operations.
-
Filters
-
Sort
-
Rank
-
Data aggregation
B
Correct answer
Explanation
To find the top N or bottom N items, you must sort the data first. Ranking assigns position numbers, and filters can then select based on those ranks, but the fundamental operation is sorting to establish order.
-
Filters
-
Sort
-
Rank
-
Data aggregation
B
Correct answer
Explanation
Top n and Bottom n queries are achieved using Sort operations, which order data based on specified criteria and then allow selecting the highest or lowest values. Filters restrict data based on conditions, Rank assigns position numbers, and Data aggregation combines values - none directly produce ordered Top/Bottom selections.
-
Filters
-
Sort
-
Rank
-
Data aggregation
B
Correct answer
Explanation
To achieve Top n or Bottom n results, you need to Sort the data first to establish ordering, then select the first or last n records. Filters reduce rows but don't guarantee ordering, Rank assigns position numbers but doesn't subset data, and Data aggregation summarizes rather than selects extremes.
-
Entire
-
Round Robin
-
Random
-
Hash
-
Modulus
A,B,C
Correct answer
Explanation
Keyless partitioning methods distribute data without using a specific key column: Entire places all rows in one partition, Round Robin distributes rows sequentially across partitions, and Random assigns rows randomly. Hash and Modulus require key columns to calculate partition assignments.
-
Junk dimension
-
Degenerate Dimension
-
Conformed dimensions
-
Time dimension
A
Correct answer
Explanation
A junk dimension consolidates low-cardinality attributes like random flags and text fields into a single dimension table to avoid creating numerous tiny dimension tables. This approach reduces complexity in the data warehouse schema while maintaining analytical capability. Degenerate dimensions (option B) are different - they have no corresponding dimension table and exist only in fact tables.
-
No difference
-
1
-
2
-
Cannot be determined
C
Correct answer
Explanation
The claimed answer (99999 elements) appears to be a specific platform limit, though this is not a standard iProcess specification that can be verified from general knowledge. Array field limits are typically platform- and version-specific. This number might be correct for a specific iProcess version, but without authoritative documentation, this should be verified against official TIBCO iProcess documentation.
B
Correct answer
Explanation
Array operations are faster than Vector because arrays are fixed-size, lightweight data structures with no synchronization overhead. Vector is a synchronized, thread-safe legacy class that acquires locks for every operation, making it slower even in single-threaded contexts.
-
Read the stack and have a counter value
-
Using STACK.0
-
Using STACK.MAX
-
Usinf MAX function
B
Correct answer
Explanation
In REXX, compound variables (stacks) use stem notation where STEM.0 automatically contains the element count. Reading and counting manually is inefficient, STACK.MAX doesn't exist, and MAX is for numeric comparisons.
-
Make sure all your subroutines are thread-safe
-
Free all unallocated memory blocks
-
Normalize your data model
-
Determine the answer to question 8 above
-
Make sure all your subroutines are thread-safe
-
Free all unallocated memory blocks
-
Normalize your data model
-
Determine the answer to question above