Methods
Input/Output
Loops
Conditionals
General
100
What does void mean?
Void means the method doesn't return anything.
100

string line = "Look at me, I can write C++ code!";
cout << "Hey! " << line << endl;

Hey! Look at me, I can write C++ code!
100
Name at least three different kinds of loops.
for
while
do-while
100

int i = 0;
if(i >= 0)
{
 cout << i << endl;
}

0
100
int, double, char, string, etc. are examples of what?
types
200

void printMe(int i)
{
 cout << i << endl;
}

/*********************/
printMe(1);
printMe(2);

1 2
200

If I have an int called 'n', how do I read an integer from the user into it?

cin >> n;
200

bool ShouldContinue = true;
while(ShouldContinue)
{
 ShouldContinue = false;
 cout << "hi!" << endl;
}

hi!
200

int n = 6;
if(isDivisibleBy2(n))
{
 cout << "divisible by 2" << endl;
}
else if(isDivisibleBy3(n))
{
 cout << "divisible by 3" << endl;
}

divisible by 2
200

What are the things between the parentheses called?
int sum(int n1, int n2)

arguments or parameters to a method
300

void printMe(int i)
{
 cout << i << endl;
}

/*********************/
int i = 0;
printMe(i);
i = 5;
printMe(5);

0 5
300

What object of the istream class is used to accept the input from the standard input stream?

cin

300

int i = 0;
do
{
  cout << i << endl;
 ++i;
} while(i < 3);

0
1
2
300

string movie = "Sleepy Hollow";
if(movie == "sleepy hollow")
{
 cout << "found it" << endl;
}

This space has been intentionally left blank.
300
ifstream, ofstream, string, are what?
Classes
400

void printMe(int i)
{
 cout << i << endl;
}

/*********************/
int n = 37;
++n;
printMe(n);

38
400

Imagine numbers.txt contains:
37
25
-2
54

What does the following code print out?

ifstream f("numbers.txt");
while(f.good())
{
 string s;
 getline(f, s);
 cout << s << endl;
}

37

25

-2

54

400

int i = 3;
do
{
 cout << i << endl;
 --i;
} while(i > 0);

3
2
1
400

string movie = "Terminator";
if(movie == "Terminator") && movie.find("Term") != string::npos)
{
 cout << "found it" << endl;
}

found it
400

Given:
float calculateArea(float length, float width);

Is this statement:
A - Function definition
B - Function prototype
C - Function call
D - Function method

B - Function prototype

500

void changeMe(int i)
{
 i = 5;
}

/*********************/
int n = 37;
changeMe(n);
cout << n << endl;

37
500
What will display from the following:

enum Colors  
    {Red, Orange, Blue=3, Indigo ,Violet, Black};
Colors Yellow;

Yellow = (Colors)2;
cout << Black << endl;

6

500

for(int i = 0 ; i < 5; ++i)
{
 cout << (i + 1 * 2) << endl;
}

2
3
4
5
6
500

string movie = "Lord of the Rings";
string userMovie = "lord";
if(movie == userMovie)
{
 cout << "case 1" << endl;
}
else if(movie.find(userMovie) != string::npos)
{
 cout << "case 2" << endl;
}
else
{
 cout << "else" << endl;
}

else
500
What's the difference between running with and without a debugger?
If you run without a debugger, breakpoints are ignored.
M
e
n
u