what do // mark the beginning of?
a comment
Comments are generally added to programs because
many programs are complicated and comments help explain what is going on
the line in the program that begins with a # is called a
preprocessor directive
Reads your program before it is compiled and only executes those lines beginning with the # symbol
prepocessor directive
“sets up” your source code for the compiler
preprocessor directive
C++ uses ___ to organize the names of program entities.
namespaces
A group of one or more programming statements that collectively has a name
function
The character escape sequence to force the cursor to go to the next line is:
The character escape sequence to force the cursor to advance forward to the next tab setting is:
The character escape sequence to represent a single quote is:
The character escape sequence to represent a double quote is:
The character escape sequence to represent a backslash is:
How many spaces printed out by this statement: cout << “how” << “now” << “brown” << “cow” << “?”;
0
How many spaces printed out by this statement: cout << “abc
def ghi
jkl” << endl << endl << “mno

pqr
“;

6
How many bytes are needed to store: ‘n’ ?
1
How many bytes are needed to store: “n” ?
2
How many bytes are needed to store: ‘
‘ ?
1
How many bytes are needed to store: ”
“, ?
2
How many bytes are needed to store: ”
” ?
3
How many bytes are needed to store: “” ?
1
What’s the difference in UNICODE value between ‘E’ and ‘A’? (consult a table of UNICODE values):
4
What’s the difference in UNICODE value between ‘e’ and ‘a’? (consult a table of UNICODE values):
4
What’s the difference in UNICODE value between ‘3’ and ‘0’? (consult a table of UNICODE values):
3
What’s the difference in UNICODE value between ‘6’ and ‘0’? (consult a table of UNICODE values):
6
Does this line contain a valid comment?
int twoPi = 3.14459; / holds the value of two times pi /
Yes
Does this line contain a valid comment?
/ This is a //// First Rate Program //*//
No
Write a character literal representing the (upper case) letter A .
‘A’
Write a character literal representing a comma.
‘,’
Write a character literal representing the digit 1 .
‘1’
Write a literal representing the character whose ASCII value is 65 .
65
Write a literal representing the largest character value . Suppose we are using unsigned one-byte characters .
255
Declare a character variable named c .
char c;
Write the necessary preprocessor directive to enable the use of the C++ string class .
#include <string>
Declare a string variable named mailingAddress .
string mailingAddress;
Declare 3 string variables named winner , placed and show .
string winner, placed, show;
Declare a string variable named empty and initialize it to the empty string .
string empty;
Declare a string variable named oneSpace and initialize it to a string consisting of a single space.
string oneSpace;

oneSpace = ” “;

Assume that message is a string variable . Write a statement to display its value on standard output .
cout << message ;
Assume that word is a string variable . Write a statement to display the message “Today’s Word-Of-The-Day is: ” followed by the value of word on standard output .
cout << “Today’s Word-Of-The-Day is: ” << word ;
Expressions that have a true or false value
Boolean expressions
Write a literal representing the false value in C++.
false
Write a literal representing the true value .
true
Declare a variable isACustomer , suitable for representing a true or false value .
bool isACustomer;
Declare a variable hasPassedTest , and initialize it to true .
bool hasPassedTest;

hasPassedTest = true;

useful for evaluating conditions that are either true or false
bool variables
Declare and initialize the following variables :
A variable monthOfYear , initialized to the value 11
A variable companyRevenue , initialized to the value 5666777
A variable firstClassTicketPrice , initialized to the value 6000
A variable totalPopulation , initialized to the value 1222333
int monthOfYear = 11, companyRevenue = 5666777, firstClassTicketPrice = 6000, totalPopulation = 1222333;
How is a value stored in a variable?
assignment statement
perform operations on data
assignment operator
the data that operators work with
operands
assign values to variables as part of the definition
initialization
Declare an integer variable cardsInHand and initialize it to 13.
int cardsInHand = 13;
Declare a variable temperature and initialize it to 98.6.
float temperature = 98.6;
the part of the program that has access to the variable
scope
Used to define variable that can hold real numbers; a data type that allows fractional values
floating-point data types
3 data types that can represent floating point numbers
float or single precision (4 bytes)
double or double precision (8 bytes)
long double or long double precision (8 bytes)
Declare a numerical variable precise and initialize it to the value 1.09388641.
double precise = 1.09388641;
Declare a string variable named str and initialize it to Hello .
string str;

str = “Hello”;

Write a declaration of an int variable year and initialize it to 365.
int year = 365;
Write a statement that declares an int variable presidentialTerm and initializes it to 4.
int presidentialTerm = 4;
Write a statement to set the value of num to 4 (num is a variable that has already been declared ).
num = 4;
Given two double variables , bestValue and secondBestValue , write some code that swaps their values . Declare any additional variables as necessary.
double temp;

temp = bestValue;
bestValue = secondBestValue;
secondBestValue = temp;

int temp;
temp=firstPlaceWinner;
firstPlaceWinner=secondPlaceWinner;
secondPlaceWinner=temp;
x

Hi!
I'm Niki!

Would you like to get a custom essay? How about receiving a customized one?

Check it out