All courses › Databases, Networks and Security

Databases, Networks and Security: free practice, theory and problems

Almost every app stores its data in a database: users, orders, measurements. A relational database stores data in tables, and you fetch exactly what you need with the query language SQL.

3 parts35 problems9 concepts explainedPractice examFree
Start practising for free →

Contents

  1. Relational databases and SQL
  2. IP networks and subnetting
  3. Cyber security

1. Relational databases and SQL

What is it about?

Almost every app stores its data in a database: users, orders, measurements. A relational database stores data in tables, and you fetch exactly what you need with the query language SQL.

Concepts and formulas

SELECT columns FROM table WHERE condition ORDER BY column;
SELECT s.name, e.course FROM Student s JOIN Exam e ON e.student_id = s.id;

How to solve the problems

  1. Read FROM first (which table), then WHERE (which rows), then SELECT (what is shown).
  2. Go through the rows one by one and check the condition.
  3. Apply the aggregate function to the remaining rows.

Example

The table Employee has the salaries 520,000, 610,000, 480,000 and 700,000. What does SELECT COUNT(*) FROM Employee WHERE salary > 500000; give?

  1. The rows with salary above 500,000: 520,000, 610,000 and 700,000.
  2. COUNT(*) counts them: the result is 3.

Common mistakes

FROM → WHERE → GROUP BY → SELECT → ORDER BY. Primary key identifies, foreign key links.

Concepts in this part

Practise relational databases and SQL in the app →

2. IP networks and subnetting

What is it about?

Everything connected to the internet has an IP address. To split a network into smaller parts, for example one for the office and one for production, you use subnetting. You also need to calculate how long it takes to send data.

Concepts and formulas

232−p−22^{32-p} - 2

because the network address (first) and the broadcast address (last) cannot be used by machines.

How to solve the problems

  1. Hosts: compute 232−p−22^{32-p} - 2.
  2. Network address: block size 232−p2^{32-p}, divide the last octet by it and round down.
  3. Time: convert MB to bits (⋅8\cdot 8) before dividing by Mbit/s.

Example

How long does it take to download 100 MB at 50 Mbit/s?

  1. 100 MB=800100\ \text{MB} = 800 Mbit.
  2. t=800/50=16t = 800/50 = 16 s.

Common mistakes

Hosts = 2^(32−p) − 2. Bytes × 8 = bits.

Concepts in this part

Practise iP networks and subnetting in the app →

3. Cyber security

What is it about?

Every engineer needs basic cyber security: data must be kept secret, not changed behind your back, and be available when needed. Many attacks start with a weak password or a tricked user.

Concepts and formulas

H=L⋅log⁡2NH = L\cdot\log_2 N

How to solve the problems

  1. Entropy: multiply the length by log⁡2\log_2 of the number of possible characters.
  2. Cracking time: compute NLN^L and divide by guesses per second, then convert to a suitable unit.

Example

A password of 8 lowercase letters (26 possible characters):

  1. H=8⋅log⁡226≈8⋅4.70=37.6H = 8\cdot\log_2 26 \approx 8\cdot 4.70 = 37.6 bits.
  2. 268≈2.1⋅101126^8 \approx 2.1\cdot 10^{11} possibilities. At 101010^{10} guesses per second, all are tried in under half a minute.

Common mistakes

Strength = length × log₂(number of characters). Length beats complexity.

Concepts in this part

Practise cyber security in the app →

Example problems with solutions

Here are some of the problems in databases, Networks and Security. In the app, calculation problems get new numbers every time, so you can practise until it sticks – and take a graded practice exam before the real one.

Relational databases and SQL: What is a primary key in a table?

Answer: A column that identifies each row uniquely

The primary key is unique and never empty, so each row can be found unambiguously. A column pointing to another table is a foreign key.

IP networks and subnetting: How many usable host addresses does a /26 network have?

Answer: 62

232−26−2=64−2=622^{32-26} - 2 = 64 - 2 = 62.

Cyber security: How many bits of entropy does a random password of 8 lowercase letters (26 possible characters) have?

Answer: 37.604 bit

H=8⋅log⁡226≈8⋅4.70=37.6H = 8\cdot\log_2 26 \approx 8\cdot 4.70 = 37.6 bits.

Relational databases and SQL: The table Employee has the salaries 520,000, 610,000, 480,000 and 700,000. What does the query return?
SELECT COUNT(*) FROM Employee WHERE salary > 500000;

Answer: 3

The rows above 500,000 are 520,000, 610,000 and 700,000. COUNT(*) gives 3.

Practise all the problems →

Matches these university courses

The content covers the syllabus found in engineering degrees, for example: