Information Technology for the Specialist Officer Paper: Databases and SQL, Networks and Addressing, Operating Systems, Software Engineering and Security
2. Networks, layers and IP addressing
The OSI model has seven layers: physical, data link, network, transport, session, presentation and application; the TCP/IP model compresses them into four (link, internet, transport, application). A switch works at the data-link layer on MAC addresses, a router at the network layer on IP addresses, and TCP gives reliable, ordered delivery while UDP is faster and connectionless. DNS maps names to addresses, DHCP assigns them and ARP maps an IP to a MAC address.
An IPv4 address has 32 bits. A prefix of /26 leaves 32 − 26 = 6 host bits, so a subnet has 2⁶ = 64 addresses and 62 usable hosts after the network and broadcast addresses are removed; a /24 gives 254 hosts. IPv6 uses 128 bits and removes the need for address sharing. Class A, B and C are the older classful ranges (first octet 1 to 126, 128 to 191 and 192 to 223), and CIDR notation replaced them.
The OSI model has seven layers: physical, data link, network, transport, session, presentation and application; the TCP/IP model compresses them into four (link, internet, transport…
3. Operating systems: scheduling, deadlock and memory
Scheduling decides which ready process runs. For bursts of 24, 3 and 3 time units arriving together, first-come first-served gives waiting times 0, 24 and 27, a mean of 17; shortest-job-first (3, 3, 24) gives 0, 3 and 6, a mean of 3, the minimum possible; round robin with quantum 4 gives waits 6, 4 and 7, a mean of 5.67, and is fair to short jobs. Deadlock needs four conditions together: mutual exclusion, hold and wait, no pre-emption and circular wait; breaking any one prevents it.
In paging, memory is split into fixed-size frames. With a 32-bit address and 4 KB pages (12 offset bits) there are 32 − 12 = 20 page-number bits and 2²⁰ = 1,048,576 pages. The effective access time with a hit ratio h is h × t_cache + (1 − h) × t_memory: with a 90% hit ratio, 1 ns cache and 100 ns memory it is 0.9 + 10 = 10.9 ns. A page fault loads a missing page from disk; FIFO, LRU and optimal are replacement policies, and thrashing is excessive paging.
Scheduling decides which ready process runs. For bursts of 24, 3 and 3 time units arriving together, first-come first-served gives waiting times 0, 24 and 27, a mean of 17…
4. Software engineering and information security
The SDLC runs through requirements, design, coding, testing, deployment and maintenance; the waterfall model does the phases in order, iterative and agile models deliver in small cycles with feedback, and the spiral model adds risk analysis to each loop. Testing levels are unit, integration, system and acceptance; black-box testing uses inputs and outputs, white-box testing uses the code structure. Coupling should be low and cohesion high in a good design.
Information security rests on confidentiality, integrity and availability. Symmetric encryption (AES) uses one shared key and is fast; asymmetric encryption (RSA) uses a public and a private key and is used for key exchange and digital signatures, where the sender signs with the private key and anyone verifies with the public key. A hash (SHA-256) is a one-way fixed-length digest that detects change. A firewall filters traffic, phishing tricks a user into giving credentials, a man-in-the-middle attack intercepts a session, and two-factor authentication adds a second proof to a password.
The SDLC runs through requirements, design, coding, testing, deployment and maintenance; the waterfall model does the phases in order, iterative and agile models deliver in small cycles…
5. Data structures, algorithms and number systems
A stack is last-in-first-out and a queue first-in-first-out; an array gives direct access by index but costs a shift to insert in the middle, while a linked list inserts cheaply at a known place but must be walked to be searched. In a binary tree with n nodes there are n − 1 edges, and a full binary tree with L leaves has L − 1 internal nodes, so 9 leaves mean 8 internal nodes and 17 nodes in all. A tree of height h (the root at height 0) holds at most 2^(h + 1) − 1 nodes, so height 4 allows 31. A binary search tree keeps smaller keys on the left and larger on the right, so an in-order walk lists the keys in sorted order.
| Structure or algorithm | Typical cost | Remember |
|---|---|---|
| Stack push and pop; queue enqueue and dequeue | O(1) | LIFO against FIFO |
| Array access by index | O(1) | insertion in the middle is O(n) |
| Linked list search | O(n) | insertion at the head is O(1) |
| Binary search on a sorted array | O(log n) | the list must already be sorted |
| Binary search tree search | O(log n) average, O(n) worst | a skewed tree is a list |
| Hash table lookup | O(1) average | collisions need chaining or probing |
| Bubble sort | O(n²) | n(n − 1)/2 comparisons |
| Merge sort | O(n log n) | always, but needs extra space |
| Quick sort | O(n log n) average, O(n²) worst | worst case with a poor pivot |
Binary search halves a sorted list at each step and needs at most ⌊log₂ n⌋ + 1 comparisons: 1,000 items take at most 10 and 1,000,000 items at most 20, while linear search may need all n. Bubble sort makes n(n − 1)/2 comparisons in the worst case, 45 for ten items, whereas merge sort needs about n log₂ n, about 33 for ten.
Number systems. Computers store numbers in binary. Decimal 45 is 101101 (32 + 8 + 4 + 1) and 2D in hexadecimal; decimal 2,025 is 11111101001 in binary and 7E9 in hexadecimal. In an 8-bit two's complement system the range is −128 to +127 and −45 is found by inverting 00101101 to 11010010 and adding 1, which gives 11010011. A postfix expression is evaluated with a stack: for 5 3 + 2 × the stack holds 8 after the addition and 16 after the multiplication, the same as the infix (5 + 3) × 2.
A stack is last-in-first-out and a queue first-in-first-out; an array gives direct access by index but costs a shift to insert in the middle, while a linked list inserts cheaply at a known…
Second Pass: Subnet Hosts, Offset Bits, FCFS Order, Tree Height and Layers
A /n IPv4 prefix leaves 32 − n host bits, so usable hosts are 2^(32 − n) − 2. A 4 KB page has a 12-bit offset. Under first-come first-served scheduling the order of arrival changes the mean waiting time sharply. A complete binary tree of 15 nodes has levels 1 + 2 + 4 + 8, so its height is 3 edges. HAVING filters groups after GROUP BY, while WHERE filters rows before.
| Item | Working | Answer |
|---|---|---|
| /27 subnet | 2⁵ − 2 | 30 hosts |
| 4 KB page | 2¹² | 12 offset bits |
| FCFS bursts 3, 3, 24 | waits 0, 3, 6 | mean 3 |
| FCFS bursts 24, 3, 3 | waits 0, 24, 27 | mean 17 |
A /n IPv4 prefix leaves 32 − n host bits, so usable hosts are 2^(32 − n) − 2. A 4 KB page has a 12-bit offset. Under first-come first-served scheduling the order of arrival changes the mean…
Key takeaways
- Primary and foreign keys give integrity; normal forms remove redundancy (2NF partial, 3NF transitive dependence); DELETE can be rolled back, TRUNCATE and DROP differ.
- A /n IPv4 prefix leaves 32 − n host bits: 2^(32−n) addresses and two fewer usable hosts.
- Shortest-job-first minimises mean waiting time; deadlock needs mutual exclusion, hold and wait, no pre-emption and circular wait together.
- Symmetric encryption is fast with one key; asymmetric uses a key pair for exchange and signatures; a hash detects change.
- A full binary tree with L leaves has L − 1 internal nodes; binary search needs at most ⌊log₂ n⌋ + 1 comparisons; bubble sort makes n(n − 1)/2 comparisons in the worst case; in 8-bit two's complement −45 is 11010011.
Practice questions (26)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
A subnet uses the prefix /26 in IPv4. The number of usable host addresses is:
Show answer
Answer: A — 62
The /26 prefix leaves 6 host bits, so 2⁶ = 64 addresses, of which the first (network) and last (broadcast) cannot be assigned to hosts, leaving 62. A /27 gives 30 and a /25 gives 126.Which device forwards frames using MAC addresses at the data-link layer?
Show answer
Answer: A — a switch
A switch learns which MAC address lies behind each port and forwards a frame only there. A router works at the network layer on IP addresses, and a repeater simply regenerates a signal at the physical layer.Three processes with CPU bursts of 24, 3 and 3 units arrive together. The mean waiting time under first-come first-served in that order, and under shortest-job-first, are:
Show answer
Answer: A — 17 and 3
Under FCFS the waits are 0, 24 and 27, a mean of 51 ÷ 3 = 17. Running the short jobs first gives waits 0, 3 and 6, a mean of 3. SJF minimises mean waiting time, and the long job makes FCFS suffer the convoy effect.
Show the other 23 questions
Which set of four conditions must all hold for a deadlock to occur?
Show answer
Answer: A — mutual exclusion, hold and wait, no pre-emption, circular wait
The four Coffman conditions are mutual exclusion, hold and wait, no pre-emption and circular wait. Preventing any one of them prevents deadlock. The other sets are the ACID properties and the security goals.A system has 32-bit addresses and 4 KB pages. The number of bits in the page number is:
Show answer
Answer: A — 20
A 4 KB page needs 12 bits (2¹² = 4,096) for the offset, so 32 − 12 = 20 bits remain for the page number, giving 2²⁰ pages. The 12 is the offset width and not the page-number width.A cache with a 90% hit ratio has an access time of 1 ns, and main memory takes 100 ns on a miss. The effective access time, ignoring the cache check on a miss, is:
Show answer
Answer: A — 10.9 ns
Effective time = 0.9 × 1 + 0.1 × 100 = 0.9 + 10 = 10.9 ns. Weighting the other way round (0.1 × 1 + 0.9 × 100) gives the wrong 90.1 ns, which is the usual slip.A relation is in third normal form (3NF) when it is in 2NF and has no:
Show answer
Answer: A — transitive dependence of a non-key attribute on the key
3NF removes transitive dependence, where a non-key attribute depends on another non-key attribute that depends on the key. 2NF removes partial dependence on part of a composite key. Keys are not removed by normalisation.In public-key digital signatures, the sender signs a message with the sender's:
Show answer
Answer: A — private key
Only the sender holds the private key, so a signature made with it proves origin, and anyone can check it with the matching public key. Encryption for confidentiality uses the receiver's public key instead.A sorted list of 1,000 items is searched with binary search. The greatest number of comparisons needed is:
Show answer
Answer: A — 10
Binary search needs at most ⌊log₂ 1000⌋ + 1 = 9 + 1 = 10 comparisons, since 2⁹ = 512 < 1000 < 1024 = 2¹⁰. Nine would be the integer part alone, and 500 is the average for a linear search.The greatest number of comparisons bubble sort makes on a list of 12 items is:
Show answer
Answer: A — 66
The worst case is n(n − 1) ÷ 2 = 12 × 11 ÷ 2 = 66. The figure 132 forgets to halve, and 144 is n².A full binary tree has 9 leaves. The number of internal nodes, and of nodes in all, are:
Show answer
Answer: A — 8 and 17
A full binary tree has L − 1 internal nodes, here 9 − 1 = 8, so the total is 9 + 8 = 17. The pair 9 and 18 confuses leaves with internal nodes.In an 8-bit two's complement system, the representation of −45 is:
Show answer
Answer: A — 11010011
Write +45 as 00101101, invert every bit to 11010010 and add 1 to get 11010011. The option 11010010 is only the one's complement, 00101101 is +45 itself, and 10101101 is the sign-and-magnitude form of −45.A subnet is defined by the prefix /27 in IPv4. The number of usable host addresses is:
Show answer
Answer: A — 30
There are 32 − 27 = 5 host bits, so 2⁵ = 32 addresses, of which the network and broadcast addresses are not usable, leaving 30.In SQL, the clause used to filter groups after a GROUP BY is applied is:
Show answer
Answer: A — HAVING
HAVING applies conditions to aggregated groups, for example HAVING COUNT(*) > 5, whereas WHERE filters individual rows before grouping.A system with 4 KB pages uses byte addresses. The number of bits in the page offset is:
Show answer
Answer: A — 12
A 4 KB page has 4,096 = 2¹² bytes, so 12 bits address a byte within the page. The remaining address bits form the page number.Three processes with CPU bursts of 3, 3 and 24 units arrive together in that order under first-come first-served scheduling. The mean waiting time is:
Show answer
Answer: A — 3
The waits are 0, 3 and 6, so the mean is 9/3 = 3 units. In the order 24, 3, 3 the mean would be 17.A complete binary tree has 15 nodes. Its height, counted in edges from the root to the deepest leaf, is:
Show answer
Answer: A — 3
The levels hold 1, 2, 4 and 8 nodes, totalling 15, so there are four levels and the height is 3 edges. Counting levels instead of edges gives 4.Consider the following statements:
1. The ACID properties of a transaction are atomicity, consistency, isolation and durability.
2. The OSI model has seven layers, and the transport layer is where TCP and UDP operate.
Which is/are correct?Show answer
Answer: A — Both 1 and 2
Both are standard definitions: ACID names the four transaction guarantees and the transport layer is layer 4 of the seven-layer OSI model. Both statements are correct.The SQL query SELECT DISTINCT dept FROM emp returns:
Show answer
Answer: C — Each department value once, with duplicates removed
DISTINCT removes duplicate values from the result. COUNT would give the number of departments, which is the tempting confusion.A table is in first normal form (1NF) when:
Show answer
Answer: A — Every attribute holds only atomic (indivisible) values
1NF requires atomic values with no repeating groups. Partial dependency is removed in 2NF, transitive in 3NF and determinant-key in BCNF, the tempting later forms.For the page reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 under FIFO replacement, the numbers of page faults with 3 and with 4 frames are respectively:
Show answer
Answer: C — 9 and 10
Simulating FIFO gives 9 faults with 3 frames and 10 faults with 4 frames, the classic Belady's anomaly in which more frames cause more faults. 10 and 9 is the expected-but-wrong order.A /24 network is divided into 4 equal subnets. The subnet mask becomes:
Show answer
Answer: D — 255.255.255.192
Four subnets need 2 more bits, giving /26, whose last octet is 11000000 = 192. The mask 128 (/25) gives only two subnets, the tempting under-division.Which transport-layer protocol is connectionless and does not guarantee delivery?
Show answer
Answer: C — UDP
UDP is connectionless and unreliable but fast. TCP gives reliable, ordered delivery. HTTP and FTP are application-layer protocols, which are the tempting wrong options.Consider the following statements:
1. Breadth-first search uses a queue.
2. Depth-first search uses a stack, explicit or through recursion.
Which of the statements given above is/are correct?Show answer
Answer: A — Both 1 and 2
BFS visits level by level with a queue and DFS goes deep with a stack. Swapping the two structures is the tempting error.A hash table of size 7 uses h(k) = k mod 7. The key 52 is stored at index:
Show answer
Answer: B — 3
52 = 7 × 7 + 3, so 52 mod 7 = 3. Check: 49 + 3 = 52. Index 7 is out of range for a table of size 7, where indices run from 0 to 6.The hexadecimal number 2F equals which decimal number?
Show answer
Answer: D — 47
2F = 2 × 16 + 15 = 47. Check: 47 = 32 + 15. Reading F as 16 gives the tempting 48.