Interactive Quiz for Chapter 7

Question
Your Answer Result/Explanation
7.1
Write a statement to declare an array named x of 5 double values.
7.2
Write a statement that declares an int array named x with size 40.
7.3
Suppose int list[] = {4, 5, 6, 2, 1, 0}, what is list[0]?
7.4
Suppose int list[] = {4, 5, 6, 2, 1, 0}, what is list[2]?
7.5
what is the output of the following code?
      void m(int i, int list[]) {
        i = 9;
        list[0] = 9;
      }

      int main() 
      {
        int x[] = {1, 2};
        int i = 1;
        m(i, x);
        cout << i << "," << x[0];
      }
                  
7.6
Given int list[] = {1, 2, 14, 7, 3}, for the linear search function in the text, what is linearSearch(list, 3, 5)?
7.7
Given int list[] = {1, 2, 14, 7, 3}, for the linear search function in the text, what is linearSearch(list, 4, 5)?
7.8
Given int list[] = {1, 2, 3, 7, 14}, what is binarySearch(list, 7, 5) for the binarySearch function in the text?
7.9
Given int list[] = {1, 2, 3, 7, 14}, what is binarySearch(list, 5, 5) for the binarySearch function in the text?
7.10
For a C-string s, write an expression that returns its length.
7.11
What is atoi("3") + atoi("4")?
7.12
What is atoi("3.5") + atoi("4.3")?