Showing 271–280 of 309 questions
Q.271
Medium
Database/SQL
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.
Q.274
Medium
Database/SQL
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.
Q.275
Medium
Database/SQL
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.
Q.277
Medium
Database/SQL
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.
What is the purpose of the COMMIT statement in SQL transactions?
A
To undo all pending changes
B
To save all changes made during a transaction permanently to the database
C
To create a new transaction
D
To delete committed records
Correct Answer:
B. To save all changes made during a transaction permanently to the database
Explanation:
COMMIT saves all changes made during the current transaction to the database permanently. Until COMMIT, changes can be rolled back using ROLLBACK.