old quizes cpe 112

Page 1

Spring 2011

CPE112 – Quiz #2 – Chapter 3 (10 pts)

Name _________________________________

TIME:

February 2, 2011 12:45

5:30

1) (2 pts) Fill in the blanks shown to indicate the output for the following C++ code segment cout << “Result is: “ << 16/5 << “ and “ << 16%5 << endl;

Result is: _____ and _____ 2) (1 pt) Fill in the blank shown to indicate the output for the following C++ code segments float num = 3.75; cout << “Num is: “ << num << endl;

Num is: _____ 3) (1 pts) Fill in the blank shown to indicate the output for the following C++ code segment string str1 = “This is it”; cout << “Size: “ << str1.size() << endl;

Size: ____________ 4) (2 pts) What is the output for the following C++ statement? Place a single character in each box, Skip a box to indicate a space. cout << setw(6) << left << “Hi” << setw(6) << right<< “bye” << endl;

5) (1 pt) Once invoked, the output manipulators showpoint, fixed and setprecision all hold for subsequent output statements? TRUE FALSE 6) (1 pt) Once invoked, the output manipulator setw holds for all subsequent output statements? TRUE

FALSE

7) (1 pt) Make an integer variable declaration for the identifier num.

8) (1 pt) Make a double variable declaration for the identifier average.

9) (1 pt) Type Casting is the explicit (done by the programmer) conversion of one data type to another TRUE

FALSE

10) (1 pt) The statement a = a + b*a +c*a; is a valid C++ assignment statement TRUE

FALSE


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.