Showing 11–20 of 100 questions
in Database/SQL
What is the primary difference between supervised and unsupervised machine learning?
A
Supervised uses labeled data; unsupervised uses unlabeled data
B
Unsupervised is faster than supervised
C
Supervised cannot predict outcomes
D
Unsupervised requires human supervision
Correct Answer:
A. Supervised uses labeled data; unsupervised uses unlabeled data
EXPLANATION
Supervised learning trains on labeled data (features + targets); unsupervised finds patterns in unlabeled data without predefined outputs.
In cybersecurity, what is SQL injection attack?
A
Inserting legitimate SQL into database
B
Malicious SQL code injected into input fields to manipulate database queries
C
A method to optimize SQL performance
D
Splitting SQL statements across multiple lines
Correct Answer:
B. Malicious SQL code injected into input fields to manipulate database queries
EXPLANATION
SQL injection exploits vulnerable input handling to execute unintended SQL commands, potentially exposing or modifying data.
What does normalization in machine learning context primarily aim to achieve?
A
Reduce features to 2D
B
Scale features to similar ranges to improve model performance
C
Remove all outliers
D
Increase dataset size
Correct Answer:
B. Scale features to similar ranges to improve model performance
EXPLANATION
Normalization scales features (e.g., 0-1 range) preventing features with larger scales from dominating model training.
In graph algorithms, which algorithm finds the shortest path in weighted graphs?
A
DFS
B
BFS
C
Dijkstra's algorithm
D
Topological sort
Correct Answer:
C. Dijkstra's algorithm
EXPLANATION
Dijkstra's algorithm efficiently finds shortest paths from a source node to all other nodes in weighted graphs with non-negative weights.
What is the difference between DELETE and TRUNCATE in SQL?
A
DELETE is faster than TRUNCATE
B
TRUNCATE is DDL; DELETE is DML and is slower but can be rolled back
C
TRUNCATE cannot be rolled back while DELETE can
D
Both have identical functionality
Correct Answer:
B. TRUNCATE is DDL; DELETE is DML and is slower but can be rolled back
EXPLANATION
TRUNCATE is DDL (immediate, cannot be rolled back in most databases), DELETE is DML (slower, can be rolled back).
In cloud computing, which service model allows customers to run their own applications but not manage infrastructure?
A
IaaS
B
PaaS
C
SaaS
D
DBaaS
EXPLANATION
PaaS (Platform as a Service) provides a platform to develop and deploy applications without managing underlying infrastructure.
What is the time complexity of quicksort algorithm in the worst case?
A
O(n log n)
B
O(n²)
C
O(n)
D
O(log n)
EXPLANATION
Quicksort's worst-case complexity is O(n²) when pivot selection is poor, though average case is O(n log n).
Which normalization form eliminates all non-key dependencies?
EXPLANATION
3NF (Third Normal Form) ensures all non-key attributes depend only on the primary key, eliminating transitive dependencies.
In SQL, what does the GROUP BY clause do?
A
Joins multiple tables
B
Aggregates rows into groups based on specified columns
C
Deletes duplicate records
D
Orders results alphabetically
Correct Answer:
B. Aggregates rows into groups based on specified columns
EXPLANATION
GROUP BY groups rows with identical values in specified columns, used with aggregate functions like COUNT(), SUM().
What is the main advantage of cloud computing's elasticity?
A
Lower initial hardware cost
B
Automatic resource scaling based on demand
C
Guaranteed 100% uptime
D
Elimination of all security risks
Correct Answer:
B. Automatic resource scaling based on demand
EXPLANATION
Elasticity allows automatic resource provisioning and de-provisioning based on real-time demand, reducing costs.