Update
This commit is contained in:
parent
ac9725b356
commit
3a465aea74
21 changed files with 1985 additions and 1866 deletions
|
@ -216,7 +216,8 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
|
|||
109. There is a cube-shaped planet that has 8 houses (numbered 1 to 8), each house on one of the 8 cube vertices. Each house is inhabited by one alien (they're named *A* to *H*). Sometimes they get bored and want to switch houses with others, so they organize a big moving day in which some aliens switch houses (it's possible that everyone moves elsewhere or that just some move and some stay where they are). However they like their neighbors (aliens living in houses directly connected by the same edge), so any time this house switching occurs, at the end of the day everyone must have the same neighbors as before. How many possible ways there are to assign aliens to the houses so that they always have the same neighbors?
|
||||
110. A [troll](trolling.md) joins homosexual gayming stream and starts spamming Hitler quotes by which he increases the amount of lulz by X percent. However the gay starts crying so the stream censor quickly bans the poor troll, dropping the lulz to the original level. By how many percent have the lulz decreased now?
|
||||
111. What happens in [Forth](forth.md) when you try to define a word with the same name as another already existing word? Will the old word be deleted? Or is this forbidden to do? Also say why.
|
||||
112. Did you enjoy this quiz?
|
||||
112. What's the difference between [lazy](lazy.md) and strict evaluation? Show simple example.
|
||||
113. Did you enjoy this quiz?
|
||||
|
||||
### Answers
|
||||
|
||||
|
@ -332,7 +333,8 @@ sin(x) / cos(x) - log2(2) = tg(x) - 1*, so we get *tg(x) >= 1*. So that will hol
|
|||
109. This is counting graph [automorphisms](automorphism.md). Let's say we assign alien *X* to house 1; we can count how many possible allowed configurations there are for this case and then multiply it all by 8 (for case when *X* would be assigned to house 2, then 3, 4 etc.). Let's say neighbors of *X* are *U*, *V* and *W*. There are 3 edges going from house 1, i.e. 3 possible ways for the first neighbor, *U*, to be placed -- again, consider we put *U* in one place; we'll count the possibilities and eventually multiply them by 3. Now we have 2 edges (2 neighbor houses) remaining and 2 neighbors (*V* and *W*) to put there; again, consider one case and then multiply that by 2. Now we have *X* and all his neighbors in place, how many possible configurations are left here? There is one house that's the neighbor of both *U* and *V* and there is only one possibility of who can live there: the shared neighbor of *U* and *V* -- there is just one option so this house's inhabitant is determined. Same for *V*/*W* and *U*/*W*. That's already 7 houses assigned and the one last remaining has to be in the one house left, so in fact by placing *X* and its neighbors we've uniquely determined the rest of the houses, there's just one way. So in the end we have 8 * 3 * 2 * 1 = 48 possible ways.
|
||||
110. If the original level of lulz is *a* and lulz increase is *n*, then *X = 100 * n / a*. The decrease is then *100 * n / (a + n) = 100 * (a * X / 100) / (a + a * X / 100) = X / (1 + X / 100) = 100 * X / (100 + X)*.
|
||||
111. It can be done (and it's useful), the new word will shadow the old one -- i.e. invoking the word will execute the latest word of that name -- but the old word will still exist in the dictionary, so that if the new word is deleted the old one becomes accessible again. This is because the dictionary is searched from the newest entries to the oldest (it's usually a linked list starting with the latest defined word).
|
||||
112. yes
|
||||
112. They're both strategies for evaluating [expressions](expression.md): lazy (also *by need*) evaluates an argument ONLY once it's actually needed, while strict evaluation evaluates all arguments, even if some might not be needed. Example: let's have a function `or3(a,b,c)` which performs logical OR of three values; under strict evaluation all *a*, *b* and *c* will be evaluated and then logical OR will be performed; under lazy evaluation the function may first evaluate one argument, let's say *a*, and if it ends up being TRUE, there is no need to further evaluate *b* and *c* (the result is already known to be TRUE), so they won't be evaluated.
|
||||
113. yes
|
||||
|
||||
## Other
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue