Skip to content

Practice Test: DBMS · OS · CN · Security (80 MCQs, no answers) ​

How to use

  • Attempt without the notes. Aim for about 1 minute per question.
  • Send your answers in chat like A1-b, A2-c, A3-a …. You don't need to paste the questions; I have them. One set at a time is fine.
  • I'll mark each one right or wrong and explain the wrong ones.
SetSubjectQuestions
ADBMS35
BOperating Systems20
CComputer Networks + Security25

Set A: DBMS (35) ​

A1. Which type of data independence is harder to achieve? (a) Physical (b) Logical (c) Both are equally hard (d) Neither can be achieved

A2. In R(A, B, C, D, E), AB is the only candidate key. How many super keys does R have? (a) 4 (b) 16 (c) 8 (d) 31

A3. R(A, B, C, D) has exactly two candidate keys: A and BC. How many super keys? (a) 10 (b) 12 (c) 8 (d) 11

A4. R(A, B, C, D, E) with F = {A → B, BC → E, ED → A}. The candidate keys are: (a) CD only (b) ACD, BCD (c) ACD, BCD, CDE (d) ABCD, BCDE

A5. The highest normal form of the relation in A4 is: (a) 1NF (b) 2NF (c) BCNF (d) 3NF

A6. R(A, B, C, D) with F = {AB → C, B → D}. Highest normal form? (a) 1NF (b) 2NF (c) 3NF (d) BCNF

A7. R(A, B, C, D) with F = {A → B, C → D} is decomposed into R1(A, B) and R2(C, D). The decomposition is: (a) Lossless and dependency preserving (b) Lossless but not dependency preserving (c) Lossy but dependency preserving (d) Lossy and not dependency preserving

A8. Which statement is TRUE? (a) BCNF decomposition always preserves dependencies (b) A lossy decomposition loses tuples when the parts are joined back (c) Every 3NF relation is in BCNF (d) 3NF synthesis is always lossless and dependency preserving

A9. Table T has one column x with rows 2, 4, NULL. Output of SELECT COUNT(*), COUNT(x), SUM(x), AVG(x) FROM T; (a) 3, 3, 6, 2 (b) 3, 2, 6, 3 (c) 2, 2, 6, 3 (d) 3, 2, 6, 2

A10. dept.dept_id contains at least one NULL. What does this return?

sql
SELECT name FROM emp WHERE dept_id NOT IN (SELECT dept_id FROM dept);

(a) No rows (b) Employees whose dept_id is not in dept (c) An error (d) All employees

A11. SELECT salary*12 AS annual FROM emp WHERE annual > 500000; fails in standard SQL because: (a) WHERE is evaluated before SELECT, so the alias doesn't exist yet (b) Aliases are not allowed in SQL (c) Arithmetic isn't allowed in SELECT (d) It must use HAVING with GROUP BY

A12. Salaries 100, 90, 90, 80 ordered DESC. RANK() and DENSE_RANK() of 80 are: (a) 3 and 3 (b) 4 and 3 (c) 4 and 4 (d) 3 and 4

A13. Which is TRUE? (a) TRUNCATE can take a WHERE clause (b) DELETE is a DDL command (c) DROP removes the data but keeps the table structure (d) TRUNCATE is DDL and removes all rows while keeping the table structure

A14. R(A, B) has 5 tuples and S(C, D) has 4 tuples. Number of tuples in the natural join R ⋈ S? (a) 20 (b) 0 (c) 9 (d) 5

A15. R(A, B) has 10 tuples and S(B, C) has 8 tuples. B is the primary key of S, and R.B is a NOT NULL foreign key referencing S.B. Number of tuples in R ⋈ S? (a) 8 (b) Between 0 and 10 (c) 80 (d) Exactly 10

A16. "Find students who have taken ALL courses" is most naturally written in relational algebra using: (a) Union (b) Cartesian product (c) Division (d) Selection

A17. Which is NOT a fundamental (basic) relational algebra operator? (a) Intersection (b) Set difference (c) Rename (d) Cartesian product

