c17s98t1

# c17s98t1 - CSc 17 Test 1 Thursday 12 February 1998 Page 1...

• Notes
• nizhes
• 2

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

CSc 17 Test 1 Thursday 12 February 1998 Page 1 >>>>>>>>>>>>>>>>ANSWERS<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1. (15 pts) State the output generated by the following code: ( int(true) is 1, int(false) is 0; indicate blanks with little squares ) cout << (2+3/4)<<" "<< (2+3%4)<< "\n" << (2+3.0/4) << " " << (2.0+3/4)<<" " << int( (2<3) || (3<4) ) << " " << int( (2>3) || (3>4) ) << " " << int( (2>3) && (3<4) ) << char('a'+2) << char('T'-'A'+'a'+2) << double( 't'-'p') << setw(4) <<'a'<<setw(5)<<"He" << int ( ((2<3)==(4>5)) == (3==6)) << int(!(2!=3)); >>>>>>>>>>>>>>> 2 5 >>>>>>>>>>>>>>> 2.75 2 1 0 0cv4 a He10 2. (10 pts) Given the function and variable declarations below, state what output is generated by the code below the dashed line. int a(int x, int y, int z) { if (x>0) if (y>0) return (y+x); else if (x>y) return (x*y); else return (x-y); if (x<0) if (y>0) return (y-x-1); else return z; return (x+y+z); } ----------------------------------------------------------------- int x=1,y=2,z=-3; cout << a(x,y,z) << " " <<a(z,z,z) << " " << a(0,x,y) << " " << a(x,y,a(x,y,z)) << " " << a(3,2,1); >>>>>>>>>>>>>>>>>>>>>>>>>>3 -3 3 3 5 3. (15 pts) Given the function and variable declarations below, state

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

This is the end of the preview. Sign up to access the rest of the document.
• Spring '08
• varies
• United States Declaration of Independence, Carriage return, int x=1,y=2,z=-3, line. int, int y,int, int x=1,y=2,z=3

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern