This commit is contained in:
Miloslav Ciz 2024-05-13 17:20:02 +02:00
parent 6240f0edf2
commit fc95f9c631
11 changed files with 1777 additions and 1759 deletions

View file

@ -176,7 +176,8 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
73. A nudist is lying completely horizontally on a beach with his dick pointed up towards the sky when a hot 16 year old jailbait walks by and he gets an erection, the sun is shining under the angle 20 degrees (measured from horizon), his dick is now pointed up completely vertically and casts a shadow that reaches up to his feet, i.e. the shadow (completely horizontal) has a length of 60 cm. How long is his dick (with erection)?
74. If your computer resides in a private network that's connected to the Internet through a router that performs network address translation ([NAT](nat.md), common with many ISPs), why you typically cannot host a server that would be publicly accessible from the outside [Internet](internet.md)? I.e. explain how NAT works and say what's preventing outside computers from reaching your server behind it. How can you make your server work even behind NAT?
75. We know that in C (C99) we can kind of use arrays and pointers "interchangeably", we are taught they are really the same. However show at least one example of when the difference matters, i.e. considering e.g. `int *a;` vs `int a[N];` write some expressions with `a` in it where the distinction will be significant.
76. Did you enjoy this quiz?
76. Write sed substitution command (the one that starts with `s/`) that will convert Markdown links (format: `[link text](destination)`) to HTML links (format: `<a href="destination">link text</a>`). You probably need [regular expression](regex.md) capture groups for this.
77. Did you enjoy this quiz?
### Answers
@ -255,7 +256,8 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
73. From the right triangle: *dick_legth / shadow_length = tan(20 degrees) => dick_legth = tan(20 degrees) * shadow_length ~= 21.83 cm*.
74. Behind NAT you're in a private network, computers inside it have no public addresses (their IP addresses are in the private range and potentially same as addresses of computers in other private networks), only the router has a public IP address that's unique within the Internet, i.e. from Internet's point of view there is only one device connected -- your router. Computers behind this router are invisible, so no one can connect to the server that's behind it. The possibility of you having a two way communication from within this private network with the outside Internet is enabled by the router who communicates for you when you ask for it, i.e. when you (from inside the private network) initiate the connection -- the router then creates the connection for you and talks to the outside world for you (translating your private address to its public address, hence *network address translation*). But no one can initiate communication from the outside, the router wouldn't know to whom he wants to speak. This can be solved e.g. by port forwarding (setting some default computer to which communication from outside will be redirected) or tunneling (keeping a constant connection with some outside proxy server that's listening to requests and resending them).
75. For example `sizeof(a)`: if `a` is a pointer, size of pointer will be returned whereas in case of array the size of the whole array will be returned. Similarly e.g. `&a`: if `a` is a pointer, we'll get a pointer to pointer (generally a different address) whereas in case of array `a` and `&a` gives the same address -- that of the array's first element (though the type will be different).
76. yes
76. Something like `s/\[\([^]]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g`.
77. yes
## Other