A18. Schedule S: R1(X), R2(X), W1(X), W2(X). S is: (a) Conflict serializable (b) View serializable but not conflict serializable (c) Neither conflict nor view serializable (d) Serial

A19. Schedule S: R1(A), W2(A), W1(A), W3(A). S is: (a) Conflict serializable (b) View serializable but not conflict serializable (c) Neither conflict nor view serializable (d) Serial

A20. Schedule: W1(X), R2(X), C2, C1 (C = commit). This schedule is: (a) Strict (b) Cascadeless (c) Recoverable but not cascadeless (d) Non-recoverable

A21. Basic two-phase locking guarantees: (a) Freedom from deadlock (b) Conflict serializability (c) No cascading rollbacks (d) All of these

A22. Wound–wait scheme: Tj (timestamp 20) requests a lock held by Ti (timestamp 8). What happens? (a) Tj waits (b) Tj is rolled back (c) Ti is rolled back (d) Both are rolled back

A23. Timestamp ordering: transaction T (TS = 12) issues write(Q), where R-timestamp(Q) = 10 and W-timestamp(Q) = 15. The outcome under basic TO and under Thomas' write rule, respectively, is: (a) Execute; execute (b) Roll back; ignore the write (c) Ignore the write; roll back (d) Roll back; roll back

A24. Immediate-modification log at the time of a crash:

<T1 start> <T1, A, 100, 200> <T1 commit>
<T2 start> <T2, B, 50, 80>
<checkpoint {T2}>
<T3 start> <T3, C, 10, 20> <T3 commit>
<T2, D, 5, 9>
<T4 start> <T4, E, 1, 2>
--- crash ---

Which recovery actions are correct? (a) Redo T1, T3; undo T2, T4 (b) Redo T3; undo T4 only (c) Redo T2, T3; undo T4 (d) Redo T3; undo T2, T4

A25. Recovery with deferred database modification requires: (a) Redo only (b) Undo only (c) Both undo and redo (d) Neither

A26. B+ tree internal node: block size 512 bytes, search key 10 bytes, block pointer 6 bytes. Maximum number of child pointers in an internal node? (a) 31 (b) 33 (c) 32 (d) 51

A27. A file has 30,000 records of 100 bytes each, block size 1,024 bytes, unspanned, sorted on the key. Block accesses for a binary search on the data file? (a) 11 (b) 12 (c) 13 (d) 15

A28. Same file with a primary index (key 9 bytes, block pointer 6 bytes, one entry per data block). Block accesses to fetch a record using binary search on the index (count the data block too)? (a) 6 (b) 12 (c) 5 (d) 7

A29. Entity sets E1 and E2 have a many-to-many relationship R. E1 also has one multivalued attribute. Minimum number of tables? (a) 2 (b) 3 (c) 4 (d) 5

A30. Which is TRUE about a weak entity set? (a) It has its own primary key (b) It always has total participation in its identifying relationship (c) It can exist without its owner entity (d) Its discriminator alone forms its primary key

A31. Which anomaly does REPEATABLE READ prevent that READ COMMITTED does not? (a) Dirty read (b) Phantom read (c) Non-repeatable read (d) None

A32. Column salary INT CHECK (salary > 0) has no NOT NULL constraint. INSERT INTO t (salary) VALUES (NULL); will: (a) Fail with a CHECK violation (b) Insert 0 (c) Raise a type error (d) Succeed

A33. R(A, B, C, D, E, H) with F = {A → B, BC → D, E → C, D → A}. What is (AE)⁺? (a) ABCDEH (b) ABE (c) ABCDE (d) ACE

A34. T1 has 3 operations and T2 has 2. How many different interleaved schedules keep each transaction's own operation order? (a) 10 (b) 6 (c) 20 (d) 120

A35. Which query returns the second-highest distinct salary? (a) SELECT salary FROM emp ORDER BY salary DESC LIMIT 2; (b) SELECT MAX(salary) - 1 FROM emp; (c) SELECT salary FROM emp WHERE salary = MAX(salary) - 1; (d) SELECT MAX(salary) FROM emp WHERE salary < (SELECT MAX(salary) FROM emp);


