WorksheetsDatabase Systems Final Exam
Total questions: 40
Worksheet time: 40mins
What is the method used to move to the next row in a ResultSet?
forward()
next()
continue()
shift()
Which of the following statements is true about password hashing?
It converts plain-text passwords into fixed-length irreversible strings.
It encrypts and decrypts passwords for storage.
It stores passwords in base64 format.
It is reversible if the right algorithm is known.
What is the purpose of the Class.forName() method in JDBC?
To create a Statement object
To close the connection
To load the JDBC driver
To configure the database URL
Which is a SQL operation used in the Update part of CRUD?
SELECT
DELETE
INSERT
UPDATE
Which of the following is a Java API used to connect to a database?
JDBC
APIConnect
SQLBridge
JSQL
Which JDBC object holds data returned from a database query?
Connection
ResultSet
Statement
DriverManager
What is a major purpose of using PreparedStatement over Statement?
To speed up network connections
To provide GUI support
To prevent SQL Injection
To improve memory usage
In user authentication, which of the following verifies a user's identity?
Role assignment
Biometric check
Authorization
Encryption
Which of the following is NOT a type of JDBC driver?
Type 1
Type 3
Type 4
Type 5
Which role does HTTPS play in a secure login system?
It compresses passwords for faster transfer.
It ensures secure encrypted communication.
It prevents brute-force attacks.
It hashes all inputs automatically.
Which method in JDBC is used to execute INSERT, UPDATE, or DELETE?
executeQuery()
fetch()
runUpdate()
executeUpdate()
What is the correct command to assign a role to a user in MySQL?
GRANT SELECT TO user;
GRANT 'editor' TO 'user1'@'localhost';
CREATE USER editor;
REVOKE editor FROM user;
Which concept in database security ensures data is accessible only to authorized users?
Integrity
Confidentiality
Availability
Replication
Which of the following is considered a strong password policy?
Use of default credentials
Allow short passwords
Enforce complexity and expiration
Avoid password changes
What is the correct way to retrieve a string from a ResultSet?
rs.getText()
rs.readString()
rs.getString()
rs.fetchString()
What is one reason for privilege escalation?
Password expiration
Role reassignment
Misconfigured applications
Audit logging
What is the command to check permissions granted to a user in MySQL?
DESCRIBE user;
LIST PERMISSIONS FOR user;
SHOW GRANTS FOR 'user1'@'localhost';
SELECT * FROM user_permissions;
What Java class is typically used for user input in console-based apps?
InputReader
Scanner
Console
Reader
Which of the following is an example of a malicious insider threat?
Accidental password leak
Database misconfiguration
Developer planting backdoor code
External phishing attempt
Which best describes the CIA Triad principle of Integrity?
Ensuring data is available when needed
Ensuring only admins can log in
Ensuring data remains accurate and unchanged
Ensuring passwords are hashed
What does the executeQuery() method return?
A ResultSet
A boolean
A String
An integer count
Which is a benefit of using roles in MySQL?
Easier direct privilege assignment
Simplifies security management
Avoids use of passwords
Increases default access
What is a good mitigation strategy for SQL injection?
Logging all queries
Allowing admin roles
Using PreparedStatements
Using system.out for debug
What does the following SQL injection string do: ' OR '1'='1?
Causes a syntax error
Closes the database connection
Always returns true in WHERE clause
Encrypts user data
Which method is used to log SQL errors in Java?
System.debug
System.out.print
System.err.println
Log.errorMsg
Which of the following is a type of malware?
Role-based access control
Ransomware
Backup software
SQLMap
What is one advantage of using bcrypt for password hashing?
Reversible encryption
Increases storage speed
Automatically includes a salt
Uses shorter hashes
What happens when you use finally in a try-catch block?
It only runs if an exception occurs
It closes the Java app
It always runs for cleanup
It logs the error
Which of these is NOT part of CRUD operations?
Insert
Display
Update
Delete
Which is an example of weak credentials?
Complex generated token
Biometric-based login
"admin/admin"
OTP via email
Which logging tool in MySQL records all SQL statements sent to the server?
Error Log
Debug Console
General Query Log
Exception Tracker
What does HTTPS protect against?
SQL syntax errors
Man-in-the-middle attacks
Localhost exposure
Query timeouts
Which algorithm is outdated and should NOT be used for hashing passwords?
PBKDF2
SHA1
bcrypt
argon2
What command disables a role in MySQL?
DISABLE ROLE
DROP ROLE
REMOVE PERMISSION
REVOKE
What does "least privilege" mean in database security?
Only DB admins get access
No one has default privileges
Users have minimum rights necessary
Every user is root by default
Which is an example of data leakage?
Encrypted file backups
Open database ports
Hashing passwords
RBAC policies
What tool can simulate SQL injection attacks?
Wireshark
SQLMap
MySQL Workbench
Bcrypt Generator
What does DriverManager.getConnection() do?
Returns a ResultSet
Sets the connection to null
Establishes a DB connection
Registers the driver
In PreparedStatement, which method is used to set a string parameter?
setText()
setField()
setString()
putString()
Which tool analyzes Java code for security issues without executing it?
SQLMap
Burp Suite
SonarQube
Audit Plugin
