Name: 
 

ITF c++



True/False
Indicate whether the statement is true or false.
 

 1. 

In our class, you will always add IDOC.
 

 2. 

In this class IDOC is optional.
 

 3. 

The following is an example of what we call IDOC

}//end main
 

 4. 

In this class, end brace comments are required.
 

 5. 

In this class, end brace comments are optional.
 

 6. 

A program will NOT compile if an end brace comment is missing.
 

 7. 

A program will compile if an end brace comment is missing.
 

 8. 

In this class, IDOC is located at the top of every program.
 

 9. 

In this class, IDOC is located at the bottom of every program.
 

 10. 

In this class, //name is one of the required lines of IDOC.
 

 11. 

In this class, //name is one of the required lines of IDOC and is located at the bottom of the program.
 

 12. 

In this class, //date is one of the required lines of IDOC.
 

 13. 

In this class, //date is one of the required lines of IDOC and is located at the bottom of the program.
 

 14. 

In this class, //class period is one of the required lines of IDOC and is located at the bottom of the program.
 

 15. 

The short cut for duplicating a line in the Bloodshed compiler is ctrl-e.
 

 16. 

The short cut for duplicating a line in the Bloodshed compiler is ctrl-d.
 

 17. 

The short cut for duplicating a line in the Bloodshed compiler is alt-d.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 18. 

Which is NOT a part of the IDOC?
a.
}//end main
b.
//name
c.
//period
d.
//date
e.
None of these.
f.
All of these.
 

 19. 

What is the output of the following statement?

cout << 4 * (15 / (1 + 3)) << endl;
a.
15
b.
12
c.
63
d.
72
e.
None of these
 

 20. 

Which character signifies the beginning of an escape sequence?
a.
//
b.
/
c.
\
d.
#
e.
{
 

 21. 

This control sequence is used to skip over to the next horizontal tab stop.
a.
\n
b.
\h
c.
\t
d.
\a
e.
\'
 

 22. 

Look at the following program and answer the question that follows it.

1
 // This program displays my gross wages.
2
 // I worked 40 hours and I make $20.00 per hour.
3
 #include <iostream>
4
 using namespace std;
5
  
6
 int main()
7
 {
8
    int hours;
9
    double payRate, grossPay;
10
  
11
    hours = 40;
12
    payRate = 20.0;
13
    grossPay = hours * payRate;
14
    cout << "My gross pay is $" << grossPay << endl;
15
    return 0;
16
 }

Which line(s) in this program cause output to be displayed on the screen?
a.
13 and 14
b.
8 and 9
c.
14
d.
13
e.
15
 

 23. 

What will the following code display?

cout << "Monday";
cout << "Tuesday";
cout << "Wednesday";
a.
Monday
Tuesday
Wednesday
b.
Monday Tuesday Wednesday
c.
MondayTuesdayWednesday
d.
"Monday"
"Tuesday"
"Wednesday"
 

 24. 

What will the following code display?

int number = 7;
cout << "The number is " << "number" << endl;
a.
The number is 7
c.
The number is7
b.
The number is number
d.
The number is 0
 

 25. 

What will the following code display?

int x = 0, y = 1, z = 2;
cout << x << y << z << endl;
a.
0  1  2
b.
0
1
2
c.
xyz
d.
012
 

 26. 

What will the following code display?

   cout << "Four\n" << "score\n";
   cout << "and" << "\nseven";
   cout << "\nyears" << " ago" << endl;
a.
Four
score
and
seven
years ago
b.
Four score and seven
years ago
c.
Four
score
and seven
years ago
d.
Four score
and seven
years ago
 

 27. 

What will the following code display?

   cout << "Four " << "score ";
   cout << "and " << "seven/n";
   cout << "years" << "ago" << endl;
a.
Four score and seven
yearsago
b.
Four score and seven
years ago
c.
Four score and seven/nyearsago
d.
Four
score
and
seven
yearsago
 

 28. 

What will the following code display?*****graded incorrectly*****

   cout << "Four " << "score ";
   cout << "and " << "seven\n";
   cout << "years" << "ago" << endl;
a.
Four score and seven
yearsago
b.
Four score and seven
years ago
c.
Four score and seven/nyearsago
d.
Four
score
and
seven
yearsago
 

 29. 

What will the following code display?

   cout << "Four" << "score" << endl;
   cout << "and" << "seven" << endl;
   cout << "years" << "ago" << endl;
a.
Four
score
and
seven
years
ago
b.
Four score and seven years ago
c.
Fourscoreandsevenyearsago
d.
Fourscore
andseven
yearsago
 

 30. 

What will the following code display?

   cout << "Four" << "score" ;
   cout << "and" << "seven" ;
   cout << "years" << "ago" ;
a.
Four
score
and
seven
years
ago
b.
Four score and seven years ago
c.
Fourscoreandsevenyearsago
d.
Fourscore
andseven
yearsago
 

Short Answer
 

 31. 

What are the first 3 things you add to every program written in this class?
 



 
Check Your Work     Start Over