q3 sol6 - CSCI.1100 Computer Science I Quiz 3 September 28,...

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 3 September 28, 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) The time spent on each question should be proportional to the number of points 1. What will this program print (2 points)? #include <iostream> using namespace std; int main() { int n1=4; int n2 = 5 ; cout << 2 * n1++ << endl; //___ 8 ___ n1 = n2++; cout << ++n1 << endl; //___ 6 ___ return 0; }
Background image of page 1

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

View Full DocumentRight Arrow Icon
2. What will the program below print a. If run as is (1 point) #include <iostream> using namespace std; int main() { int a=1, b=2, c=3; four if if (b > c) { cout << "first" << endl; } else { cout << "second" << endl; } } else { if (a > b || b > c) { cout << "third" << endl; } else cout << "four" << endl; } return 0; } b. I f line 6 was replaced with this line (1 point)? int a=3, b=2, c=1;
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.

Page1 / 3

q3 sol6 - CSCI.1100 Computer Science I Quiz 3 September 28,...

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

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