Set B: Operating Systems (20) ​

B1. How many times is "hi" printed?

c
fork(); fork(); fork();
printf("hi\n");

(a) 3 (b) 6 (c) 7 (d) 8

B2. Which process-state transition is NOT possible? (a) Running → Ready (b) Waiting → Running (c) Ready → Running (d) Running → Waiting

B3. Which scheduler controls the degree of multiprogramming? (a) Long-term (b) Short-term (c) Medium-term (d) Dispatcher

B4. SRTF (preemptive SJF). Processes (arrival, burst): P1 (0, 7), P2 (2, 4), P3 (4, 1), P4 (5, 4). Average waiting time? (a) 4 (b) 3 (c) 4.75 (d) 2.75

B5. Round Robin with q = 4. P1, P2, P3 all arrive at t = 0 (in that order) with bursts 10, 4, 6. Average waiting time? (a) 8 (b) 15.33 (c) 8.67 (d) 4.67

B6. Which algorithm does NOT cause starvation? (a) SJF (b) Priority scheduling without aging (c) Round Robin (d) SRTF

B7. HRRN: when the CPU becomes free, three processes are waiting: P1 (waited 10, burst 5), P2 (waited 6, burst 2), P3 (waited 8, burst 8). Which runs next? (a) P1 (b) P2 (c) P3 (d) Tie between P1 and P2

B8. Peterson's solution satisfies: (a) Mutual exclusion, progress and bounded waiting (b) Mutual exclusion only (c) Mutual exclusion and progress only (d) Progress and bounded waiting only

B9. Two processes use strict alternation with a shared turn variable. Which requirement is violated? (a) Mutual exclusion (b) Progress (c) Bounded waiting (d) None

B10. A counting semaphore starts at 10. Then 12 wait (P) and 7 signal (V) operations are performed. Final value? (a) 5 (b) −2 (c) 3 (d) 15

B11. 4 processes share identical units of a resource; each may need up to 3 units. Minimum number of units that guarantees deadlock can never occur? (a) 8 (b) 12 (c) 10 (d) 9

B12. 12 tape drives. P0: max 10, holds 5. P1: max 4, holds 2. P2: max 9, holds 2. If P2's request for 1 more drive is granted, the system state becomes: (a) Safe (b) Unsafe (c) Deadlocked (d) Cannot be determined

B13. Belady's anomaly can occur in: (a) LRU (b) Optimal (c) FIFO (d) None of these

B14. LRU with 3 frames (initially empty), reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3. Number of page faults? (a) 6 (b) 9 (c) 10 (d) 8

B15. TLB hit ratio 90%, TLB lookup 10 ns, memory access 100 ns, single-level page table. Effective memory access time? (a) 110 ns (b) 130 ns (c) 120 ns (d) 210 ns

B16. 32-bit logical addresses, 4 KB pages, 4-byte page-table entries. Size of one process's single-level page table? (a) 4 MB (b) 1 MB (c) 4 KB (d) 16 MB

B17. Thrashing is mainly caused by: (a) Too high a degree of multiprogramming, leaving too few frames per process (b) Small page size (c) A large TLB (d) SSTF disk scheduling

B18. Cylinders 0–199, head at 50. Requests (in arrival order): 82, 170, 43, 140, 24, 16, 190. Total head movement with SSTF? (a) 642 (b) 332 (c) 314 (d) 208

B19. An inverted page table has one entry for each: (a) Page of every process (b) Process (c) Segment (d) Physical frame

B20. Page size 2,048 bytes; a process needs 72,766 bytes. Internal fragmentation? (a) 1,086 bytes (b) 2,048 bytes (c) 962 bytes (d) 0 bytes


Set C: Computer Networks + Security (25) ​

C1. Which layer is responsible for process-to-process delivery? (a) Network (b) Data link (c) Transport (d) Session

C2. Which device separates broadcast domains? (a) Hub (b) Switch (c) Bridge (d) Router

