Name:     ID: 
 
Email: 

ITF c++

Short Answer
 

 1. 

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

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

 2. 

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

 3. 

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

 4. 

In this class, end brace comments are required.
 

 5. 

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

 6. 

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

 7. 

The following is an example of what we call IDOC

}//end main
 

 8. 

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

 9. 

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

 10. 

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

 11. 

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

 12. 

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

 13. 

In this class, end brace comments are optional.
 

 14. 

In this class IDOC is optional.
 

 15. 

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

 16. 

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

 17. 

In our class, you will always add IDOC.
 

 18. 

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

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

 19. 

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

 20. 

What will the following code display?

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

 21. 

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

 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.
14
b.
8 and 9
c.
15
d.
13
e.
13 and 14
 

 23. 

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
 

 24. 

What will the following code display?

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

 25. 

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

 26. 

What will the following code display?

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

 27. 

What will the following code display?

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

 28. 

What will the following code display?

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

 29. 

What is the output of the following statement?

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

 30. 

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
yearsago
d.
Four score and seven/nyearsago
 

 31. 

What will the following code display?

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



 
         Start Over