



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Name: ID:
True/False: (4 points each)
Multiple Choice: (4 points each)
(d) Compilation/Linkage Error.
#include <iostream.h> int sub1(int &n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return 0; } (a) 0 (b) 1 (c) 9 (d) 10 (e) None of the above.
(a) 1. (b) 2. (c) 3. (d) 3. (e) None of the above.
int myfunc(double n) { return n * 2.0; }
int myfunc(float n) { return n * 3.0; } (a) 7 (b) 7. (c) 10 (d) 10. (e) None of the above.
pt->x_center = 10.0; (a) pt.x_center = 10.0; (b) (pt).x_center = 10.0; (c) (*pt.)x_center = 10.0; (d) (pt->)x_center = 10.0; (e) None of the above.
complex x, y; x.re = 4.0; x.im = 5.0; y = x; x.re = 5.0; cout << y.re << endl; (a) 4. (b) 4 (c) 5. (d) 5 (e) None of the above.
(a)
(b)
(c)
Short Essay:
31 count++; 32 if (count >= 10) 33 { 34 cout << "Exceed MAX: " << MAX << endl; 35 in.close(); 36 return(-1); 37 } 38 ________________ 39 } 40 41 in.close(); 42 return 0; 43 }
The input file test.dat contains the following data:
Eric 77 87 Scott 90 94 Mary 100 100