CS253 IQ 15
Show Main.IQ15 as a slide show.
set<int>
default second template argument
operator<
less
less<int>
less<int>()
- There isn’t one.
C: it must be a type, a comparison functor, not an object.
bind
What’s the easiest way to create a variable pointing to the
function beta
, which calls the two-argument function alpha
,
but with the arguments swapped?
bind(beta, alpha, 2, 1);
auto beta = bind(alpha, 2, 1);
auto beta = bind(alpha, _2, _1);
- A lambda function would be shorter.
int beta(int a, int b) { return alpha(b,a); }
C: _1
means the first argument, _2
the second argument, …
What is the period of minstd_rand
?
- 232
- 232−1
- 231
- 231−1
- 231−2
- I don’t know what “period” means. ☹
The word “period” means how many values it returns before it repeats.
E: x = x * 48271 % 2147483647 // always positive, never zero
Random Numbers
mt19937
is deterministic—given the same seed, it will
produce the same sequence of numbers each time.
- yes
- no
- depends on the implementation
mt19937
is not a generator.
A: All generators are deterministic, perhaps except for random_device
.
Where is the final exam?
- CSB 110
- Chem A 103
- The White House
- Castle Doom, Latveria
- None of the above
E: We’re livin’ la vida virtual, so take it where you like,
but CSU won’t let you into the first two places,
and, of the next two, one is occupied by a madman,
and the other …
When is the final exam?
- Monday May 11 2:00ᴀᴍ
- Monday May 11 2:00ᴘᴀ
- Monday May 11 2:00ᴍᴘ
- Monday May 11 2:00ᴘᴍ
- Monday May 11 2:00ᴍᴀ
- Monday May 11 2:00ᴀᴘ
D: Monday May 11 2:00ᴘᴍ