c17f97t1 - CSc 17 Test 1 1 Wednesday 8 October 1997...

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

View Full Document Right Arrow Icon
CSc 17 Test 1 Wednesday 8 October 1997 ANSWERS 1. (15 pts) This is a true-false question. After each expression state whether the expression evaluates to true or to false. ( 3/2 == (2/3+1)) TRUE (('a'>'b') || ( ('b'-'a')>0 ) ) TRUE (('a'+int(true))>'a') TRUE ((3/2.0) == (2/3.0 + 1)) FALSE ((17%3+1) > (3%17)) FALSE ( ((2>3)==(3>2)) == ( (4-3>0)==(10<4) ) ) TRUE ('0' == int('0') ) TRUE ( 'T'-'t' + 'q'-'Q' >0) FALSE ('t'-'r'+true == 3) TRUE ( !(4==5) == !(7>5) ); FALSE 2. (10 pts) Given the function and variable declarations below, state what output is generated by the code below the dashed line { if (x==y) {if (x>z) x++; z++;} else {x++; y++;} cout << " "<< x <<" "<< y <<" "<< z; return; } ----------------------------------------------------------------- int x,y,z; x=4; y=3; z=5; a(x,y,z); 5 4 5 cout <<" "<< x << " " << z; 5 5 x=4; y=3; a(x,x,y); 5 5 4 cout <<" "<< x << " " << y; 5 3 3. (15 pts) Find 10 syntax errors in the following code: #include <iosteam.h>
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 / 2

c17f97t1 - CSc 17 Test 1 1 Wednesday 8 October 1997...

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