CS253: Software Development with C++

Fall 2018

IQ 15

CS253 IQ 15

See this page as a slide show

istream_iterator<float> “end” iterator

  1. istream_iterator<float> the_end;
  2. istream_iterator<float> the_end();
  3. 0.0
  4. nullptr
  5. There isn’t one.

set<int> default second template argument

  1. operator<
  2. less
  3. less<int>
  4. less<int>()
  5. There isn’t one.

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?

  1. bind(beta, alpha, 2, 1);
  2. auto beta = bind(alpha, 2, 1);
  3. auto beta = bind(alpha, _2, _1);
  4. A lambda function would be shorter.
  5. int beta(int a, int b) { return alpha(b,a); }

What is the period of minstd_rand?

  1. 231−1
  2. 231
  3. 232−1
  4. 232
  5. 264
  6. I don’t know what “period” means. ☹

x = x * 48271 % 2147483647 // always positive, never zero

Random Numbers

The mt19937 RNG is deterministic—given the same seed, it will produce the same sequence of numbers each time.

  1. yes
  2. no
  3. depends on the implementation
  4. mt19937 is not a generator.

When is the final exam?

  1. Thursday December 6 6:20ᴘᴍ
  2. Thursday December 13 6:20ᴀᴍ
  3. Thursday December 13 9:30ᴀᴍ
  4. Thursday December 13 6:20ᴘᴍ
  5. Monday December 24 6:20ᴘᴍ

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2018-12-03T21:48

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building