### Interactive Quiz for Chapter 6

 Question Your Answer Result/Explanation 6.1 What is the return value from invoking isPrime(27)? ``` boolean isPrime(int n) { for (int i = 2; i < n; i++) { if (n % i == 0) { return true; } } return false; } ``` 6.2 What is the return value from invoking isPrime(77)? ``` boolean isPrime(int n) { for (int i = 2; i < n; i++) { if (n % i == 0) { return true; } } return false; } ``` 6.3 What is the output of following code? ``` void m(int n) { n++; cout << n; } int main() { m(1); return 0; } ``` 6.4 What is the output of the following code? ``` void m(int n) { n++; } int main() { int n = 1; m(n); cout << n; } ``` 6.5 What is the output from invoking m(1234)? ``` void m(int n) { while (n != 0) { cout << n % 10; n = n / 10; } } ``` 6.6 What is the output from invoking m("1234")? ``` void m(string s) { for (int i = s.length() - 1; i >= 0; i--) { cout << s.at(i); } } ``` 6.7 What is the return value from invoking m("1234")? ``` int m(string s) { int result = 0; for (int i = 0; i < s.length(); i++) { result = result * 10 + (s.at(i) - '0'); } return result; } ```