01. A booking service reads SELECT seats_left FROM tour_slot WHERE slot_id = ?, subtracts the requested seats in Java, and writes the result with UPDATE tour_slot SET seats_left = ? WHERE slot_id = ?. Connections use autocommit, the default isolation level is kept, and two simultaneous bookings sometimes leave seats_left reduced only once. The team must keep the read, compute, write pattern because the Java code applies pricing rules.
Which change removes the lost update?
a) Add a CHECK (seats_left >= 0) constraint to tour_slot and retry any booking whose UPDATE violates it
b) Switch the connections to REPEATABLE READ while keeping autocommit on for every statement
c) Run both statements through PreparedStatement objects cached by the connection pool
d) Turn autocommit off and read the row with SELECT ... FOR UPDATE before the UPDATE and commit
02. A search page lets users type a customer name and pick a sort column from a drop-down list. The current code concatenates both values into SELECT ... FROM loyalty_member WHERE full_name = '...' ORDER BY ..., and a scan has flagged both values as injectable. The page must keep both features.
Which two changes remove the injection risk while keeping both features working? (Choose two.)
a) Bind the typed name to a ? placeholder in a PreparedStatement
b) Bind the sort column to a second ? placeholder after ORDER BY
c) Double every single quote in both values before concatenating them into the statement
d) Move the concatenation into a stored procedure that runs the built string with EXECUTE
e) Map the selected sort option to a column name from a fixed list in code and concatenate only that name
03. A company has four migration projects that all target openGauss.
Which of them is a homogeneous migration?
a) MySQL to openGauss, into a database created with B (MySQL) compatibility
b) openGauss to openGauss, using gs_dump and gs_restore
c) Oracle to openGauss, after the PL/SQL procedures are converted
d) MySQL to openGauss, using full and then incremental migration
04. After an injection finding, a developer added a filter that doubles every single quote in user input, then kept building the query by concatenation:
String sql = "SELECT * FROM vendor_invoice WHERE vendor_id = " + escape(id) + " AND status = 'OPEN'";
PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery();
A tester submits 0 OR 1=1 -- as id.
Which rows does the query return?
a) Every OPEN invoice of every vendor
b) No rows, because the quote filter neutralised the input
c) Every invoice of every vendor, whatever its status
d) A syntax error, because the comment leaves the statement unfinished
05. openGauss serves client sessions with threads inside a single server process instead of starting an operating system process for each connection.
What is the main advantage of this design?
a) Threads share the process memory and are cheaper to create and switch
b) Threads isolate each session's memory, so one failing session cannot affect others
c) Each thread keeps a private copy of the data buffers
d) Threads let client tools read data files directly
06. A DBA creates role analyst, grants it SELECT on the reporting tables, and then runs GRANT analyst TO each of 20 analyst users.
Which statements about this design are true? (Choose two.)
a) Each analyst becomes an owner of the reporting tables
b) A new analyst gets the same access with a single GRANT analyst TO statement
c) Revoking a privilege from the role removes it from every member
d) Each analyst can grant SELECT on those tables to other users
07. Standby node-s is shut down for 20 hours for hardware repair while its primary node-p runs a heavy batch and completes many checkpoints. No WAL archive is configured, and no replication slot or WAL retention setting holds WAL for the standby. When node-s restarts with intact data files, it cannot resume streaming because node-p no longer has the WAL that node-s requests.
Which diagnosis and response are correct?
a) Checkpoints recycled WAL node-s still needed; add standby WAL retention on node-p, and node-s then resumes without a rebuild
b) The WAL writer deleted the records at commit; rebuild node-s, and no configuration change is needed
c) Restart node-p so that its crash recovery regenerates the WAL that node-s is missing
d) Checkpoints recycled WAL node-s still needed; rebuild node-s with gs_ctl build and add standby WAL retention for the future
08. A web application opens a new database connection for every request, and much of each request's time is spent connecting and authenticating. Security policy must not be weakened.
Which technique should be applied?
a) Use a connection pool that reuses already authenticated connections
b) Enable the server thread pool so that sessions share worker threads
c) Run every query through PreparedStatement so that its plan is reused
d) Add indexes to the tables that the application queries most often
09. The single-column table survey_answers(score) holds six rows: 6, 6, NULL, 3, NULL, 9. An analyst runs:
SELECT COUNT(*), COUNT(DISTINCT score), AVG(score), AVG(COALESCE(score, 0)) FROM survey_answers;
Ignoring decimal formatting, which four values are returned?
a) 6, 4, 6 and 4
b) 6, 3, 6 and 4
c) 6, 3, 4 and 4
d) 4, 3, 6 and 4
10. The disk that holds a production instance is almost full. The DBA finds old rotated run logs, audit log files already copied to the log archive, old gs_dump export files already in backup storage, and a large WAL directory inside the data directory.
Which files must not be deleted by hand to free space?
a) Rotated run logs older than the retention period
b) Audit log files already copied to the archive
c) The WAL files in the data directory
d) Export files already copied to backup storage