Name_______________________ Login___________________SID________

 

CS 010: Introduction to Computer Science I

Quiz 3: 10 minutes

 

  1. Which of the following data types are NOT built-in to the language C++? (Hint: you do not need to include a library to use a built-in type)

 

a.      int

b.      Time

c.      string

d.      double

e.      B and C

f.        None of the above

 

  1. Using the setw(8) manipulator in a cout statement will cause all output after that to be output lined up to the right of 8 spaces?

 

a.      TRUE

b.      FALSE

 

  1. What will be output by the following statements?

 

Time t1(10,15,20);

cout << t1.get_hours();

 

a.      10

b.      15

c.      20

d.      10:15:20

e.      Depends on what time this program executes.

f.        None of the above

 

  1. What will be output by the following statements?

 

Time t2(10,15,20);

t2.add_seconds(100);

cout << t2.get_minutes();

 

a.      10

b.      15

c.      20

d.      17

e.      120

f.        Depends on what time this program executes.

 


  1. What is the value of the x coordinate of the Point p after the following statements?

 

Point p(0,0);

p.move(1,2);

 

    1. 0
    2. 1
    3. 2
    4. None of the above

 

  1. What is the value of the center Point of the Circle c after the following statements?

 

Point center(0,0);

Circle c(center, 2.5);

c.move(1,2);

 

    1. Point(0,0)
    2. Point(1,2)
    3. Point(1,0)
    4. Point(0,2)
    5. Point(2.5,2.5)
    6. None of the above

 

  1. What is the value of the Point variable called center after the statements in Question 6? (BE CAREFUL! This is the A+ question on this quiz.)

 

    1. Point(0,0)
    2. Point(1,2)
    3. Point(1,0)
    4. Point(0,2)
    5. Point(2.5,2.5)
    6. None of the above

 

  1. The following statement has a syntax error (provided all appropriate libraries were included).

 

cwin << Circle(Point(5,100), 5.8);

 

    1. TRUE
    2. FALSE

 

  1. The second of the following statements has a syntax error (provided all appropriate libraries were included)?

 

Point p;

cin >> p;

 

    1. TRUE
    2. FALSE

 


  1. What will be output to the graphics window given the following code?

 

Point p1(0,0);

Point p2 = p1;

p2.move(0,-3);

cwin << Line(p1,p2);

p2 = p1;

p1.move(-1,0);

p2.move(1,0);

Line line1(p1,p2);

cwin << line1;

line1.move(0,-3);

cwin << line1;

 

    1. A shape in the form of a capital F
    2. A shape in the form of a capital C
    3. A shape in the form of a capital I
    4. A shape in the form of a triangle
    5. A shape in the form of a rectangle
    6. 3 parallel lines