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
-
Generated key port is generated for each REDEFINES clause
-
Generated key port is generated for each OCCURS clause
-
Generated Column ID is generated for each OCCURS clause
-
Generated Column ID is generated for each REDEFINED clause
A,C
Correct answer
Explanation
In Normalizer transformation for COBOL files, a Generated Key port is created for each REDEFINES clause (identifies which redefinition is active). A Generated Column ID is created for each OCCURS clause (identifies the occurrence position). The reverse mappings in options B and D are incorrect.
-
With a normal join, the Integration Service discards all rows of data from the master and detail source that do not match, based on the condition.
-
A master outer join keeps all rows of data from the master source and the matching rows from the detail source. It discards the unmatched rows from the detail source
-
A detail outer join keeps all rows of data from the detail source and the matching rows from the master source. It discards the unmatched rows from the master source
-
A full outer join discards all rows of data from both the master and detail sources.
-
Stored Procedure Transformation
-
XML Transformation
-
HTTP Transformation
-
Transaction Control Transformation
D
Correct answer
Explanation
Transaction Control Transformation in Informatica PowerCenter is specifically designed to manage commit and rollback operations for various target types including relational databases, XML sources, and IBM MQSeries targets. It allows you to define conditions that determine when to commit or rollback transactions based on business logic or data conditions. The other transformations listed serve different purposes - Stored Procedures execute database procedures, XML handles XML data, and HTTP makes web service calls.
-
Using Redim Keyword
-
Using Preserve Keyword
-
Using Reserve Keyword
-
None of the above
B
Correct answer
Explanation
The Preserve keyword in VB.NET is used with ReDim to resize an array while retaining existing values. Without Preserve, ReDim would create a new array and lose all existing data. Options A and C are not valid keywords for this purpose.
-
Using Redim Keyword
-
Using Preserve Keyword
-
Using Reserve Keyword
-
None of the above
B
Correct answer
Explanation
The Preserve keyword in VB.NET is used with ReDim to resize an array while retaining existing values. Without Preserve, ReDim would create a new array and lose all existing data. Options A and C are not valid keywords for this purpose.
B
Correct answer
Explanation
Each execution of the array constructor [1, 2] creates a new, unique array reference. When used as hash keys, these references stringify to distinct strings (like 'ARRAY(0x...)'), resulting in two separate key-value pairs in the hash.
A
Correct answer
Explanation
Effective information architecture often hybridizes multiple structural patterns. For example, a website might use hierarchical navigation menus while also incorporating linear tutorials or database-driven search functionality. This flexibility allows designers to match structure to content type and user needs rather than forcing content into a single pure structure.
A
Correct answer
Explanation
HTML allows combining different navigation structures like linear (sequential pages) and hierarchical (tree-based menus) within the same website. You can use linear structure for tutorials and hierarchical for main navigation, making the statement true.
-
By calling ReverseSort()
-
By calling SortReverse()
-
By calling Descend()
-
By calling Sort() and then Reverse() methods
D
Correct answer
Explanation
Standard arrays in languages like C# or JavaScript do not have direct methods like ReverseSort or Descend. Sorting in descending order is typically accomplished by sorting in ascending order first and then reversing the array.
A
Correct answer
Explanation
Python lists are heterogeneous data structures that can contain elements of different types within the same list object, such as integers, strings, floats, or even other lists.
-
arr[n].length();
-
arr.size;
-
arr.size-1;
-
arr[n].length;
D
Correct answer
Explanation
In Java, arrays use the length property rather than a method length() or size property to determine their size. Since arr[n] refers to a 1D integer array, arr[n].length correctly retrieves its size.
-
SET
-
SEARCH
-
PERFORM
-
All the above
D
Correct answer
Explanation
In COBOL, the INDEX command creates an index for a table that can then be used by the SEARCH statement to efficiently locate specific table entries. The SEARCH operation requires an index to perform optimized lookups through the table.
C
Correct answer
Explanation
The size_of function on a vector returns the product of all elements in this context: 2 * 3 * 4 = 24. Option A (3) would be the element count, not the size calculation.
-
Avoid direct coupling
-
Maintain low coupling and high reusability
-
None of the above
-
Both A and B
D
Correct answer
Explanation
The Indirection pattern supports low coupling and reusability by assigning responsibility to an intermediate object that mediates between other components. This avoids direct coupling between components, making the system more flexible and reusable. Option D correctly captures both benefits.
-
int *ptr = (int *) malloc(10, sizeof(int));
-
int *ptr = (int *) calloc(10, sizeof(int));
-
int *ptr = (int *) malloc(10*sizeof(int));
-
int *ptr = (int *) alloc(10*sizeof(int));
C
Correct answer
Explanation
malloc(10*sizeof(int)) correctly allocates space for 10 integers. Option C is correct - it multiplies the element count by the size of each element. malloc() takes a single byte count argument, while calloc(10, sizeof(int)) initializes to zero but allocates the same size. Option A's malloc(10, sizeof(int)) is incorrect syntax - malloc doesn't take two arguments.