Chapter 4: Problem 1
Mark the following statements as true or false. a. The result of a logical expression cannot be assigned to an int variable. b. In a one-way selection, if a semicolon is placed after the expression in an if statement, the expression in the if statement is always true. c. Every if statement must have a corresponding else. d. The expression in the if statement: if \(\quad(\text { score }=30)\) grade \(=' \mathrm{A}^{\prime}\) always evaluates to true. e. The expression: \((\mathrm{ch}>=\text { 'A ' } \& \& \mathrm{ch}<=\text { ' } \mathrm{Z}\) ') f. Suppose the input is \(5 .\) The output of the code: cin \(>>\) num; if \((\text { num }>5)\) cout \(<<\) num \(;\) num \(=0\); else cout \(<<\) "Num is zero" \(<<\) endl is: Num is zero g. The expression in a switch statement should evaluate to a value of the simple data type. h. The expression ! \((x>0)\) is true only if \(x\) is a negative number. i. \(\quad\) In \(C++,\) both \(!\) and \(!=\) are logical operators. j. The order in which statements execute in a program is called the flow of control.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.