Update
This commit is contained in:
parent
e973c9d271
commit
cbedf57724
16 changed files with 1912 additions and 1886 deletions
198
exercises.md
198
exercises.md
|
@ -148,54 +148,57 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
|
|||
44. A [woman](woman.md) gave birth to two sons in the span of a single hour, i.e. they are of the same age, but they aren't twins. How is this possible?
|
||||
45. Name at least two TCP/IP or OSI [network](network.md) layers: about each shortly explain its purpose, addressing and at least one protocol of this layer.
|
||||
46. We know [HTTPS](https.md) is shit because it's [encrypted](encryption.md) and requires [certificates](certificate.md). Explain what these certificates are, why HTTPS needs them, how their absence could be "abused" and who issues them.
|
||||
47. We have two barrels, one with water, one with wine, each having the same amount of liquid. We take a cup, fill it with water from the water barrel, pour it over to the wine barrel, mix it up, and then we fill the same cup with this mixture of water and wine from this barrel and pour it back to the water barrel. Both barrels now have the same amount of liquid again, but the liquids are mixed. What percentage of water is in the water barrel and what percentage of wine is in the wine barrel? Find a general formula for a cup of any size.
|
||||
48. In context of programming languages explain the difference between *[lvalue](lvalue.md)* and *[rvalue](rvalue.md)* -- Where do they appear? What are they? How do they differ and what conditions are placed on each? Also place each of the following expressions under these categories (i.e. say which are lvalues, rvalues or both; details may depend on programming language, so just comment on that): `123`, `someVariable + 123`, `someArray[20]`, `*(somePointer + 4)`, `someVariable`.
|
||||
49. Which star is the closest to [Earth](earth.md)?
|
||||
50. A symmetric [relation](relation.md) is that for it hold that if A is in relation with B, then also B is in relation with A (for example "is married to"). Antisymmetric relation is that for which it holds that if A is in relation with B and A is distinct from B, then B is NOT in relation with A (for example "is parent of"). Give an example of relation that is both symmetric and antisymmetric.
|
||||
51. Is [LGBT](lgbt.md) [good](good.md)?
|
||||
52. Write a [C](c.md) function in 60 characters or fewer that takes a string (`char *`, consider zero terminated ASCII string) and replaces all semicolons in it with colons (`;` -> `:`). It can return nothing (`void`).
|
||||
53. Order the following [people](people.md) by date of their birth from oldest: [Alan Turing](turing.md), Caesar, [Buddha](buddha.md) (Siddhartha Gautama), Johannes Gutenberg, Aristotle, [Charles Babbage](babbage.md), [Linus Torvalds](torvalds.md), [Jesus](jesus.md), [Adolf Hitler](hitler.md), Muhammad (prophet of Islam), [Albert Einstein](einstein.md), [Richard Stallman](rms.md), Napoleon, Leonardo da Vinci, [Karl Marx](marx.md).
|
||||
54. Start with number 967; in each step you can either add all the digits (e.g. 456 -> 4 + 5 + 6 = 15), multiply all the digits (e.g. 45 -> 4 * 5 -> 20) or shuffle the digits in any way (e.g. 320 -> 23); your goal is to get to number 3. { This one is mine. ~drummyfish }
|
||||
55. State at least 5 reasons for why [Rust](rust.md) sucks so much.
|
||||
56. Find at least one function *f(x)* that's defined for all non-negative integers and for which it holds that *x + f(x) - f(x + 1) = 0*. (It's enough if you show a sequence of numbers with obvious continuation.)
|
||||
57. What do we call a program that prints its own source code?
|
||||
58. You receive a 1 bit (black&white) image of 8x8 resolution encoded as hexadecimal string 0xf91919ffff98989f. The string encodes consecutive rows of pixels from top to bottom, each pixel with 1 bit. What does the image show?
|
||||
59. Show (even just geometrically) that for EVERY right triangle if we draw a circle going through all its vertices, the triangle's hypotenuse (longest side) will be the circle's diameter and the circle's center will lie in the middle of the hypotenuse.
|
||||
60. What was the name of the computer that first beat the world [chess](chess.md) champion in an official match and in which year, with tolerance plus/minus 2, did it happen?
|
||||
61. Consider the following set of numbers: 416, 81, 82, 69, 94, 28, 785, 44. Which of the following numbers belongs among them: 609, 11, 436, 88, 61 or 325?
|
||||
62. As a programmer how would you represent a [set](set.md) that may contain integer numbers from 1 to 32 (including both)? What's the minimum number of bits you will need for storing this set? Additionally, how would you implement a multiset? I.e. what if you wanted to further allow any number in the set to potentially be present more than once (you can suppose an upper limit for this count at 255)? How many bits will you need then? Hint: set is much different from a list, for example order of its members doesn't matter.
|
||||
63. What's heavier, 20 kilograms of black hole or 30 kilograms of nothing?
|
||||
64. We have a village of 27 people; in upcoming elections 17 want to vote for candidate A and 10 for candidate B. People will be divided into 3 districts, each with 9 people -- in each district one candidate will be picked by majority of votes, and then the candidate who wins in most districts will win the elections. Sort people into districts so that candidate B wins.
|
||||
65. Some rich faggot got himself a house with opening roof -- it's a flat roof that after a button press will start to slide and so enlarge the hole in the roof linearly from 0 to 10 m^2 over 10 seconds. Closing is the same, just in opposite direction. Some idiot pressed the button during rain, the roof is opening and it's raining in the house all over his stereo and home cinema, he will close the roof but he can only do it once it has opened completely (so it will be raining inside for 20 seconds). The rain's intensity is such that 1 m^2 of area catches 1 litre of water in 1 second. When the roof has closed, how much water has poured into the room?
|
||||
66. Please tell me why a human without pressure suit diving under water to great depth will be rekt to pieces by the pressure while a small fish made out of jello is just fine under that enormous pressure.
|
||||
67. Rewrite the following snippet so that it [doesn't perform any branching](branchless.md): `if (a > 10) a += 16; else a += 4;`. Watch out, you can't use the ternary operator (`a += a > 10 ? 16 : 4;`) because that's typically just a syntax sugar for a branch.
|
||||
68. [Elon Musk's](elon_musk.md) net worth is about 200 billion USD, suppose he spends all his net worth on $1 prostitutes, how many times to the Moon and back would they reach? Suppose the length of a [woman](woman.md) with stretched arms is 2 meters, distance to the Moon 380000 km and neglect the fact that there are only 8 billion people on Earth. Also considering cost of normal living to be $30 per day and average life span 70 years how many lifetimes could he live off of this fortune?
|
||||
69. Say we have a square digital image, i.e. a grid of pixels of resolution *N x N*. We want to scale it down to *N/2 x N/2*. For this we could subdivide the image into 2x2 blocks and out of each block take only one pixel, for example the top left one, discarding the three other pixels. However there is a danger in doing this -- for example downscaling a black and white [dithering](dithering.md) pattern (a kind of checker board) this way would result in either a completely black or completely white image, drastically changing the overall brightness of the whole image! What's this problem called and how could we prevent it?
|
||||
70. Give numeric answers to queries that will follow, then compute average error against each correct answer; you want an error not greater than 3. Number of essential software freedoms defined by GNU. Year when Creative Commons non-profit was established. PDP 10 word size divided by 5 (use integer division). Century (its one-based sequential number) in which Western Roman Empire officially ended (lost its last emperor). Century in which [Nikola Tesla](tesla.md) was born. Year when first man set foot on the Moon.
|
||||
71. You've probably seen a game freeze and become unresponsive and then you likely heard audio get stuck too in a weird way: a short piece of sound is just played over and over like a broken vinyl record. Why does this happen? How and WHY is audio typically implemented here?
|
||||
72. Mention at least one advantage and one disadvantage of using [matrices](matrix.md) to represent transformations in 3D engines.
|
||||
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. 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. Give at least three examples of palindromic English words (written the same forward and backwards), each at least four letters long.
|
||||
78. Six extremely obese [women](woman.md) ([Rust](rust.md) developers) -- three normal and three lesbian -- want to get to a party that's in the sixth floor of a building. As they are morbidly obese using stairs is not an option, they have to take the lift. The lift is on the ground floor but its outside button is broken, it can only ride if there is at least one human inside it who controls it (and it also doesn't go to any other floor than the two), but it also cannot carry more than two women at once (remember, they are obese). Lesbian must never outnumber the normal women otherwise they wouldn't be able to control themselves and would rape them. The women are too dumb to solve the problem of how to get to the sixth floor without any rape happening, they call you to help them -- find a solution to this.
|
||||
79. Does 0.999... (infinitely many 9s) equal 1?
|
||||
80. If [capitalism](capitalism.md) is bad why are people migrating into capitalist countries such as [USA](usa.md)?
|
||||
81. Why are low quality videos "blocky"?
|
||||
82. What's the next number in the following sequence? 0, 1, 5, 19, 65, 211, 665, 2059, 6305, 19171, 58052, ???
|
||||
83. Programming language specifications sometimes purposefully leave some behavior undefined -- for example [C](c.md) specification says that if you declare a local variable (variable inside a function), its initial value is undefined, even though the specification could have simply said the value of such variable has to be always zero which might be safer for programmers. Why do specifications purposefully choose to leave some things undefined like this?
|
||||
84. What does [GNU](gnu.md) (Richard Stallman's project) stand for?
|
||||
85. Is political correctness and censorship ever justified?
|
||||
86. Firstly convert the expression *x + (1 + 2) / (3 - 4)* to [postfix notation](postfix.md) (also reverse Polish notation). State some major advantages of postfix notation against infix notation. Now please state disadvantage of postfix notation, especially that which would be significant if we e.g. use it for expression such as *myFunc(x,y,myFunc2(z))*.
|
||||
87. What does the [demultiplexer](demultiplexer.md) logic circuit do? Give an example of when it's used. How is it related to [multiplexer](multiplexer.md)?
|
||||
88. [Optical fiber](optical_fiber.md) cabels mustn't be bent too much -- one reason for this is that the fibers inside might crack, but another reason is related to the physics of how the light travels inside. What is this effect of optics called and why does it limit the bend radius?
|
||||
89. We know that an [ellipse](ellipse.md) is a set of points in 2D plane that have constant sum of [distances](distance.md) to some two given points that are called *focal points*. What if we instead consider a taxicab distance (computed as distance alongside X axis plus distance alongside Y axis)? Consider the constant sum of distances to always be set higher than the taxicab distance of the two focal points. What shape will we get? Just describe the shape and intuitively show why it looks like that.
|
||||
90. What does [Turing tarpit](turing_tarpit.md) mean?
|
||||
91. =fgtnmtg qlcowj jakju lm vglcnr gjv dm gocl gjv qk vcjU
|
||||
92. Please solve the following inequality: *sin(2 * x) / (2 - 2 * sin^2(x)) - log2(1 / 8^(-1/3)) >= 0*, mathematically write exactly which values of *x* will satisfy it. Don't use calculator, ok? But you can look up goniometric formulas etc.
|
||||
93. Given continuous differentiable function *f(x)*, derive the formula for computing the length of the curve of the function graph on interval *[x1,x2]*. No need to provide 100% formal proofs, you can use intuition as long as you get the correct formula and show it works on a few examples. For example the length of the graph of function *f(x) = x* on interval *[0,1]* will be *sqrt(2)* (holds from Pythagorean theorem). Compute the length of curve of the graph of *f(x) = sin(x)* on interval *[0,2 * pi]*.
|
||||
94. Did you enjoy this quiz?
|
||||
47. What's the next number in this series: 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3?
|
||||
48. We have two barrels, one with water, one with wine, each having the same amount of liquid. We take a cup, fill it with water from the water barrel, pour it over to the wine barrel, mix it up, and then we fill the same cup with this mixture of water and wine from this barrel and pour it back to the water barrel. Both barrels now have the same amount of liquid again, but the liquids are mixed. What percentage of water is in the water barrel and what percentage of wine is in the wine barrel? Find a general formula for a cup of any size.
|
||||
49. In context of programming languages explain the difference between *[lvalue](lvalue.md)* and *[rvalue](rvalue.md)* -- Where do they appear? What are they? How do they differ and what conditions are placed on each? Also place each of the following expressions under these categories (i.e. say which are lvalues, rvalues or both; details may depend on programming language, so just comment on that): `123`, `someVariable + 123`, `someArray[20]`, `*(somePointer + 4)`, `someVariable`.
|
||||
50. Which star is the closest to [Earth](earth.md)?
|
||||
51. A symmetric [relation](relation.md) is that for it hold that if A is in relation with B, then also B is in relation with A (for example "is married to"). Antisymmetric relation is that for which it holds that if A is in relation with B and A is distinct from B, then B is NOT in relation with A (for example "is parent of"). Give an example of relation that is both symmetric and antisymmetric.
|
||||
52. Is [LGBT](lgbt.md) [good](good.md)?
|
||||
53. Write a [C](c.md) function in 60 characters or fewer that takes a string (`char *`, consider zero terminated ASCII string) and replaces all semicolons in it with colons (`;` -> `:`). It can return nothing (`void`).
|
||||
54. Order the following [people](people.md) by date of their birth from oldest: [Alan Turing](turing.md), Caesar, [Buddha](buddha.md) (Siddhartha Gautama), Johannes Gutenberg, Aristotle, [Charles Babbage](babbage.md), [Linus Torvalds](torvalds.md), [Jesus](jesus.md), [Adolf Hitler](hitler.md), Muhammad (prophet of Islam), [Albert Einstein](einstein.md), [Richard Stallman](rms.md), Napoleon, Leonardo da Vinci, [Karl Marx](marx.md).
|
||||
55. Start with number 967; in each step you can either add all the digits (e.g. 456 -> 4 + 5 + 6 = 15), multiply all the digits (e.g. 45 -> 4 * 5 -> 20) or shuffle the digits in any way (e.g. 320 -> 23); your goal is to get to number 3. { This one is mine. ~drummyfish }
|
||||
56. State at least 5 reasons for why [Rust](rust.md) sucks so much.
|
||||
57. Find at least one function *f(x)* that's defined for all non-negative integers and for which it holds that *x + f(x) - f(x + 1) = 0*. (It's enough if you show a sequence of numbers with obvious continuation.)
|
||||
58. What do we call a program that prints its own source code?
|
||||
59. You receive a 1 bit (black&white) image of 8x8 resolution encoded as hexadecimal string 0xf91919ffff98989f. The string encodes consecutive rows of pixels from top to bottom, each pixel with 1 bit. What does the image show?
|
||||
60. Show (even just geometrically) that for EVERY right triangle if we draw a circle going through all its vertices, the triangle's hypotenuse (longest side) will be the circle's diameter and the circle's center will lie in the middle of the hypotenuse.
|
||||
61. What was the name of the computer that first beat the world [chess](chess.md) champion in an official match and in which year, with tolerance plus/minus 2, did it happen?
|
||||
62. Consider the following set of numbers: 416, 81, 82, 69, 94, 28, 785, 44. Which of the following numbers belongs among them: 609, 11, 436, 88, 61 or 325?
|
||||
63. As a programmer how would you represent a [set](set.md) that may contain integer numbers from 1 to 32 (including both)? What's the minimum number of bits you will need for storing this set? Additionally, how would you implement a multiset? I.e. what if you wanted to further allow any number in the set to potentially be present more than once (you can suppose an upper limit for this count at 255)? How many bits will you need then? Hint: set is much different from a list, for example order of its members doesn't matter.
|
||||
64. What's heavier, 20 kilograms of black hole or 30 kilograms of nothing?
|
||||
65. We have a village of 27 people; in upcoming elections 17 want to vote for candidate A and 10 for candidate B. People will be divided into 3 districts, each with 9 people -- in each district one candidate will be picked by majority of votes, and then the candidate who wins in most districts will win the elections. Sort people into districts so that candidate B wins.
|
||||
66. Some rich faggot got himself a house with opening roof -- it's a flat roof that after a button press will start to slide and so enlarge the hole in the roof linearly from 0 to 10 m^2 over 10 seconds. Closing is the same, just in opposite direction. Some idiot pressed the button during rain, the roof is opening and it's raining in the house all over his stereo and home cinema, he will close the roof but he can only do it once it has opened completely (so it will be raining inside for 20 seconds). The rain's intensity is such that 1 m^2 of area catches 1 litre of water in 1 second. When the roof has closed, how much water has poured into the room?
|
||||
67. Please tell me why a human without pressure suit diving under water to great depth will be rekt to pieces by the pressure while a small fish made out of jello is just fine under that enormous pressure.
|
||||
68. Rewrite the following snippet so that it [doesn't perform any branching](branchless.md): `if (a > 10) a += 16; else a += 4;`. Watch out, you can't use the ternary operator (`a += a > 10 ? 16 : 4;`) because that's typically just a syntax sugar for a branch.
|
||||
69. [Elon Musk's](elon_musk.md) net worth is about 200 billion USD, suppose he spends all his net worth on $1 prostitutes, how many times to the Moon and back would they reach? Suppose the length of a [woman](woman.md) with stretched arms is 2 meters, distance to the Moon 380000 km and neglect the fact that there are only 8 billion people on Earth. Also considering cost of normal living to be $30 per day and average life span 70 years how many lifetimes could he live off of this fortune?
|
||||
70. Say we have a square digital image, i.e. a grid of pixels of resolution *N x N*. We want to scale it down to *N/2 x N/2*. For this we could subdivide the image into 2x2 blocks and out of each block take only one pixel, for example the top left one, discarding the three other pixels. However there is a danger in doing this -- for example downscaling a black and white [dithering](dithering.md) pattern (a kind of checker board) this way would result in either a completely black or completely white image, drastically changing the overall brightness of the whole image! What's this problem called and how could we prevent it?
|
||||
71. Give numeric answers to queries that will follow, then compute average error against each correct answer; you want an error not greater than 3. Number of essential software freedoms defined by GNU. Year when Creative Commons non-profit was established. PDP 10 word size divided by 5 (use integer division). Century (its one-based sequential number) in which Western Roman Empire officially ended (lost its last emperor). Century in which [Nikola Tesla](tesla.md) was born. Year when first man set foot on the Moon.
|
||||
72. You've probably seen a game freeze and become unresponsive and then you likely heard audio get stuck too in a weird way: a short piece of sound is just played over and over like a broken vinyl record. Why does this happen? How and WHY is audio typically implemented here?
|
||||
73. Mention at least one advantage and one disadvantage of using [matrices](matrix.md) to represent transformations in 3D engines.
|
||||
74. 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)?
|
||||
75. 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?
|
||||
76. 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.
|
||||
77. 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.
|
||||
78. Give at least three examples of palindromic English words (written the same forward and backwards), each at least four letters long.
|
||||
79. Six extremely obese [women](woman.md) ([Rust](rust.md) developers) -- three normal and three lesbian -- want to get to a party that's in the sixth floor of a building. As they are morbidly obese using stairs is not an option, they have to take the lift. The lift is on the ground floor but its outside button is broken, it can only ride if there is at least one human inside it who controls it (and it also doesn't go to any other floor than the two), but it also cannot carry more than two women at once (remember, they are obese). Lesbian must never outnumber the normal women otherwise they wouldn't be able to control themselves and would rape them. The women are too dumb to solve the problem of how to get to the sixth floor without any rape happening, they call you to help them -- find a solution to this.
|
||||
80. Does 0.999... (infinitely many 9s) equal 1?
|
||||
81. If [capitalism](capitalism.md) is bad why are people migrating into capitalist countries such as [USA](usa.md)?
|
||||
82. Why are low quality videos "blocky"?
|
||||
83. What's the next number in the following sequence? 0, 1, 5, 19, 65, 211, 665, 2059, 6305, 19171, 58052, ???
|
||||
84. Programming language specifications sometimes purposefully leave some behavior undefined -- for example [C](c.md) specification says that if you declare a local variable (variable inside a function), its initial value is undefined, even though the specification could have simply said the value of such variable has to be always zero which might be safer for programmers. Why do specifications purposefully choose to leave some things undefined like this?
|
||||
85. What does [GNU](gnu.md) (Richard Stallman's project) stand for?
|
||||
86. Is political correctness and censorship ever justified?
|
||||
87. Firstly convert the expression *x + (1 + 2) / (3 - 4)* to [postfix notation](postfix.md) (also reverse Polish notation). State some major advantages of postfix notation against infix notation. Now please state disadvantage of postfix notation, especially that which would be significant if we e.g. use it for expression such as *myFunc(x,y,myFunc2(z))*.
|
||||
88. What does the [demultiplexer](demultiplexer.md) logic circuit do? Give an example of when it's used. How is it related to [multiplexer](multiplexer.md)?
|
||||
89. [Optical fiber](optical_fiber.md) cabels mustn't be bent too much -- one reason for this is that the fibers inside might crack, but another reason is related to the physics of how the light travels inside. What is this effect of optics called and why does it limit the bend radius?
|
||||
90. We know that an [ellipse](ellipse.md) is a set of points in 2D plane that have constant sum of [distances](distance.md) to some two given points that are called *focal points*. What if we instead consider a taxicab distance (computed as distance alongside X axis plus distance alongside Y axis)? Consider the constant sum of distances to always be set higher than the taxicab distance of the two focal points. What shape will we get? Just describe the shape and intuitively show why it looks like that.
|
||||
91. What does [Turing tarpit](turing_tarpit.md) mean?
|
||||
92. =fgtnmtg qlcowj jakju lm vglcnr gjv dm gocl gjv qk vcjU
|
||||
93. Please solve the following inequality: *sin(2 * x) / (2 - 2 * sin^2(x)) - log2(1 / 8^(-1/3)) >= 0*, mathematically write exactly which values of *x* will satisfy it. Don't use calculator, ok? But you can look up goniometric formulas etc.
|
||||
94. Given continuous differentiable function *f(x)*, derive the formula for computing the length of the curve of the function graph on interval *[x1,x2]*. No need to provide 100% formal proofs, you can use intuition as long as you get the correct formula and show it works on a few examples. For example the length of the graph of function *f(x) = x* on interval *[0,1]* will be *sqrt(2)* (holds from Pythagorean theorem). Compute the length of curve of the graph of *f(x) = sin(x)* on interval *[0,2 * pi]*.
|
||||
95. Give correct answers to at least three of the following. Full name of an influential software engineering essay that's shortened as *catb*. Name of the creator and BDFL of the Perl language. First name (by which he was known) of a famous suckless and cat-v member who commited suicide in 2012. Name of [esolang](esolang.md) made in 1972 that's considered to be the first esolang ever. First name that was shared by the two most famous members of the [Doom](doom.md) development team, the engine programmer and level designer.
|
||||
96. Write a function in C, in 100 characters or fewer, that counts the number of 1 bits in a number of `unsigned int` type.
|
||||
97. Did you enjoy this quiz?
|
||||
|
||||
### Answers
|
||||
|
||||
|
@ -245,55 +248,58 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
|
|||
44. They are two of triplets (or quadruplets, ...).
|
||||
45. For example: application layer (highest level layer, concerned with applications communicating with each other, addressing by ports, protocols: HTTP, Gopher, FTP, DNS, SSH, ...), transport layer (middle level layer, concerned with delivering data over a potentially unreliable channel, implements establishment of connection, handshakes, reliable delivery, delivering in correct order etc., protocols: TCP, UDP, ...), network layer (below transport layer, concerned with delivering packets over a network, implements routing, forwarding etc., addressing by IP addresses, i.e. numerical machine addresses, protocols: IPv4, IPv6, ...), OSI physical layer (lowest level layer, concerned with sending bits between two directly connected devices, works with frequencies, electronic circuits etc., no addressing, protocols: ethernet, USB, Bluetooth, ...), ...
|
||||
46. Certificate is a file that contains the domain's public key (needed to communicate using asymmetric cryptography) that is [digitally signed](digital_signature.md) by some "trusted authority", a business that declares itself to be trusted and lets itself be paid for cryptographically confirming that public keys belong to specific servers. Without certificates a [man in the middle](man_in_the_middle.md) "attack" could be performed in which a middle man could sneakily swap a public key that's being exchanged for his own public key which would then allow him to listen to the unencrypted communication.
|
||||
47. Let's say both barrels hold 1 unit of liquid volume at the beginning, *n* is the portion of one barrel we'll be pouring over (e.g. *n = 4* means 1/4th of a barrel), *x* is water, *y* is wine. At beginning we have the following in respective barrels: *x* and *y*. After first pour over we have: *x - x/n* and *y + x/n*. After pour back we'll have: *x - x/n + (y + x/n)/(n+1)* and *y + x/n - (y + x/n)/(n+1)*. Note: the division by *n + 1* is important, dividing by *n* would be an error (we are taking away a part of barrel that is over its original capacity). Now we can just simplify the expressions to see the amount of water and wine in each barrel, i.e. we'll get: *x * (1 - 1/n + 1/(n^2+n)) + y * 1/(n+1)* and *x * (1/n - 1/(n^2+n)) + y * (1 - 1/(n+1))*. So for example amount of water in the first barrel is *1 - 1/n + 1/(n^2+n)* which simplifies to *n/(n+1)* -- that is also the exact amount of wine in the other barrel (*1 - 1/(n+1)* simplifies to the same expression). So the answer is there is *n/(n+1)* of the barrel's original liquid (and 1 minus that of the other). Logically we see the purity of each barrel has to be the same just because of the conservation laws.
|
||||
48. The details may differ from language to language, but generally *lvalues* and *rvalues* appear in assignment commands -- lvalue is any value or expression that may appear on the left side of assignment, rvalue is that which may appear on the right. For example in `myVariable = x + 4` the left side, `myVariable`, is lvalue, and the right side, `x + 4`, is rvalue. From this follow the conditions on lvalues and rvalues, i.e. rvalue must be something that returns some computed value and lvalue must be something that identifies a place where a value can be stored -- sometimes an expression can be both lvalue and rvalue at the same time. Examples: `123` is rvalue, `someVariable + 123` is rvalue, `someArray[20]` is both lvalue and rvalue, `*(somePointer + 4)` is also both and `someVariable` is both too.
|
||||
49. The Sun. Some people get tricked here, not realizing Sun is a star.
|
||||
50. For example "is equal to" or empty relation (no element is in relation with any other). For such a relation it must generally hold that any element may only be in relation with itself.
|
||||
51. hell no
|
||||
52. For example: `void r(char *s) { while (*s) s += (*s -= *s == ';') != 0; }`;
|
||||
53. Buddha (< -480), Diogenes (-404), Aristotle (-384), Caesar (-100), Jesus (around -5), Muhammad (around 570), Gutenberg (around 1400), Da Vinci (1452), Napoleon (1769), Babbage (1791), Marx (1818), Einstein (1879), Hitler (1889), Turing (1912), Stallman (1953), Torvalds (1969).
|
||||
54. `967 (*) --> 378 (*) --> 168 (*) --> 48 (+) --> 12 (+) --> 3`.
|
||||
55. For example: it's bloated, slow, can't be compiled on good computers, it's tranny software with toxic fascist community, it has issues with legal freedom (trademarks), it has [code of censorship](coc.md), it has no specification, it's obsessed with "safety", the name is complete shit, it is associated with [corporations](corporation.md), has some abomination of [OOP](oop.md), it's littered with dependencies, it's [capitalist monopoly software](capitalist_software.md), it's trying to displace [C](c.md), it is hosted on [GitHub](github.md), the users are and devs idiots and so on and so forth.
|
||||
56. We can rewrite the condition as *f(x + 1) = f(x) + x* from which it's clear that the next number in the sequence is the previous one minus its position (a bit similar to [Fibonacci](fibonacci.md) sequence), so for example this sequence will satisfy the equation: 0, 0, 1, 3, 6, 10, 15, ...
|
||||
57. [quine](quine.md)
|
||||
58. swastika
|
||||
59. Draw any right triangle; drawing an identical triangle mirrored by the hypotenuse clearly makes the both triangles together form a rectangle (it can be shown generally all angles in it will always be 90 degrees) in which the hypotenuse (that the both triangles share) is the rectangle's diagonal. Now draw also the other diagonal of the rectangle. If we draw a circle going through all the rectangle's verticles (which is the same circle that goes through the original triangle's vertices), it is clear (e.g. just by symmetries) its center lies in the middle of the rectangle, i.e. on the intersection of the diagonals; i.e. the circle's center lies in the middle of the hypotenuse, which also implies the hypotenuse is the circle's diameter (it's a straight line going through the circle's center).
|
||||
60. [Deep Blue](deep_blue.md), 1997
|
||||
61. 436; in the original group each number's digits have a total count of closed loops equal to 2.
|
||||
62. The most common and natural way is to use a [bit field](bit_field.md), i.e. an "array of bits" -- position of each bit is associated with an object that may potentially be present in the set and the bit's value then says if the object really is present or not. We want to be able to store 32 numbers, so we'll need 32 bits; the lowest bit says if number 1 is present, the next one says if number 2 is present etc. So we can really just use one 32 bit number to store this whole set. Implementing multiset is similar, we just allocate more bits for each potential member to indicate the count; in our case we suppose maximum value 255 so we can use 8 bits for each member (in C we would naturally implement this as an array of bytes), so we'll need 32 * 8 = 256 bits.
|
||||
63. I don't know lol. (That's the correct answer, it shows we can't know everything.)
|
||||
64. District one: all A voters, district two and three will each have 5 B voters and 4 A voters.
|
||||
65. The area of the roof hole says the rate at which the water pours in, we have to [integrate](integral.md) the hole area over the 20 seconds. We can split this to two parts that we'll add: from 0 to 10 seconds the function that says the area of the hole is simply *f1(t) = t*; from 10 to 20 seconds we can use a function *f2(t) = 10 - t* from 0 to 10 seconds. Integral of *f1* is *1/2 * t^2* which at *t = 10* gives us 50 litres; integral of *f2* is *10 * t - 1/2 * t^2* which also gives 50 litres (it's logical -- opening and closing of the roof is symmetric, same amount of water will fall in). So all in all there will be 100 litres of water in the room.
|
||||
66. Well, it's not the pressure alone that destroys you, it's the difference of external and internal pressure -- human has air of atmospheric pressur in his lungs and other parts of body but the pressure in the depth is greater and overpowers it, so you implode. The fish is happy because it has water inside it, the pressures are in balance.
|
||||
67. something like ` a += 4 << ((a > 10) << 1);`
|
||||
68. About 1052 distances to the Moon, about 260926 lives.
|
||||
69. It's called [aliasing](aliasing.md), it's addressed by [antialiasing](antialiasing.md) which usually suppresses or removes the effect by increasing the sampling frequency, in our case of downscaling image this would mean replacing each of the small 2x2 blocks by an average pixel value in that block, i.e. taking into account all four samples as opposed to just one.
|
||||
70. 4, 2001, 7 (the word size is 36), 5 (year 476), 19 (year 1856), 1969.
|
||||
71. Continuous audio is normally implemented with a [circular buffer](circular_buffer.md) -- that is we have a buffer of audio samples of certain size *N* and that is being played over and over, with the play head going from start to finish and then back to start again; the program has to keep updating this buffer regularly to fill it with new samples to play and it has to keep ahead of the play head. Circular buffer is nice because we don't have to shift it as a whole (which would require moving a lot of values in memory), the only thing that is moving is the play head, that's why it's used as opposed to e.g. a queue. When a game freezes, it stops operating correctly and it stops updating the audio buffer, so whatever is in it will just be played over and over in a loop.
|
||||
72. Main advantage is that a matrix can hold any combination of transformations and that applying all the transformations is then simply performed by performing a single matrix multiplication which additionally may be implemented with quite fast matrix multiplication algorithms. Not only can a matrix represent for example the whole translation+rotation+scale transformation of a single object, it can hold any number of such transformations performed in any order so that we can for example precompute a matrix that will perform world transformation, camera space transformation and view space transformations all at once! That's very fast. Disadvantages of matrices may be that they can only hold affine transformations (i.e. they can't represent ANY transformation whatsoever), it may also be a bit harder to extract back the parameters of the transformation from a matrix (though it can be done) etc. Also in case of some extreme memory limitations matrices may take up more space than would be strictly needed.
|
||||
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. Something like `s/\[\([^]]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g`.
|
||||
77. For example: poop, boob, civic, deed, level, rotor, madam, refer, stats etc.
|
||||
78. For example (`L` = lesbian, `N` = normal): `LLLNNN *|` -> `NNNL |* LL` -> `NNNLL *| L` -> `NNN |* LLL` -> `NNNL *| LL` -> `NL |* NNLL` -> `NNLL *| NL` -> `LL |* NNNL` -> `LLL *| NNN` -> `L |* NNNLL` -> `LL *| NNNL` -> `|* NNNLLL`.
|
||||
79. yes (look it up)
|
||||
80. For the same reason mosquitoes fly into the mosquito killer lamps -- they have microscopic brains.
|
||||
81. Possibly for several reasons but the most prominent one is likely that video codecs typically try to save space by not saving every frame of the video as a picture but rather encode movements of small blocks into which keyframes (static pictures saved at relatively low "FPS") are chopped. This exploits temporal redundancy -- the fact that frames close in time are similar to one another, i.e. that knowing one frame we can most likely get approximate version of the next frame by splitting the current frame into blocks and just moving them around a bit. Of course this doesn't work perfectly and low bitrate or nontypical scenes can make the blocks highly visible. It would be possible to come up with similar methods that don't use blocks and may look prettier but rectangular blocks of pixels are very easy and fast to work with and the results look good enough, so they are usually used. Another reason for blockiness of videos may be e.g. that the keyframes themselves are compressed with some lossy JPEG-like compression that makes them "blocky".
|
||||
82. 175099, formula for the series is *3^n - 2^n*.
|
||||
83. To allow efficient implementations. By saying "we don't force you to do this" the specification gives those who implement it a freedom to do it in the most efficient way possible, depending on the specific technology they have at hand. Of course this can get tricky, but correctly choosing what to define versus what to leave undefined leads to very efficient languages. Imagine for example an instruction manual for making a boat: it may also leave the choice of its body shape up to you, you will choose the best shape depending on your situation (You want a stable boat? Fast boat? Cheap boat? Is this shape easier to make from material you have at hand? Etc.).
|
||||
84. GNU is Not Unix.
|
||||
85. no
|
||||
86. *x 1 2 + 3 4 - / +*; Advantages are for example not needing brackets at all and simple parsing and evaluation, for example we don't have to care about operator precedence. Disadvantages may be e.g. lower readability; we also have to know each operator's arity because from postfix notation it can't be deduced -- with infix notation expression *myFunc(x,y,myFunc2(z))* it is clear that *myFunc* takes 3 arguments and *myFunc2* takes 1, but if we convert it to postfix notation, we get *x y z myFunc2 myFunc3*, from which it isn't clear how many arguments each function takes.
|
||||
87. It's a circuit that on its input takes data and output address -- a number from 0 to *N - 1* -- and that sends the data to one of *N* output ports (identified by the given address). It can be imagined like a switch that redirects an input stream to one of *N* output channels. Its use may be for example to redirect input data, for example audio, to one of several output devices, for example speakers, headphones and audio recorders. Multiplexer is a circuit that does the opposite (i.e. chooses input from *N* channels that is then sent to a single output channel).
|
||||
88. Total internal refraction -- light travelling in the fibers bounces off of the walls of the fiber, but in order to bounce (be reflected) when it hits the boundary it must hit it under an angle that's smaller than so called critical angle which is calculated from the indices of refraction of the fiber and the material outside of it. If the cable was bent too much, light could hit the boundary under and angle close to perpendicular and by this it would escape to the outside medium.
|
||||
89. Kind of octagon but with unevenly long sides; a rectangle with bevelled corners, i.e. two horizontal sides, two vertical sides, two 45 degree walls and two 135 degree walls. We can imagine taxicab distance from given point like sort of a diamond, it creates 4 quadrants around the point, in each the distance increases linearly in diagonal direction -- regions of constant distance here form 45 degree angled squares. Boundaries between these quadrants form a cross of infinite size. Taking two different points these two crosses will overlap and form 9 regions (draw it): top-left, top-middle, top-right, middle-left etc. Examining each of the regions we will find that it either keeps the increasing direction the same (if both overlaid directions are the same) or that some principal direction cancels out and leave the sum increasing only in one principal direction -- basically we find that in each of those regions the sum increases linearly in one of 8 directions separated by 45 degrees (except for the middle region where the sum is constant). It's also clear the heightmap has to stay continuous as both of the summed functions are continuous. From all this we can deduce the shape basically.
|
||||
90. It's a [Turing complete](turing_complete.md) system (typically a [programming language](programming_language.md)) that's however extremely hard to use for any practical programming, i.e. it can be seen as a programming language in which it is theoretically possible to program anything (anything programmable in any other language) but practically it's impossible to program anything significant because of the complicated nature of that language. This terms is related to [esoteric languages](esolang.md).
|
||||
91. [Earth](earth.md) or jvpcG. The cipher reverses the ASCII string and xors every byte (that's not a space) with 0x02 (i.e. flips the second lowest bit) -- don't bitch too much about this being too arbitrary, you can notice the string is reversed by the last character being uppercase and the first one being special char (?), then you can kind of recognize the words as the encoded chars are close to their decoded versions and the lengths of the words also hint on the words (for example a question is quite likely to start with "What").
|
||||
92. Let's simplify the left-hand side: *sin(2 * x) / (2 - 2 * sin^2(x)) - log2(1 / 8^(-1/3)) = 2 * sin(x) * cos(x) / (2 * (1 - sin^2(x))) - log2(8^1/3) = 2 * sin(x) * cos(x) / (2 * cos^2(x)) - log2(2) =
|
||||
47. 2, the series says the number of 1 bits in numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, ...
|
||||
48. Let's say both barrels hold 1 unit of liquid volume at the beginning, *n* is the portion of one barrel we'll be pouring over (e.g. *n = 4* means 1/4th of a barrel), *x* is water, *y* is wine. At beginning we have the following in respective barrels: *x* and *y*. After first pour over we have: *x - x/n* and *y + x/n*. After pour back we'll have: *x - x/n + (y + x/n)/(n+1)* and *y + x/n - (y + x/n)/(n+1)*. Note: the division by *n + 1* is important, dividing by *n* would be an error (we are taking away a part of barrel that is over its original capacity). Now we can just simplify the expressions to see the amount of water and wine in each barrel, i.e. we'll get: *x * (1 - 1/n + 1/(n^2+n)) + y * 1/(n+1)* and *x * (1/n - 1/(n^2+n)) + y * (1 - 1/(n+1))*. So for example amount of water in the first barrel is *1 - 1/n + 1/(n^2+n)* which simplifies to *n/(n+1)* -- that is also the exact amount of wine in the other barrel (*1 - 1/(n+1)* simplifies to the same expression). So the answer is there is *n/(n+1)* of the barrel's original liquid (and 1 minus that of the other). Logically we see the purity of each barrel has to be the same just because of the conservation laws.
|
||||
49. The details may differ from language to language, but generally *lvalues* and *rvalues* appear in assignment commands -- lvalue is any value or expression that may appear on the left side of assignment, rvalue is that which may appear on the right. For example in `myVariable = x + 4` the left side, `myVariable`, is lvalue, and the right side, `x + 4`, is rvalue. From this follow the conditions on lvalues and rvalues, i.e. rvalue must be something that returns some computed value and lvalue must be something that identifies a place where a value can be stored -- sometimes an expression can be both lvalue and rvalue at the same time. Examples: `123` is rvalue, `someVariable + 123` is rvalue, `someArray[20]` is both lvalue and rvalue, `*(somePointer + 4)` is also both and `someVariable` is both too.
|
||||
50. The Sun. Some people get tricked here, not realizing Sun is a star.
|
||||
51. For example "is equal to" or empty relation (no element is in relation with any other). For such a relation it must generally hold that any element may only be in relation with itself.
|
||||
52. hell no
|
||||
53. For example: `void r(char *s) { while (*s) s += (*s -= *s == ';') != 0; }`;
|
||||
54. Buddha (< -480), Diogenes (-404), Aristotle (-384), Caesar (-100), Jesus (around -5), Muhammad (around 570), Gutenberg (around 1400), Da Vinci (1452), Napoleon (1769), Babbage (1791), Marx (1818), Einstein (1879), Hitler (1889), Turing (1912), Stallman (1953), Torvalds (1969).
|
||||
55. `967 (*) --> 378 (*) --> 168 (*) --> 48 (+) --> 12 (+) --> 3`.
|
||||
56. For example: it's bloated, slow, can't be compiled on good computers, it's tranny software with toxic fascist community, it has issues with legal freedom (trademarks), it has [code of censorship](coc.md), it has no specification, it's obsessed with "safety", the name is complete shit, it is associated with [corporations](corporation.md), has some abomination of [OOP](oop.md), it's littered with dependencies, it's [capitalist monopoly software](capitalist_software.md), it's trying to displace [C](c.md), it is hosted on [GitHub](github.md), the users are and devs idiots and so on and so forth.
|
||||
57. We can rewrite the condition as *f(x + 1) = f(x) + x* from which it's clear that the next number in the sequence is the previous one minus its position (a bit similar to [Fibonacci](fibonacci.md) sequence), so for example this sequence will satisfy the equation: 0, 0, 1, 3, 6, 10, 15, ...
|
||||
58. [quine](quine.md)
|
||||
59. swastika
|
||||
60. Draw any right triangle; drawing an identical triangle mirrored by the hypotenuse clearly makes the both triangles together form a rectangle (it can be shown generally all angles in it will always be 90 degrees) in which the hypotenuse (that the both triangles share) is the rectangle's diagonal. Now draw also the other diagonal of the rectangle. If we draw a circle going through all the rectangle's verticles (which is the same circle that goes through the original triangle's vertices), it is clear (e.g. just by symmetries) its center lies in the middle of the rectangle, i.e. on the intersection of the diagonals; i.e. the circle's center lies in the middle of the hypotenuse, which also implies the hypotenuse is the circle's diameter (it's a straight line going through the circle's center).
|
||||
61. [Deep Blue](deep_blue.md), 1997
|
||||
62. 436; in the original group each number's digits have a total count of closed loops equal to 2.
|
||||
63. The most common and natural way is to use a [bit field](bit_field.md), i.e. an "array of bits" -- position of each bit is associated with an object that may potentially be present in the set and the bit's value then says if the object really is present or not. We want to be able to store 32 numbers, so we'll need 32 bits; the lowest bit says if number 1 is present, the next one says if number 2 is present etc. So we can really just use one 32 bit number to store this whole set. Implementing multiset is similar, we just allocate more bits for each potential member to indicate the count; in our case we suppose maximum value 255 so we can use 8 bits for each member (in C we would naturally implement this as an array of bytes), so we'll need 32 * 8 = 256 bits.
|
||||
64. I don't know lol. (That's the correct answer, it shows we can't know everything.)
|
||||
65. District one: all A voters, district two and three will each have 5 B voters and 4 A voters.
|
||||
66. The area of the roof hole says the rate at which the water pours in, we have to [integrate](integral.md) the hole area over the 20 seconds. We can split this to two parts that we'll add: from 0 to 10 seconds the function that says the area of the hole is simply *f1(t) = t*; from 10 to 20 seconds we can use a function *f2(t) = 10 - t* from 0 to 10 seconds. Integral of *f1* is *1/2 * t^2* which at *t = 10* gives us 50 litres; integral of *f2* is *10 * t - 1/2 * t^2* which also gives 50 litres (it's logical -- opening and closing of the roof is symmetric, same amount of water will fall in). So all in all there will be 100 litres of water in the room.
|
||||
67. Well, it's not the pressure alone that destroys you, it's the difference of external and internal pressure -- human has air of atmospheric pressur in his lungs and other parts of body but the pressure in the depth is greater and overpowers it, so you implode. The fish is happy because it has water inside it, the pressures are in balance.
|
||||
68. something like ` a += 4 << ((a > 10) << 1);`
|
||||
69. About 1052 distances to the Moon, about 260926 lives.
|
||||
70. It's called [aliasing](aliasing.md), it's addressed by [antialiasing](antialiasing.md) which usually suppresses or removes the effect by increasing the sampling frequency, in our case of downscaling image this would mean replacing each of the small 2x2 blocks by an average pixel value in that block, i.e. taking into account all four samples as opposed to just one.
|
||||
71. 4, 2001, 7 (the word size is 36), 5 (year 476), 19 (year 1856), 1969.
|
||||
72. Continuous audio is normally implemented with a [circular buffer](circular_buffer.md) -- that is we have a buffer of audio samples of certain size *N* and that is being played over and over, with the play head going from start to finish and then back to start again; the program has to keep updating this buffer regularly to fill it with new samples to play and it has to keep ahead of the play head. Circular buffer is nice because we don't have to shift it as a whole (which would require moving a lot of values in memory), the only thing that is moving is the play head, that's why it's used as opposed to e.g. a queue. When a game freezes, it stops operating correctly and it stops updating the audio buffer, so whatever is in it will just be played over and over in a loop.
|
||||
73. Main advantage is that a matrix can hold any combination of transformations and that applying all the transformations is then simply performed by performing a single matrix multiplication which additionally may be implemented with quite fast matrix multiplication algorithms. Not only can a matrix represent for example the whole translation+rotation+scale transformation of a single object, it can hold any number of such transformations performed in any order so that we can for example precompute a matrix that will perform world transformation, camera space transformation and view space transformations all at once! That's very fast. Disadvantages of matrices may be that they can only hold affine transformations (i.e. they can't represent ANY transformation whatsoever), it may also be a bit harder to extract back the parameters of the transformation from a matrix (though it can be done) etc. Also in case of some extreme memory limitations matrices may take up more space than would be strictly needed.
|
||||
74. From the right triangle: *dick_legth / shadow_length = tan(20 degrees) => dick_legth = tan(20 degrees) * shadow_length ~= 21.83 cm*.
|
||||
75. 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).
|
||||
76. 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).
|
||||
77. Something like `s/\[\([^]]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g`.
|
||||
78. For example: poop, boob, civic, deed, level, rotor, madam, refer, stats etc.
|
||||
79. For example (`L` = lesbian, `N` = normal): `LLLNNN *|` -> `NNNL |* LL` -> `NNNLL *| L` -> `NNN |* LLL` -> `NNNL *| LL` -> `NL |* NNLL` -> `NNLL *| NL` -> `LL |* NNNL` -> `LLL *| NNN` -> `L |* NNNLL` -> `LL *| NNNL` -> `|* NNNLLL`.
|
||||
80. yes (look it up)
|
||||
81. For the same reason mosquitoes fly into the mosquito killer lamps -- they have microscopic brains.
|
||||
82. Possibly for several reasons but the most prominent one is likely that video codecs typically try to save space by not saving every frame of the video as a picture but rather encode movements of small blocks into which keyframes (static pictures saved at relatively low "FPS") are chopped. This exploits temporal redundancy -- the fact that frames close in time are similar to one another, i.e. that knowing one frame we can most likely get approximate version of the next frame by splitting the current frame into blocks and just moving them around a bit. Of course this doesn't work perfectly and low bitrate or nontypical scenes can make the blocks highly visible. It would be possible to come up with similar methods that don't use blocks and may look prettier but rectangular blocks of pixels are very easy and fast to work with and the results look good enough, so they are usually used. Another reason for blockiness of videos may be e.g. that the keyframes themselves are compressed with some lossy JPEG-like compression that makes them "blocky".
|
||||
83. 175099, formula for the series is *3^n - 2^n*.
|
||||
84. To allow efficient implementations. By saying "we don't force you to do this" the specification gives those who implement it a freedom to do it in the most efficient way possible, depending on the specific technology they have at hand. Of course this can get tricky, but correctly choosing what to define versus what to leave undefined leads to very efficient languages. Imagine for example an instruction manual for making a boat: it may also leave the choice of its body shape up to you, you will choose the best shape depending on your situation (You want a stable boat? Fast boat? Cheap boat? Is this shape easier to make from material you have at hand? Etc.).
|
||||
85. GNU is Not Unix.
|
||||
86. no
|
||||
87. *x 1 2 + 3 4 - / +*; Advantages are for example not needing brackets at all and simple parsing and evaluation, for example we don't have to care about operator precedence. Disadvantages may be e.g. lower readability; we also have to know each operator's arity because from postfix notation it can't be deduced -- with infix notation expression *myFunc(x,y,myFunc2(z))* it is clear that *myFunc* takes 3 arguments and *myFunc2* takes 1, but if we convert it to postfix notation, we get *x y z myFunc2 myFunc3*, from which it isn't clear how many arguments each function takes.
|
||||
88. It's a circuit that on its input takes data and output address -- a number from 0 to *N - 1* -- and that sends the data to one of *N* output ports (identified by the given address). It can be imagined like a switch that redirects an input stream to one of *N* output channels. Its use may be for example to redirect input data, for example audio, to one of several output devices, for example speakers, headphones and audio recorders. Multiplexer is a circuit that does the opposite (i.e. chooses input from *N* channels that is then sent to a single output channel).
|
||||
89. Total internal refraction -- light travelling in the fibers bounces off of the walls of the fiber, but in order to bounce (be reflected) when it hits the boundary it must hit it under an angle that's smaller than so called critical angle which is calculated from the indices of refraction of the fiber and the material outside of it. If the cable was bent too much, light could hit the boundary under and angle close to perpendicular and by this it would escape to the outside medium.
|
||||
90. Kind of octagon but with unevenly long sides; a rectangle with bevelled corners, i.e. two horizontal sides, two vertical sides, two 45 degree walls and two 135 degree walls. We can imagine taxicab distance from given point like sort of a diamond, it creates 4 quadrants around the point, in each the distance increases linearly in diagonal direction -- regions of constant distance here form 45 degree angled squares. Boundaries between these quadrants form a cross of infinite size. Taking two different points these two crosses will overlap and form 9 regions (draw it): top-left, top-middle, top-right, middle-left etc. Examining each of the regions we will find that it either keeps the increasing direction the same (if both overlaid directions are the same) or that some principal direction cancels out and leave the sum increasing only in one principal direction -- basically we find that in each of those regions the sum increases linearly in one of 8 directions separated by 45 degrees (except for the middle region where the sum is constant). It's also clear the heightmap has to stay continuous as both of the summed functions are continuous. From all this we can deduce the shape basically.
|
||||
91. It's a [Turing complete](turing_complete.md) system (typically a [programming language](programming_language.md)) that's however extremely hard to use for any practical programming, i.e. it can be seen as a programming language in which it is theoretically possible to program anything (anything programmable in any other language) but practically it's impossible to program anything significant because of the complicated nature of that language. This terms is related to [esoteric languages](esolang.md).
|
||||
92. [Earth](earth.md) or jvpcG. The cipher reverses the ASCII string and xors every byte (that's not a space) with 0x02 (i.e. flips the second lowest bit) -- don't bitch too much about this being too arbitrary, you can notice the string is reversed by the last character being uppercase and the first one being special char (?), then you can kind of recognize the words as the encoded chars are close to their decoded versions and the lengths of the words also hint on the words (for example a question is quite likely to start with "What").
|
||||
93. Let's simplify the left-hand side: *sin(2 * x) / (2 - 2 * sin^2(x)) - log2(1 / 8^(-1/3)) = 2 * sin(x) * cos(x) / (2 * (1 - sin^2(x))) - log2(8^1/3) = 2 * sin(x) * cos(x) / (2 * cos^2(x)) - log2(2) =
|
||||
sin(x) / cos(x) - log2(2) = tg(x) - 1*, so we get *tg(x) >= 1*. So that will hold when *pi/4 + pi * n <= x < pi/2 + pi * n*, *n* is an integer.
|
||||
93. Considering an infinitely small non-zero interval *dx*, and the graph height increase over this interval *dy*, the distance increase (from Pythagorean theorem) on this interval will be *sqrt(dx^2 + dy^2)*. We can replace *dy* by *tan(alpha) * dx*. By definition tangent of the function's angle at a certain point is its derivative, so we can also replace *tan(alpha)* by derivative of the function, *f'(x)*. So we get length increase *sqrt(dx^2 + f'(x)^2 * dx^2) = sqrt(dx^2 * (1 + f'(x)^2)) = dx * sqrt(1 + f'(x)^2)*. Now to add infinitely many values over infinitely small intervals we use integrals, so to add all these small length increases we can write the final formula: *length(x1,x2) = Integral(x1,x2) sqrt(1 + f'(x)^2) dx*. Testing this on *f(x) = x* from 0 to 1 we get the expected *length(0,1) = Integral(0,1) sqrt(1 + 1^2) dx = sqrt(2)*. For *f(x) = sin(x)* from 0 to *2 * pi* we get *length(0,2 * pi) = Integral(0,2 * pi) sqrt(1 + cos^2(x)) dx ~= 7.64*, which seems about right (it's a bit more than 2 * pi).
|
||||
94. yes
|
||||
94. Considering an infinitely small non-zero interval *dx*, and the graph height increase over this interval *dy*, the distance increase (from Pythagorean theorem) on this interval will be *sqrt(dx^2 + dy^2)*. We can replace *dy* by *tan(alpha) * dx*. By definition tangent of the function's angle at a certain point is its derivative, so we can also replace *tan(alpha)* by derivative of the function, *f'(x)*. So we get length increase *sqrt(dx^2 + f'(x)^2 * dx^2) = sqrt(dx^2 * (1 + f'(x)^2)) = dx * sqrt(1 + f'(x)^2)*. Now to add infinitely many values over infinitely small intervals we use integrals, so to add all these small length increases we can write the final formula: *length(x1,x2) = Integral(x1,x2) sqrt(1 + f'(x)^2) dx*. Testing this on *f(x) = x* from 0 to 1 we get the expected *length(0,1) = Integral(0,1) sqrt(1 + 1^2) dx = sqrt(2)*. For *f(x) = sin(x)* from 0 to *2 * pi* we get *length(0,2 * pi) = Integral(0,2 * pi) sqrt(1 + cos^2(x)) dx ~= 7.64*, which seems about right (it's a bit more than 2 * pi).
|
||||
95. [The Cathedral And The Bazaar](bazaar.md), Larry Wall, Uriel, INTERCAL, John (Carmack and Romero).
|
||||
96. For example: `int c1(unsigned int x) { int r = x % 2; while (x) r += (x >>= 1) % 2; return r; }`.
|
||||
97. yes
|
||||
|
||||
## Other
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue