Name_______________________
Login___________________SID________
CS 010: Introduction to Computer Science I
Quiz 4: 10 minutes
- Which statement would use the following coordinate system?

- cwin.coord(40, 10, -20, 50);
- cwin.coord(-20, 40, 10, 50);
- cwin.coord(-20, 50, 10, 40);
- cwin.coord(10, 40, -20, 50);
- cwin.coord(-20, 40, 50,
10);
- The following is a valid statement.
cwin << Point(0,
cwin.get_int(“What is your favorite number?”));
- TRUE
- FALSE
- If the condition in an if structure is FALSE, the
program will end.
- TRUE
- FALSE
- Using an assignment operator in the condition of an if
structure will result in a syntax error.
- TRUE
- FALSE
- Given the format of the if-else structure below,
one and only one of the statement sets inside of the bodies of the if and
else will be executed.
if (------)
{
stmt set 1;
}
else
{
stmt set 2;
}
- TRUE
- FALSE
- Given the following code, what will be the output,
assuming the user enters 14.25.
int num;
cout <<
“Enter an integer: “;
cin >> num;
if (cin.fail())
{
cout << “Output
1\n”;
}
else
{
cout << “Output
2\n”;
}
- Output 1
- Output 2
- Given the code from the above question, what will be the
output, assuming the user enters .11.
- Output 1
- Output 2
- Given the following code, and that the user entered the
string “Goodbye”, what will be the output?
string str = “Hello”;
string word;
cout << “Enter a word: “;
cin >> word;
if (word < str)
{
str = word;
}
cout << str;
- Hello
- Goodbye
- None of the above
- Given the following code, what will be the output?
int x = 1;
int y = 2;
if (x < y)
{
cout << x;
}
cout << y;
- 1
- 2
- x
- y
- 12
- What will be the output of the following code segment?
int x = 0;
int y = 3;
if (x < 1)
{
cout <<
"stmt 1 ";
x = y;
}
if (x > 1)
{
cout <<
"stmt 2 ";
}
else
{
cout <<
"stmt 3 ";
}
a. stmt
1
b. stmt
2
c.
stmt 1 stmt 2
d. stmt
1 stmt 2 stmt 3
e. stmt
1 stmt 3