George Boole was a 19th century mathematician... self-educated...
began teaching at age 16... became a professor at Queen's College
in York...
Sentinel's value is best declared
as a ----- Why? |
const int sentinel = -1;
// so it won't change while
(score != sentinel) { the loop } |
Specify which kind of parameter
to make a function use (but not update) the value of a variable? |
Value. |
sqrt: What forms can the argument
supplied to a sqrt take? |
Variable or constant, or even an expression. |
Stream extraction operator looks
like this ----- and "says" ----- |
<<; "extract the next value from the stream
named cin and assign it to the next-named variable." |
string& is read (spoken) as ----- |
string reference. |
Structs collect like values; arrays
collect unlike values. Agree? |
Better not agree. It's the exact opposite.
|
Swap: How to swap 2 strings? |
void swap (string& s1, string& s2) { string temp; // to swap ints, rewrite as
int temp temp = s1; s1 = s2; s2 = temp; } |
T/F? ! is executed before *. |
T. |
T/F? Declarations go at the top
of the program. T/F? Definition headers have semicolons. T/F? Declarations don’t have semicolons. |
T. F. F. |
T/F? Rows are horizontal; columns
are vertical. |
T. |
T/F? To make an array pass by
reference, all you have to do is add the &. |
F. Arrays are automatically reference parameters,
even without the &. |
T/F? You can't later assign or
reassign values to const var_name& |
T. It's protected from change by const, despite
the &. |
The keyword for the end of line
manipulator: |
endl |
The stream insertion operator
looks like this ----- and "says" ----- |
<<; "insert the value that follows into the
stream named cout." |
There are 2 ways to change a variable
in a statement that calls a function. What are they? |
Use a reference parameter; use a value-returning
function with an assignment statement, eg. b = find_this(x,
y) |
To ----- is to tell the compiler
what datatype (or type of parameter) this variable is. To ----- is to cause the compiler
to set aside memory at compile time. |
declare; define. |
To implement a decision step,
use ----- to implement a conditional loop,
use ----- |
if; while.
|
Value parameters: When the value
of a value parameter is changed, you're not changing the
argument. You're only changing a copy of it. T/F?
|
T. Because a value parameter has its own
memory cell which receives a copy of the value of the matched
argument. |
Value-returning functions should
only be used when their sole purpose is to ----- |
calculate and return a single value. No values
should be read in or printed out in their bodies. |
Void: The call to a void function
is a complete statement. T/F? |
T. By contrast, the call to a value-returning
function is part of an expression in an assignment or output
statement. |
Void: Will a void main compile? |
Yes -
void main( ). |
What datatype is like a record
in a database? |
struct (it contains collections of different
values). |
Which stream transmits from the
program to the monitor? |
ostream. (and the istream transmits from
keyboard to program.) |
while (Boolean expression) # {statement;}
# What
replaces the # signs? |
Nothing, then nothing. |
Why are arrays only passed by
reference? |
It would waste time and memory to copy big
arrays when only some cells are to be changed. |
Why does & not contradict/counteract
const? |
(It doesn’t, but how to explain this??) |
You'll get an error message if
you don’t return a value of the datatype specified. True? |
True. But remember that unspecified is taken
as int. |
*George Boole also developed the foundations for a formal calculus.
But you knew that, didn't you? -- talk about clever!
Home |