C3. Broadcast address of 172.16.45.200/20? (a) 172.16.45.255 (b) 172.16.47.255 (c) 172.16.63.255 (d) 172.16.32.255

C4. How many usable host addresses does a /27 subnet have? (a) 30 (b) 32 (c) 62 (d) 14

C5. From 172.16.0.0/16 you need at least 50 subnets, each as large as possible. Which mask, and how many usable hosts per subnet? (a) 255.255.255.0, 254 (b) 255.255.248.0, 2046 (c) 255.255.252.0, 1022 (d) 255.255.254.0, 510

C6. Maximum throughput of pure ALOHA is about: (a) 36.8% (b) 18.4% (c) 50% (d) 100%

C7. CSMA/CD network: 10 Mbps, maximum cable length 2 km, signal speed 2 × 10⁸ m/s. Minimum frame size? (a) 100 bits (b) 400 bits (c) 200 bits (d) 25 bits

C8. Stop-and-wait over a 1 Mbps link, 1,000-bit frames, one-way propagation delay 2 ms (ignore ACK size and processing). Link utilization? (a) 20% (b) 33% (c) 50% (d) 25%

C9. With 3-bit sequence numbers, the maximum sender window sizes for Go-Back-N and Selective Repeat are: (a) 8 and 8 (b) 7 and 7 (c) 8 and 4 (d) 7 and 4

C10. Data 1101, generator 1011 (x³ + x + 1). Which CRC bits are appended? (a) 010 (b) 001 (c) 100 (d) 011

C11. Minimum number of Hamming check bits for 7 data bits (single-error correction)? (a) 3 (b) 5 (c) 4 (d) 7

C12. Client ISN = 100, server ISN = 300. After the three-way handshake, what sequence number does the client's first data byte carry? (a) 100 (b) 101 (c) 102 (d) 301

C13. TCP Reno: a retransmission timeout occurs when cwnd = 20 MSS. New ssthresh and cwnd? (a) ssthresh 10, cwnd 1 (b) ssthresh 10, cwnd 10 (c) ssthresh 20, cwnd 1 (d) ssthresh 10, cwnd 13

C14. Which protocol uses UDP for queries but TCP for zone transfers, both on port 53? (a) DNS (b) DHCP (c) SNMP (d) TFTP

C15. FTP's control connection uses port ___ and is described as ___: (a) 20, in-band (b) 21, out-of-band (c) 21, in-band (d) 20, out-of-band

C16. The first message a DHCP client broadcasts is: (a) DHCPREQUEST (b) DHCPOFFER (c) DHCPACK (d) DHCPDISCOVER

C17. A 4,000-byte IPv4 datagram (20-byte header, no options) must cross a link with MTU 1,500 bytes. Value of the fragment-offset field in the third fragment? (a) 370 (b) 2960 (c) 185 (d) 2980

C18. RSA with p = 5, q = 11, e = 3. Private exponent d? (a) 7 (b) 13 (c) 27 (d) 37

C19. Diffie–Hellman with q = 23, α = 5, private keys X_A = 6 and X_B = 15. Shared secret key? (a) 8 (b) 2 (c) 19 (d) 12

C20. Which provides non-repudiation? (a) MAC (b) Hash function (c) Symmetric encryption (d) Digital signature

C21. Which IPsec protocol provides confidentiality? (a) ESP (b) AH (c) IKE (d) Both AH and ESP

C22. How many secret keys are needed so that every pair among 10 users can communicate privately with symmetric cryptography? (a) 10 (b) 20 (c) 90 (d) 45

C23. How many rounds does AES use with a 256-bit key? (a) 10 (b) 12 (c) 14 (d) 16

C24. Which firewall inspects application-layer content (for example, HTTP commands)? (a) Packet filter (b) Circuit-level gateway (c) Stateless ACL (d) Application-level gateway (proxy)

C25. Shannon capacity of a 4 kHz channel with SNR = 63 (ratio, not dB)? (a) 24 kbps (b) 8 kbps (c) 252 kbps (d) 48 kbps


Send answers like A1-b, A2-c, … and I'll grade them.