21
Date 04/26/2010 COMP1013 STUDY QUESTIONS AND ANSWERS 1. True or False? An example of a logical (Boolean) expression is an arithmetic expression followed by a relational operator followed by an arithmetic expression. 2. True or False? Boolean variables cannot store the result of a comparison of two variables. 3. True or False? Syntactically, the only expressions that can be assigned to Boolean variables are the literal values true and false. 4. True or False? If ch1 contains the value 'C' and ch2 contains the value 'K', the value of the C++ expression ch1 <= ch2 is true. 5. True or False? If P and Q are logical expressions, the expression P AND Q is TRUE if either P or Q is TRUE or both are TRUE. 6. True or False? The expression !(n < 5) is equivalent to the expression n > 5.

Chapter 5 Study Questions

Embed Size (px)

DESCRIPTION

English for Graduation students

Citation preview

1

Date 04/26/2010

COMP1013 STUDY QUESTIONS AND ANSWERS1.True or False? An example of a logical (Boolean) expression is an arithmetic expression followed by a relational operator followed by an arithmetic expression.

2.True or False? Boolean variables cannot store the result of a comparison of two variables.

3.True or False? Syntactically, the only expressions that can be assigned to Boolean variables are the literal values true and false.

4.True or False? If ch1 contains the value 'C' and ch2 contains the value 'K', the value of the C++ expression

ch1 5.

7.True or False? To test whether someInt equals 25 or 30, the C++ expression

someInt == 25 || 30

has the correct semantics but produces a syntax (compile-time) error.

8.True or False? According to DeMorgan's Law, the expression

!(x t)

is equivalent to

x t

9.True or False? The statementif (grade == 'A' || grade == 'B' || grade == 'C')

cout