Name_______________________
Login___________________SID________
CS 010: Introduction to
Computer Science I
Quiz 3: 10 minutes
- setprecision(2)
and fixed manipulators in an cout statement will cause all
following output of double values to show exactly 2 digits after the
decimal place until it is explicitly changed.
a.
TRUE
b.
FALSE
- setw(8)
manipulator in a cout statement will cause all following
output of any type to be displayed within 8 spaces until it is explicitly
changed.
a.
TRUE
b.
FALSE
- If
the data being output after a setw(8) manipulator needs more than 8
spaces, only the first 8 characters will be output.
a.
TRUE
b.
FALSE
- Time
is a built-in or fundamental type of C++.
a.
TRUE
b.
FALSE
- Which
statement in the following code fragment has an error and which type of
error is it?
Time dinner_time = Time(19,30,0);
dinner_time.add_seconds(1800);
cout << dinner_time;
- The
first statement has a syntax error
- The
first statement has a logic error
- The
second statement has a syntax error
- The third statement has a
syntax error
- The
third statement has a logic error
- There
are no errors in this code fragment.
- Which
statement(s) in the following code fragment has a syntax error?
Circle c1(Point(4,5), 3.5);
c1.move(-2.5,2);
cwin << c1;
- The
first statement
- The
second statement
- The
third statement
- The
first and second statements
- The
second and third statements
- There are no syntax errors
in this code fragment
- What
is the value of start.get_x() and line1.get_start() after the following
code fragment?
Point start = Point(3,4);
Point end = Point(4,5);
Line line1 = Line(start, end);
line1.move(1,0);
- 3 and Point(4,4)
- 4
and Point(4,4)
- 3
and Point(3,4)
- 4
and Point(4,5)
- None
of the above
- Which
of the following is not a legal statement?
- Time
now;
- Time now();
- Time
now(4,0,0);
- Time
now = Time(4,0,0);
- none
of the above
- Which
statement has a syntax error, given that c is a properly constructed
Circle object, and ln is a properly constructed Line object?
- Point
p = Point(1,2);
- Point
p = c.get_center();
- Point
p = ln.get_start();
- Point p = c.move(1,3);
- None
of the above
- What output by the following code fragment?
Point p1 = Point(0,0);
Point p2 = p1;
p1.move(-3,3);
p2.move(3,-3);
cwin << Line(p1,p2);
p1.move(0,-6);
p2.move(0,6);
cwin << Line(p1,p2);
- a
square
- parallel
lines
- a shape in the form of an
x
- a
shape in the form of a +
- none
of the above