c17f99t1 - CSc 17 Test 1 Monday 18 October 1999 Page 1...

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

View Full Document Right Arrow Icon
CSc 17 Test 1 Monday 18 October 1999 Page 1 >>>>>>>>>>>>>>>>>>SUGGEST ANSWERS<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1. (15 pts) Given that the function 'truth' is defined as char truth(bool t){ if(t) return 'T'; return 'F';} what is the output of the following lines of code? cout<<(2+3%4*5/6%7)<<endl; 4 cout<<(truth( (2>3 || 4<5) && (8==9 || 8!=9)))<<endl; T cout<<truth( truth(2>3) > truth(2<3) )<<endl; F cout<<(2+3%4*5.0/(6%7))<<endl; 4.5 cout<<(char('F'+14))<<endl; T 2. (15 pts)Given the function definition below, state what output is generated by the code below the dashed line. void q(int & x, int& y,int z) { x=x+2; y=y+3; z=z+1; x=z+2; cout << x << " " << y << " " << z<<endl; } ----------------------------------------------------------- int x,a,y; x=1; a=2; y=3; q(x,a,y); 6 5 4 cout << x << " " << a << " " << y << endl; 6 5 3 x=1; a=2; y=3; q(x,a,x); 4 5 2 cout << x << " " << a << " " << y << endl; 4 5 3 x=1; a=2; y=3; q(x,x,x); 4 4 2 3. (10 pts) I forgot to document the purpose of the following function. Provide the documentation.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/09/2008 for the course CSE 17 taught by Professor Varies during the Spring '08 term at Lehigh University .

Page1 / 3

c17f99t1 - CSc 17 Test 1 Monday 18 October 1999 Page 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online