Arithmetic operators -------------------- Addition operator Correctly evaluating an addition expression Precedence of + operator Associativity of + operator Conversion automatically done when operands of + are of different data types Subtraction operator Correctly evaluating a subtraction expression Precedence of - operator Associativity of - operator Conversion automatically done when operands of - are of different data types Multiplication operator Correctly evaluating a multiplication expression Precedence of * operator Associativity of * operator Conversion automatically done when operands of * are of different data types Division operator Correctly evaluating an integer division expression Correctly evaluating a real division expression Precedence of / operator Associativity of / operator Conversion automatically done when operands of / are of different data types Divide by zero error Remainder or Modulus operator Correctly evaluating a remainder expression Precedence of % operator Associativity of % operator Divide by zero error in modulus expression Modulus (%) operator applied to real operands Parenthesis applied to arithmetic expressions How parentheses affect the precedence in arithmetic expressions The associativity of parentheses in arithmetic expressions Relational Operators -------------------- Correctly evaluating a less-than expression Precedence of < operator Associativity of < operator Correctly evaluating a <= expression Precedence of <= operator Associativity of <= operator Correctly evaluating an equality expression Precedence of == operator Associativity of == operator Correctly evaluating a != expression Precedence of != operator Associativity of != operator Correctly evaluating a greater-than expression Precedence of > operator Associativity of > operator Correctly evaluating a >= expression Precedence of >= operator Associativity of >= operator Precedence of +, - versus ==, != Precedence of +, - versus <, <=, >, >= Precedence of *, /, % versus ==, != Precedence of *, /, % versus <, <=, >, >= Parenthesis applied to relational expressions How parentheses affect the precedence in relational expressions The associativity of parentheses in relational expressions Logical Operators ----------------- Correctly evaluating an and expression Correctly evaluating an and expression with boolean operands Correctly evaluating an and expression with non-boolean operands Incorrect operand type for and (&&) operator Short circuit evaluation of and expression Correctly evaluating short circuit and expression with boolean operands Correctly evaluating short circuit and expression with non-boolean operands Precedence of && operator Correctly evaluating the precedence of and with respect to other logical operators Correctly evaluating the precedence of and with respect to non-logical operators Associativity of && operator Correctly evaluating an or expression Correctly evaluating an or expression with boolean operands Correctly evaluating an or expression with non-boolean operands Incorrect operand type for or (||) operator Short circuit evaluation of or expression Correctly evaluating short circuit or expression with boolean operands Correctly evaluating short circuit or expression with non-boolean operands Precedence of || operator Correctly evaluating the precedence of or with respect to other logical operators Correctly evaluating the precedence of or with respect to non-logical operators Associativity of || operator Correctly evaluating a not expression Correctly evaluating a not expression with boolean operands Correctly evaluating a not expression with non-boolean operands Precedence of ! operator Correctly evaluating the precedence of not with respect to other logical operators Correctly evaluating the precedence of not with respect to non-logical operators Associativity of ! operator Parenthesis applied to logical expressions How parentheses affect the precedence in logical expressions The associativity of parentheses in logical expressions Assignment Operators: --------------------- Correctly evaluating a simple assignment Correctly evaluating a self-referential assignment (same variable on both sides) Precedence of = operator Associativity of = operator Conversion automatically done when operands of = are of different data types Conversion automatically done when value of a smaller data type is assigned to a variable of a larger data type Conversion automatically done when value of a larger data type is assigned to a variable of a smaller data type Correctly evaluating a compound arithmetic assignment Correctly evaluating a compound bitwise assignment Precedence of compound assignment operators Associativity of compound assignment operators Conversion automatically done when operands of compound assignment are of different data types Conversion automatically done when value of a smaller data type is assigned to a variable of a larger data type Conversion automatically done when value of a larger data type is assigned to a variable of a smaller data type Associativity of prefix increment and decrement operators Correctly evaluating prefix increment Precedence of prefix increment operator Correctly evaluating prefix decrement Precedence of prefix decrement operator Correctly evaluating postfix increment Precedence of postfix increment operator Correctly evaluating postfix decrement Precedence of postfix decrement operator Parenthesis applied to assignment expressions How parentheses affect the precedence in assignment expressions The associativity of parentheses in assignment expressions Bitwise Operators ----------------- Precedence of & operator Precedence of & operator with respect to other bitwise operators Precedence of & operator with respect to non-bitwise operators Associativity of & operator Precedence of | operator Precedence of | operator with respect to other bitwise operators Precedence of | operator with respect to non-bitwise operators Associativity of | operator Precedence of ^ operator Precedence of ^ operator with respect to other bitwise operators Precedence of ^ operator with respect to non-bitwise operators Associativity of ^ operator Precedence of << operator Precedence of << operator with respect to other bitwise operators Precedence of << operator with respect to non-bitwise operators Associativity of << operator Precedence of >> operator Precedence of >> operator with respect to other bitwise operators Precedence of >> operator with respect to non-bitwise operators Associativity of >> operator Precedence of >>> operator Precedence of >>> operator with respect to other bitwise operators Precedence of >>> operator with respect to non-bitwise operators Associativity of >>> operator Precedence of ~ operator Precedence of ~ operator with respect to other bitwise operators Precedence of ~ operator with respect to non-bitwise operators Associativity of ~ operator Parenthesis applied to bitwise expressions How parentheses affect the precedence in bitwise expressions The associativity of parentheses in bitwise expressions if-else statements ------------------ Condition of if-else is a relational expression Condition of if-else is a relational expression, evaluates to true Condition of if-else is a relational expression, evaluates to false Condition is a variable declaration Condition of if-else is a variable declaration, evaluates to true Condition of if-else is a variable declaration, evaluates to false Condition of if-else is neither a relational expression nor a declaration Condition of if-else (neither relational nor a declaration), evaluates to true Condition of if-else (neither relational nor declaration), evaluates to false if clause of if-else is a simple statement if clause of if-else is a compound statement else clause of if-else is a simple statement else clause of if-else is a compound statement After the if-else, execution resumes from the statement following it Nested if-else statements Cascaded nested if-else statements if-else statements nested for classification if-else statements nested randomly Dangling else problem Multiple if-else statements in a program if statements ------------- Condition of if is a relational expression Condition of if is a relational expression, evaluates to true Condition of if is a relational expression, evaluates to false Condition of if is a variable declaration Condition of if is a variable declaration, evaluates to true Condition of if is a variable declaration, evaluates to false Condition of if is neither a relational expression nor a declaration Condition of if (neither relational nor declaration), evaluates to true Condition of if (neither relational nor declaration), evaluates to false if clause of if statement is a simple statement if clause of if statement is a compound statement After the if, execution resumes from the statement following it Nested if statements Multiple if statements in a program switch statement ---------------- Condition of a multi-way selection statement Condition of multi-way selection statement matches a case Condition of multi-way selection statement matches the default case Condition of multi-way selection statement matches no case Condition of multi-way selection statement is an expression Condition of multi-way selection statement is not an integer Variable in not allowed in a case value The body of the case executed in a multi-way selection statement No statement in the body of a case No break provided at the end of the body of a case Body of a case has no break, but has statements Body of a case has neither break nor statements A multi-way selection statement nested inside another Multiple multi-way selection statements Concerns particular to condition of selection and repetition Boundary value for condition Condition evaluates to true when value of condition variable is that of literal constant in the condition Condition evaluates to false when value of condition variable is that of literal constant in the condition while loop ---------- Condition variable is initialized before the loop Condition variable is not initialized before the loop Loop condition is a relational expression Loop condition is an arithmetic expression Loop condition is a boolean expression Loop condition is an assignment expression Loop condition is a variable declaration Loop has no condition More than one condition variable is updated in the loop body No condition variable is updated in the loop body Body of the loop is a compound statement Body of the loop is a simple statement Body of the loop is an empty statement Condition variable is updated at the end of the loop body Condition variable is updated at the top of the loop body Condition variable is not updated in the loop body After the loop, execution resumes from the statement following it The loop executes zero times The loop executes exactly once Nested loops Nested loops, inner loop's condition is independent of the outer loop Nested loops, inner loop's condition is dependent on the outer loop Mutiple loops, second loop's condition is independent of the first loop Mutiple loops, second loop's condition is dependent on the first loop for loop -------- Counter-controlled loops Loop is initialized using an assignment statement Loop is initialized using a declaration statement Loop does not have an initialization statement Loop condition is a relational expression Loop condition is an arithmetic expression Loop condition is a boolean expression Loop condition is an assignment expression Loop condition is a variable declaration Loop parameter is updated in the loop body Loop does not have a condition Body of the loop is a compound statement Body of the loop is a simple statement Body of the loop is an empty statement Loop counter's value is also updated at the top of the loop body Loop counter's value is also updated at the bottom of the loop body Incrementing counter-controlled loop Loop counter's value is incremented by one on every iteration Loop counter's value is incremented by more than one on every iteration Loop counter's value is decremented by one on every iteration Loop counter's value is decremented by more than one on every iteration Loop counter is never updated After the loop, execution resumes from the statement following it The loop executes zero times The loop executes exactly once Nested loops Nested loops, inner loop's condition is independent of the outer loop Nested loops, inner loop's condition is dependent on the outer loop Mutiple loops, second loop's condition is independent of the first loop Mutiple loops, second loop's condition is dependent on the first loop do-while loop ------------- Post-test logic-contolled loop Loop condition is a relational expression Loop condition is an arithmetic expression Loop condition is a boolean expression Loop condition tests for a contiguous range of values Loop condition tests for a contiguous range of values specified by a conjunctive expression Loop condition tests for a contiguous range of values specified by a disjunctive expression Loop condition is negation of a relational or logical expression Loop condition tests for a set of discrete values Loop condition excludes a set of discrete values Loop condition tests for a set of discrete values Loop condition is an assignment expression Loop has no condition More than one condition variable updated in the loop body Condition variable is updated at the end of the loop body Condition variable is updated at the top of the loop body Condition variable is not updated in the loop body After the loop, execution resumes from the statement following it The loop executes exactly once Nested loops, inner loop's condition is independent of the outer loop Nested loops, inner loop's condition is dependent on the outer loop Mutiple loops, second loop's condition is independent of the first loop Mutiple loops, second loop's condition is dependent on the first loop Advanced loop concepts ----------------------- Using break statement to terminate a loop break statement in a loop break statement in nested loops Illegal use of break statement Using continue statement to skip the rest of the loop Using continue statement to skip the rest of the loop Illegal use of continue statement Infinite loop Missing update statement results in infinite loop Incorrect update results in infinite loop Moving terminal value results in infinite loop When condition is left blank, it is treated as true in for loop Condition is a constant expression that never changes Mixed loops Multiple dependent loops of different types in code Nested dependent loops of different types in code Use of accumulator variables in loops Functions --------- Variables with the same name in two different functions Error - Formal parameter is re-declared as a local variable in the function Error - return statement missing in the definition of a function with non-void return type Error - Data type of the returned value is incompatible with the return type of the function Error - Return is not the last statement in the function Function has multiple return statements Correct use of default values for parameters Error in the definition of a function providing default values for parameters Error in the call to a function which provides default values for parameters Prototype of a function Function called in an expression Calls to multiple functions in a program Multiple calls to the same function in a program Chained function calls Function is called before it is defined/prototyped Value returned by the function is ignored by the caller Caller tries to use the value returned by a function with void return type Data type of the value returned by the function call is incompatible with the expected data type in the caller One variable is passed by value Multiple variables are passed by value The same variable is passed by value multiple times in a function call The actual parameter passed by value is a literal constant The actual parameter passed by value is an expression The actual parameter passed by value is itself a function call Error - Number of actual parameters not the same as the number of formal parameters Error - Data type of the actual parameter incompatible with the data type of the formal parameter One variable passed by reference More than one variable passed by reference Same variable is passed multiple times by reference Error - Constant or expression is passed by reference Parameter is passed by reference using pointer Recursion --------- Recursive call before any other code, function prints Recursive call before any other code, function returns a primitive value Recursive call before any other code, function passes result back by reference Recursive call embedded in other code, function prints Recursive call embedded in other code, function returns a primitive value Recursive call embedded in other code, function passes result back by reference Recursive call after all other code, function prints Recursive call after all other code, function returns a primitive value Recursive call after all other code, function passes result back by reference Multiple recursive calls within a statement One-Dimensional Arrays: ----------------------- Correctly declaring an array Correct complete initialization of an array Initialization of an array when size of the array is not specified Incomplete initialization of an array A constant is used as the subscript A variable is used as the subscript An expression is used as the subscript Accessing an element outside the bounds of the array Assignment to elements of an array in random fashion Assignment to elements of an array in systematic fashion Self-referential assignment to elements of an array Referencing elements of an array in random fashion Referencing elements of an array in systematic fashion Referencing array element before initializing its value Passing entire array to a function, Referencing it in the function Passing entire array to a function, Assigning to it in the function Passing elements of an array by value to a function Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition C++ Pointers ------------ Pointer is declared correctly Pointer is accessed always within scope Pointer is accessed after it has gone out of scope Pointer is properly allocated Initialization of the pointer is correct Assignment to the pointer is correct Pointer is referenced correctly Pointer is dereferenced correctly Pointer is dereferenced before it is initialized/allocated Pointer is dereferenced after whe variable (to which it points) has gone out of scope Pointer is dereferenced after the heap object (to which it points) is deallocated Pointer is deallocated correctly Heap object is lost - it cannot be accessed through any pointer Heap object is used correctly Heap object is initialized correctly Heap object is assigned correctly Heap object is referenced correctly Heap object is referenced before it is initialized C++ Structures: --------------- Declaring a structure variable when the structure definition is out of scope Same name is used for fields in more than one structure Initialization of all the fields of a structure Initialization of only some of the fields of a structure Assignment to a field of a structure variable Assignment of a value of incorrect data type to a field of a structure variable Treating a field as an independent variable Assigning from one structure variable to another in aggregate Assigning to structure type instead of structure variable Correctly referencing the field of a structure variable Referencing the field of a structure variable before initializing it Referencing a field that is not part of a structure variable Structure variable passed as a parameter to a function where it is referenced Structure variable passed as a parameter to a function where it is modified Field of a structure variable passed as a parameter to a function Structure is passed to a function when a field is expected or vice versa Entire structure is returned by a function Declaring variable of nested structure Assigning to nested field Referencing nested field Classes ------- Accessing static public member function by client with respect to class name Accessing static public member function by client with respect to an object Accessing static protected member function by client Accessing static private member function by client Accessing static public data member by client with respect to class Accessing static public data member by client with respect to object Accessing static public data member by static member function Accessing static public data member by dynamic member function Accessing static protected data member by client Accessing static protected data member by static member function Accessing static protected data member by dynamic member function Accessing static private data member by client Accessing static private data member by static member function Accessing static private data member by dynamic member function Accessing public data member by client Accessing public data member by dynamic member function Accessing public data member by composing class Accessing public data member with respect to composing object by client Accessing public data member by inheriting class Accessing public data member with respect to inheriting object by client Accessing public data member by ancestor class Accessing public data member with respect to ancestor object by client Accessing protected data member by client Accessing protected data member by dynamic member function Accessing protected data member by composing class Accessing protected data member with respect to composing object by client Accessing protected data member by inheriting class Accessing protected data member with respect to inheriting object by client Accessing protected data member by ancestor class Accessing protected data member with respect to ancestor object by client Accessing private data member by client Accessing private data member by dynamic member function Accessing private data member by composing class Accessing private data member with respect to composing object by client Accessing private data member by inheriting class Accessing private data member with respect to inheriting object by client Accessing private data member by ancestor class Accessing private data member with respect to ancestor object by client Accessing dynamic data member in static member function Accessing dynamic data member with respect to class Execution of constructor code with respect to object Execution of constructor code by composing class constructor Execution of constructor code when inheriting class's constructor calls it Execution of constructor code when inheriting class's constructor does not call it Mismatch in the number of parameters passed to constructor Mismatch in the data type of parameter passed to constructor Execution of destructor code with respect to object Execution of destructor code by composing class destructor Execution of destructor code from inheriting class's destructor Execution of selectors with respect to object Execution of selectors by composing class function Execution of selectors by client with respect to inheriting object which does not override it (C++ only) Execution of selectors by client with respect to inheriting object which overrides it, calls it, and behavior is not polymorphic (C++ only) Execution of selectors by client with respect to inheriting object which overrides it, calls it and behavior is polymorphic Execution of selectors by client with respect to inheriting object which overrides it, does not call it, and behavior is not polymorphic (C++ only) Execution of selectors by client with respect to inheriting object which overrides it, does not call it and behavior is polymorphic Value returned by the selector is ignored by the caller Selector is called before the corresponding data member is initialized Execution of mutators with respect to object Execution of mutators by composing class function Execution of mutators by client with respect to inheriting object which does not override it (C++ only) Execution of mutators by client with respect to inheriting object which overrides it, calls it, and behavior is not polymorphic (C++ only) Execution of mutators by client with respect to inheriting object which overrides it, calls it and behavior is polymorphic Execution of mutators by client with respect to inheriting object which overrides it, does not call it, and behavior is not polymorphic (C++ only) Execution of mutators by client with respect to inheriting object which overrides it, does not call it and behavior is polymorphic Value returned by mutator is ignored by the caller Mismatch in the number of parameters passed to mutator Mismatch in the data type of parameter passed to mutator Accessing public member function with respect to composing object by client Accessing public member function with respect to inheriting object by client Accessing public member function by ancestor class Accessing public member function with respect to ancestor object by client Accessing protected member function by client Accessing protected member function by composing class Accessing protected member function with respect to composing object by client Accessing protected member function by inheriting class Accessing protected member function with respect to inheriting object by client Accessing protected member function by ancestor class Accessing protected member function with respect to ancestor object by client Accessing private member function by client Accessing private member function by composing class Accessing private member function with respect to composing object by client Accessing private member function by inheriting class Accessing private member function with respect to inheriting object by client Accessing private member function by ancestor class Accessing private member function with respect to ancestor object by client Accessing dynamic member function with respect to class Initialization of an object during declaration Initialization of a composed object during declaration Initialization of an inherited object during declaration Assigning to class instead of object Assigning one object to another object of same class Assigning base class object to derived class variable Assigning derived class object to base class variable Assigning object of one derived class to variable of another derived class Passing an entire object as parameter to a function where it is referenced Passing an entire object as parameter to a function where it is modified Calling selector or mutator with respect to object returned by Composer