{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

q5 sol6 - CSCI.1100 Computer Science I Quiz 5 Closed book...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI.1100 Computer Science I Quiz 5 October 19, 2009 Closed book, closed notes, no computers or calculators of any kind. Name: RCS login: Circle your lab section: (01 MTh 10:00) (02 MTh 12:00) (03 MTh 2:00) (04 MTh 4:00) (05 MTh 6:00) (06 MTh 10:00) (07 TF 10:00) (08 TF 12:00) (09 MTh 12:00) (10 TF 2:00) (11 MTh 4:00) You will have 15 minutes to complete this test. Make sure you do not spend too much time on any question. 1. What would this program print (2 points)? #include <iostream> using namespace std; void Fctn( int &x, int &z) { z = x * x; } int main() { int a = 2, b = 4; Fctn(b, a + b); cout << a << " " << b << endl; return 0; } A. The program would not compile B. 2 36 C. 4 36 D. None of the above A
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2. Consider the following program, which is missing a function named func: #include <iostream> using namespace std; // missing function func goes here int main () { int a, b, c; a = 4; b = 3; c = func(a, b); cout << a << " " << b << " " << c << endl; return 0; } a) Show the output generated by this program if we add the following function func to the program? (3 points) int func ( int x, int &y) { x = y + 1; 4 6 10 y = x + 2; return (x+y); } b) Show
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}