QUESTIONS AND CORRECT ANSWERS
Iostream - CORRECT ANSWER preprocessor drive
You can change switch statement to if/else but you can't? - CORRECT ANSWER change if/else
to switch case
What is allowed in switch case - CORRECT ANSWER int and char
Variable - CORRECT ANSWER storage location in memory
Variables can't contain? - CORRECT ANSWER . , begin with digit, $
Short int and unsigned - CORRECT ANSWER 2 bytes
Int and unsigned int, long, long unsigned - CORRECT ANSWER 4 bytes
Unsigned and long long int - CORRECT ANSWER 8 bytes
Int checking = 300 - CORRECT ANSWER 300 is integer literal
To store an integer constant in a long memory location, put 'L' at the end of the number: - CORRECT
ANSWER 1234L
Float - CORRECT ANSWER 4 bytes
Double and long - CORRECT ANSWER 8 bytes
Sizeof operator - CORRECT ANSWER gives the size of any data type or variable
, Heierchy of types - CORRECT ANSWER long double
Double
Float
Unsigned long
Long
Unsigned int
Int
(ranked by how much they can hold)
For(x=1, x< 5, x++) - CORRECT ANSWER x=1 is initialization expression
X++ is test expression
The scope of x is the for loop
The while loop is a conditional pretest loop - CORRECT ANSWER Iterates as long as a certain
condition exits
Validating input
The do-while loop is a conditional posttest loop - CORRECT ANSWER Always iterates at least
once
The for loop is a pretest loop - CORRECT ANSWER Built-in expressions for initializing,
testing, and updating
Situations where the exact number of iterations is known
File stream types: - CORRECT ANSWER ifstream for input from a file
Ofstream for output to a file
Fstream for input from or output to a file
Define file stream objects: - CORRECT ANSWER ifstream infile;
Ofstream outfile;