Showing 61–70 of 100 questions
in Database/SQL
In a B-tree of order m, what is the maximum number of keys that a non-root node can contain?
Explanation:
A B-tree of order m can have at most 2m-1 keys in any node and minimum m-1 keys in non-root nodes.
Which of the following is a correct SQL syntax for creating an index on multiple columns?
A
CREATE INDEX idx_name ON table_name (col1, col2);
B
CREATE UNIQUE INDEX idx_name ON table_name (col1, col2);
C
CREATE INDEX idx_name ON table_name COLUMNS (col1, col2);
D
Both A and B are correct
Correct Answer:
D. Both A and B are correct
Explanation:
Both syntaxes are valid in SQL. The first creates a composite index, while the second creates a unique composite index.
What is the main disadvantage of using a linked list compared to arrays?
A
Linked lists use more memory due to pointers
B
Linked lists have O(1) insertion at beginning
C
Linked lists cannot be sorted
D
Linked lists have cache locality issues
Correct Answer:
A. Linked lists use more memory due to pointers
Explanation:
Linked lists require extra memory for storing pointers/references in each node, making them memory-inefficient compared to arrays.
In AWS, what does the term 'Auto Scaling' primarily ensure?
A
Automatic backup of databases
B
Automatic adjustment of compute capacity based on demand
C
Automatic encryption of data
D
Automatic software updates
Correct Answer:
B. Automatic adjustment of compute capacity based on demand
Explanation:
AWS Auto Scaling automatically adjusts the number of EC2 instances based on demand metrics like CPU utilization or network traffic.
Which sorting algorithm has the best average-case time complexity for randomly distributed data?
A
Bubble Sort - O(n²)
B
Quick Sort - O(n log n)
C
Insertion Sort - O(n²)
D
Selection Sort - O(n²)
Correct Answer:
B. Quick Sort - O(n log n)
Explanation:
Quick Sort has O(n log n) average-case complexity, making it most efficient for random data. Though worst-case is O(n²), randomized pivot selection minimizes this risk.
What does ACID compliance in databases ensure?
A
Data is always encrypted
B
Atomicity, Consistency, Isolation, and Durability of transactions
C
Automatic data compression
D
Asynchronous data backup
Correct Answer:
B. Atomicity, Consistency, Isolation, and Durability of transactions
Explanation:
ACID is a fundamental database property: Atomicity (all-or-nothing), Consistency (valid state), Isolation (concurrent independence), Durability (permanent after commit).
What is the primary function of a hash table data structure?
A
To maintain sorted data
B
To provide O(1) average-case lookup time using hash functions
C
To implement tree traversal
D
To perform recursive function calls
Correct Answer:
B. To provide O(1) average-case lookup time using hash functions
Explanation:
Hash tables use hash functions to map keys to indices, providing O(1) average-case lookup, insertion, and deletion operations.
Which cloud service model provides pre-configured application environments?
A
IaaS (Infrastructure as a Service)
B
PaaS (Platform as a Service)
C
SaaS (Software as a Service)
D
DaaS (Database as a Service)
Correct Answer:
B. PaaS (Platform as a Service)
Explanation:
PaaS provides a complete development and deployment environment in the cloud, including pre-configured tools and frameworks.
What is the time complexity of the binary search algorithm on a sorted array?
A
O(n)
B
O(log n)
C
O(n log n)
D
O(n²)
Correct Answer:
B. O(log n)
Explanation:
Binary search divides the search space in half with each iteration, resulting in O(log n) time complexity on sorted data.
In database normalization, what does the Boyce-Codd Normal Form (BCNF) address that 3NF might miss?
A
Elimination of multivalued dependencies
B
Removal of anomalies from composite candidate keys
C
Prevention of circular foreign keys
D
Ensuring data type consistency
Correct Answer:
B. Removal of anomalies from composite candidate keys
Explanation:
BCNF handles edge cases in 3NF where anomalies can occur with composite candidate keys where determinants are not candidate keys themselves.