CSC 17 Test 1 SPRING 1999

# CSC 17 Test 1 SPRING 1999 - CSc 17 Test 1 19 February 1999...

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

CSc 17 Test 1 19 February 1999 >>>>>>>>>>>>>>>>ANSWERS<<<<<<<<<<<<<<<<<<<<<<<<<< 1. (20 pts) State the value of each of the following expressions: a. 6+7/8 6 b. 6*7%8 2 c. 8.0+6/10 8.0 d. 8.0*6/10 4.8 e. int(char(95)-1) 94 f. 6*7/8 5 g. 2>3 && (4/(3-3) >5) false h. 8*(9/8)+9%8 9 i. !(true == false) == false false j. 'a'>'c' || 'A'<'C' true 2. (16 pts) Suppose we have the following functions prototypes and variable declaration: void func(int a, ifstream & b); void func(ifstream &a, int b); int gunc(int c); ifstream in; State whether each of the following function calls will compile. If a call does not compile explain why. a. func(2,in); COMPILE b. func(in,2); COMPILE c. func(in,in); MISMATCH OF PARAMS d. gunc(in); MISMATCH OF PARAM e. gunc(gunc(3)); COMPILE f. gunc(); TOO FEW PARAMS g. func(); TOO FEW PARAMS h. func(2+gunc(3), in); COMPILE 3. (14 pts) Suppose we have the following variable declarations and function definition: void x(int a, int &b, int c, int&d){ a=a+1; b=b*a; c=c+2; d=d*c; } int a, b, c, d; State the output when the following statements are executed; a=1; b=2; c=3; d=4; x(a,b,c,d); cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl; 1 4 3 20 a=1; b=2; c=3; d=4; x(b,c,d,a); cout<<a<<" "<<b<<"

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ 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