Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Database Systems Final Exam

Total questions: 40

Worksheet time: 40mins

Name
Class
Date
1.

What is the method used to move to the next row in a ResultSet?

a)

forward()

b)

next()

c)

continue()

d)

shift()

2.

Which of the following statements is true about password hashing?

a)

It converts plain-text passwords into fixed-length irreversible strings.

b)

It encrypts and decrypts passwords for storage.

c)

It stores passwords in base64 format.

d)

It is reversible if the right algorithm is known.

3.

What is the purpose of the Class.forName() method in JDBC?

a)

To create a Statement object

b)

To close the connection

c)

To load the JDBC driver

d)

To configure the database URL

4.

Which is a SQL operation used in the Update part of CRUD?

a)

SELECT

b)

DELETE

c)

INSERT

d)

UPDATE

5.

Which of the following is a Java API used to connect to a database?

a)

JDBC

b)

APIConnect

c)

SQLBridge

d)

JSQL

6.

Which JDBC object holds data returned from a database query?

a)

Connection

b)

ResultSet

c)

Statement

d)

DriverManager

7.

What is a major purpose of using PreparedStatement over Statement?

a)

To speed up network connections

b)

To provide GUI support

c)

To prevent SQL Injection

d)

To improve memory usage

8.

In user authentication, which of the following verifies a user's identity?

a)

Role assignment

b)

Biometric check

c)

Authorization

d)

Encryption

9.

Which of the following is NOT a type of JDBC driver?

a)

Type 1

b)

Type 3

c)

Type 4

d)

Type 5

10.

Which role does HTTPS play in a secure login system?

a)

It compresses passwords for faster transfer.

b)

It ensures secure encrypted communication.

c)

It prevents brute-force attacks.

d)

It hashes all inputs automatically.

11.

Which method in JDBC is used to execute INSERT, UPDATE, or DELETE?

a)

executeQuery()

b)

fetch()

c)

runUpdate()

d)

executeUpdate()

12.

What is the correct command to assign a role to a user in MySQL?

a)

GRANT SELECT TO user;

b)

GRANT 'editor' TO 'user1'@'localhost';

c)

CREATE USER editor;

d)

REVOKE editor FROM user;

13.

Which concept in database security ensures data is accessible only to authorized users?

a)

Integrity

b)

Confidentiality

c)

Availability

d)

Replication

14.

Which of the following is considered a strong password policy?

a)

Use of default credentials

b)

Allow short passwords

c)

Enforce complexity and expiration

d)

Avoid password changes

15.

What is the correct way to retrieve a string from a ResultSet?

a)

rs.getText()

b)

rs.readString()

c)

rs.getString()

d)

rs.fetchString()

16.

What is one reason for privilege escalation?

a)

Password expiration

b)

Role reassignment

c)

Misconfigured applications

d)

Audit logging

17.

What is the command to check permissions granted to a user in MySQL?

a)

DESCRIBE user;

b)

LIST PERMISSIONS FOR user;

c)

SHOW GRANTS FOR 'user1'@'localhost';

d)

SELECT * FROM user_permissions;

18.

What Java class is typically used for user input in console-based apps?

a)

InputReader

b)

Scanner

c)

Console

d)

Reader

19.

Which of the following is an example of a malicious insider threat?

a)

Accidental password leak

b)

Database misconfiguration

c)

Developer planting backdoor code

d)

External phishing attempt

20.

Which best describes the CIA Triad principle of Integrity?

a)

Ensuring data is available when needed

b)

Ensuring only admins can log in

c)

Ensuring data remains accurate and unchanged

d)

Ensuring passwords are hashed

21.

What does the executeQuery() method return?

a)

A ResultSet

b)

A boolean

c)

A String

d)

An integer count

22.

Which is a benefit of using roles in MySQL?

a)

Easier direct privilege assignment

b)

Simplifies security management

c)

Avoids use of passwords

d)

Increases default access

23.

What is a good mitigation strategy for SQL injection?

a)

Logging all queries

b)

Allowing admin roles

c)

Using PreparedStatements

d)

Using system.out for debug

24.

What does the following SQL injection string do: ' OR '1'='1?

a)

Causes a syntax error

b)

Closes the database connection

c)

Always returns true in WHERE clause

d)

Encrypts user data

25.

Which method is used to log SQL errors in Java?

a)

System.debug

b)

System.out.print

c)

System.err.println

d)

Log.errorMsg

26.

Which of the following is a type of malware?

a)

Role-based access control

b)

Ransomware

c)

Backup software

d)

SQLMap

27.

What is one advantage of using bcrypt for password hashing?

a)

Reversible encryption

b)

Increases storage speed

c)

Automatically includes a salt

d)

Uses shorter hashes

28.

What happens when you use finally in a try-catch block?

a)

It only runs if an exception occurs

b)

It closes the Java app

c)

It always runs for cleanup

d)

It logs the error

29.

Which of these is NOT part of CRUD operations?

a)

Insert

b)

Display

c)

Update

d)

Delete

30.

Which is an example of weak credentials?

a)

Complex generated token

b)

Biometric-based login

c)

"admin/admin"

d)

OTP via email

31.

Which logging tool in MySQL records all SQL statements sent to the server?

a)

Error Log

b)

Debug Console

c)

General Query Log

d)

Exception Tracker

32.

What does HTTPS protect against?

a)

SQL syntax errors

b)

Man-in-the-middle attacks

c)

Localhost exposure

d)

Query timeouts

33.

Which algorithm is outdated and should NOT be used for hashing passwords?

a)

PBKDF2

b)

SHA1

c)

bcrypt

d)

argon2

34.

What command disables a role in MySQL?

a)

DISABLE ROLE

b)

DROP ROLE

c)

REMOVE PERMISSION

d)

REVOKE

35.

What does "least privilege" mean in database security?

a)

Only DB admins get access

b)

No one has default privileges

c)

Users have minimum rights necessary

d)

Every user is root by default

36.

Which is an example of data leakage?

a)

Encrypted file backups

b)

Open database ports

c)

Hashing passwords

d)

RBAC policies

37.

What tool can simulate SQL injection attacks?

a)

Wireshark

b)

SQLMap

c)

MySQL Workbench

d)

Bcrypt Generator

38.

What does DriverManager.getConnection() do?

a)

Returns a ResultSet

b)

Sets the connection to null

c)

Establishes a DB connection

d)

Registers the driver

39.

In PreparedStatement, which method is used to set a string parameter?

a)

setText()

b)

setField()

c)

setString()

d)

putString()

40.

Which tool analyzes Java code for security issues without executing it?

a)

SQLMap

b)

Burp Suite

c)

SonarQube

d)

Audit Plugin