Sample Midterm: .edu



Part I: 12 Multiple choice questions (2 points each):

Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your mark-sense sheet. Each correct question is worth 2 points. Choose the one BEST answer for each question. Assume that all given C++ code is syntactically correct unless a possibility to the contrary is suggested in the question.

Remember not to devote too much time to any single question, and good luck!

| |Consider the following program. |

| | |

| |#include |

| |using namespace std; |

| | |

| |int * f (int n) { |

| |int a[10]; |

| |for (int i = 0; i < 10; i++) |

| |a[i] = i*n; |

| |return a; |

| |} |

| | |

| |void main() { |

| |int j, k; |

| |int * p; |

| |j = 12; |

| |p = f(j); |

| |for (k = 0; k < 10; k++) { |

| |cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download