Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
35 Cards in this Set
- Front
- Back
Who developed the C++ programming language?
|
Bjarne Stroustrup
|
|
What is used to represent the standard output stream in C++?
|
cout <<
|
|
What is used to represent the standard input stream in C++?
|
cin >>
|
|
How many 'main' functions can your C++ program contain?
|
one
|
|
Which standard library is needed to support cin and cout?
|
iostream
|
|
Is C++ case sensitive?
|
Yes.
For example, 'student' and 'STUDENT' are two different identifiers. |
|
What are the two different forms of commenting in C++?
|
Use // on the same line or enclose one or more lines between /* and */.
// This is a comment /* This is a comment on two different lines. */ |
|
How much memory used for an int?
|
4 bytes
|
|
How much memory used for a double?
|
8 bytes
|
|
How much memory used for a char?
|
1 byte
|
|
What is the shorthand notation for, total = total * 2;
|
total *= 2;
|
|
Which escape sequence is used for a new line?
|
\n
|
|
Which escape sequence is used for a tab?
|
\t
|
|
How would you declare and initialize an integer called MAX as a constant with a value of 100?
|
const int MAX = 100;
|
|
With integer division, what is the ouput?
cout << 25/3 << endl; |
8
|
|
What is the output?
cout << 33%9 << endl; |
6
|
|
What is the increment operator?
|
++
|
|
What is the decrement operator?
|
--
|
|
What is the output?
int num = 5; num++; cout << num << endl; |
6
|
|
To prevent you from having to use the prefix std:: for cin and cout, what should you type at the beginning of your program?
|
using namespace std;
|
|
What is the output?
num = (2/5) * 4; cout << "(2/5) * 4 = " << num << endl; |
(2/5) * 4 = 0
Remember integer division discards the remainder. 2/5 equals 0, so 0 * 4 = 0. |
|
Reserved words can be used as variables within your program?
|
False
see Appendix 1 for list of keywords |
|
An identifier can consist of letters, numbers and underscores but must begin with a letter or underscore.
|
True
|
|
What is the C++ operator for modulus?
|
%
|
|
The modulus operator will work with doubles?
|
False
|
|
What is called the statement terminator in C++?
|
semicolon
|
|
If a = 4, b = 5 and c = 6, evaluate the following expression,
(a + b) % c |
3
|
|
The following variables are ALL illegal
main _hello #num 9_go 5x5 |
False
_hello is legal |
|
The statement,
num = 20 * ( 10 + 2 ); will assign the value 240 to num? |
True
|
|
Which C++ symbol is used as the multiplication operator?
|
*
|
|
The value of the expression 81 % 573 is 81.
|
True
|
|
Evaluate the following expression,
((15 % 4) * (15 / 4)) |
9
|
|
Consider the following code,
int a; char b; cin >> a >> b; If the user enters, 55.1 Z What are the values for 'a' and 'b'? |
a = 55
b = . |
|
Using type conversion, what does the following expression evaluate to
static_cast<int>(8.9) |
8
|
|
Which cout manipulator is used to set the decimal place for a floating-point number to 3?
|
cout.precision(3)
|