/*
CS371p: Quiz #2 (5 pts)
*/

/* -----------------------------------------------------------------------
1. What does the Sapir-Whorf hypothesis assert? [Sec. 1.2.3, Pg. 5]
   (1 pt)

It may be possible for an individual working in one language to
imagine thoughts or utter ideas that cannot in any way be translated,
or even understood by individuals operating in a different linguistic
framework.
*/

/* -----------------------------------------------------------------------
2. What is the output of the following program? [3n+ 1]
   (1 pt)

5 11
*/

#include <iostream> // cout, endl

using namespace std;

int f (int n) {
    return n + (n >> 1) + 1;} // the bit shift operator does not modify n

int main () {
    cout << f(3) << " ";
    cout << f(7) << endl;
    return 0;}

/* -----------------------------------------------------------------------
3. In the context of Project #1: Collatz, what is f() computing? [3n+ 1]
   (2 pts)

For odd n it's computing (3n + 1) / 2.
(3n + 1) / 2
3n/2 + 1/2
n + n/2 + 1/2
n + n/2 + 1, because n is odd
n + (n >> 1) + 1
*/


syntax highlighted by Code2HTML, v. 0.9.1