PSU CS 101 FULL REVISION NOTES WITH
ALGORITHMS, DATA STRUCTURES, AND BASIC
CODING CONCEPTS
◉ !((numPeople > 10) && (numCars > 2)).
Answer: The && expression is false. So !(false) is true.
◉ %.
Answer: modulo (remainder
◉ modf.
Answer: Break into fractional and integral parts.
◉ Iterate until c equals 'z'.
Answer: c != 'z'
◉ bool(short for Boolean).
Answer: data type is for variables that store only values true or false.
◉ Binary operators.
,Answer: The relational operators and logical operators (except for !)
are binary operators.
Take two operands (from the left and right) and evaluate to true or
false.
◉ bitewise.
Answer: perform AND or OR on corresponding individual bits of the
operand.
◉ Mixing bitwise and logical operators.
Answer: x == 3 | y > 1 && z != 3
Answer= ((x == 3) || (y > 1)) && (z!= 3)
◉ Short circuit evaluation.
Answer: skips evaluating later operands if the result of the logical
operator can already be determined.
◉ Switch.
Answer: statement can more clearly represent multi-branch
behavior involving a variable being compared to constant values.
◉ case.
,Answer: whose constant comparison matches the value of the
switch expression, executes that case's statements, and then jumps
to the end.
◉ default case.
Answer: in no case matches, statements are executed
◉ break.
Answer: statement for a case will cause the statements within the
next case to be executed.
◉ Boolean.
Answer: refers to a quantity that has only two possible values, true
or false.
◉ bool.
Answer: for representing Boolean quantities
◉ index.
Answer: Each string character has a position number
◉ at().
, Answer: the notation someString. at (0) access the character at a
particular index of a string, in this case index 0.
◉ common error.
Answer: is to access an invalid array index, especially exactly one
larger than the largest index.
◉ exception.
Answer: is a detected runtime error that commonly prints an error
message and terminates the program.
◉ Good practice.
Answer: is to use .at() rather than brackets for accessing a string's
characters, due to .at()'s error checking.
◉ conditional expression.
Answer: condition ? exprWhenTrue : exprWhenFalse
◉ ternary operator.
Answer: A conditional expression has three operands and thus the
"?" and ":" together are sometimes referred to.
◉ epsilon.
ALGORITHMS, DATA STRUCTURES, AND BASIC
CODING CONCEPTS
◉ !((numPeople > 10) && (numCars > 2)).
Answer: The && expression is false. So !(false) is true.
◉ %.
Answer: modulo (remainder
◉ modf.
Answer: Break into fractional and integral parts.
◉ Iterate until c equals 'z'.
Answer: c != 'z'
◉ bool(short for Boolean).
Answer: data type is for variables that store only values true or false.
◉ Binary operators.
,Answer: The relational operators and logical operators (except for !)
are binary operators.
Take two operands (from the left and right) and evaluate to true or
false.
◉ bitewise.
Answer: perform AND or OR on corresponding individual bits of the
operand.
◉ Mixing bitwise and logical operators.
Answer: x == 3 | y > 1 && z != 3
Answer= ((x == 3) || (y > 1)) && (z!= 3)
◉ Short circuit evaluation.
Answer: skips evaluating later operands if the result of the logical
operator can already be determined.
◉ Switch.
Answer: statement can more clearly represent multi-branch
behavior involving a variable being compared to constant values.
◉ case.
,Answer: whose constant comparison matches the value of the
switch expression, executes that case's statements, and then jumps
to the end.
◉ default case.
Answer: in no case matches, statements are executed
◉ break.
Answer: statement for a case will cause the statements within the
next case to be executed.
◉ Boolean.
Answer: refers to a quantity that has only two possible values, true
or false.
◉ bool.
Answer: for representing Boolean quantities
◉ index.
Answer: Each string character has a position number
◉ at().
, Answer: the notation someString. at (0) access the character at a
particular index of a string, in this case index 0.
◉ common error.
Answer: is to access an invalid array index, especially exactly one
larger than the largest index.
◉ exception.
Answer: is a detected runtime error that commonly prints an error
message and terminates the program.
◉ Good practice.
Answer: is to use .at() rather than brackets for accessing a string's
characters, due to .at()'s error checking.
◉ conditional expression.
Answer: condition ? exprWhenTrue : exprWhenFalse
◉ ternary operator.
Answer: A conditional expression has three operands and thus the
"?" and ":" together are sometimes referred to.
◉ epsilon.