Name:     ID: 
 
Email: 

Test5

True/False
Indicate whether the statement is true or false.
 

 1. 

The OR operand evaluates to false if one operand is false.
 

 2. 

At a minimum, test data should try to achieve complete code coverage, which means every line of code should be executed at least once.
 

 3. 

Test data at the limits of validity are called boundary conditions.
 

 4. 

Nested if statements offer an alternative to deal with a programs logical complexity.
 

 5. 

It is better to write code and then create a flow chart or truth table to verify the code.
 

 6. 

One of the most common mistakes in nested if statements involves misplaced braces.
 

 7. 

Changing the indentation of if and else statements changes the logic of the code.
 

 8. 

Since overusing braces clutters the code, only use braces when needed.
 

 9. 

Arithmetic overflow results when the range of a given number is exceeded.
 

 10. 

Java uses complete evaluation, in which all parts of a Boolean expression are always evaluated.
 

 11. 

Complete code coverage in testing will test all logical paths through a program.
 

 12. 

The following nested if statements are equivalent:

if ( it is 3:00 )                  if ( it is 3:00 )
  if ( it is Monday )              if ( it is Monday ){
     go home                      go home     
     go to the gym                go to the gym
                                                  }
 

 13. 

If braces are removed from a nested if/else statement, Java pairs the else with the closest preceding if.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 14. 

Which of the following is NOT one of the 3 logical operators introduced in this chapter.
a.
AND
c.
NOT
b.
OR
d.
XOR
 

 15. 

If the operator AND is used, which of the following will make the whole condition true?
a.
first operand true, second operand false
c.
both operands true
b.
first operand false, second operand true
d.
both operands false
 

 16. 

What is the precedence of the logical operator OR ( || )?
a.
5
c.
3
b.
6
d.
9
 

 17. 

Which of the following is the Java symbol for logical AND?
a.
&&
c.
==
b.
!
d.
||
 

 18. 

The sets of test data that exercise a program in the same manner are said to belong to the same:
a.
code coverage
c.
equivalence class
b.
set
d.
boundary condition
 

 19. 

It is common for programs to fail around which points?
a.
boundary condition points
c.
equivalence class points
b.
extreme condition points
d.
no points
 

 20. 

Reformatting the first if/else statement into the second is called:
  ( 1 )                                  ( 2 )
if( )                                     if( )
   statement                            statement
else                                     else if ()
  if( )                                      statement
    statement
a.
extended if statement
c.
two-way if statement
b.
one-way if statement
d.
many-way if statement
 

 21. 

A program that tolerates errors in user inputs and recovers gracefully is:
a.
combinatorial
c.
clear
b.
robust
d.
solid
 

 22. 

When a program attempts to add one to the most positive integer in the range what value is yielded.
a.
0
c.
null
b.
the most negative integer
d.
a random integer
 

 23. 

In general, how many combinations of true and false are there for n operands in a truth table.
a.
2n
c.
2n
b.
n
d.
4n
 

 24. 

What is the symbol for the NOT operator in Java?
a.
!
c.
<>
b.
~
d.
N
 

 25. 

Which of the following Boolean expressions is equivalent to: !( p && q )
a.
!p && !q
c.
p && !q
b.
!p && q
d.
!p || !q
 

 26. 

The approach in which evaluation of a Boolean expression stop as soon as possible is called:
a.
truth evaluation
c.
complete evaluation
b.
short-circuit evaluation
d.
ASAP-evaluation
 

 27. 

What is used in Java to determine if two string objects contain equal strings.
a.
==
c.
equals( )
b.
compare( )
d.
isEqual( )
 

 28. 

An Artificial Intelligence program that learns a set of rules is called a:
a.
softbot
c.
smart program
b.
robot
d.
neural net
 

Completion
Complete each statement.
 

 29. 

The operator _____ changes the truth value of a condition to the opposite value, i.e. if the operand is true, then this operator makes the condition false.
 

 

 30. 

When a loop is placed within another loop it is called a __________ loop.
 

 

 31. 

A ________ _________ can determine the value of any complex Boolean expression.
 

 

Short Answer
 

 32. 

Assuming A is true, B is false and C is true, what is the value of the following boolean expression?

      ( A && !B ) || !C
 



 
         Start Over