• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 9 pages
Exam (elaborations)

C++ Chpt_04

Document preview thumbnail
Preview 2 out of 9 pages

Exam of 9 pages for the course C++ Chpt_04 at C++ Chpt_04 (C++ Chpt_04)

Content preview

C++ Chpt_04 GRADE A QUESTION WITH
ANSWERS
1. An expression using the greater-than, less-than, greater-than-or-equal-to, less-than-
or equal-to, equal, or not-equal operator is called a(n) - (correct answer)'Relational
expression.



2. The value of a relational expression is 0 if the expression is - (correct
answer)expression is 'False'.

'True' or 1 if the



3. The if statement regards an expression with the value 0 as 'False' and an expression
with a non zero value as 'True'. - (correct answer)False True


4. For an if statement to conditionally execute a group of statements, the statements
must be enclosed in a set of . - (correct answer)'Braces'



5. In an if/else statement, the if part executes its statement(s) if the expression is 'True',
and the else part executes its statement(s) if the expression is 'False'. - (correct
answer)True False



6. The trailing else in an if/else if statement has a similar purpose as the ' ' section of a
switch statement. - (correct answer)Default



7. If the sub-expression on the left of the && logical operator is 'False', the right sub-
expression is not checked. - (correct answer)False



8. If the sub-expression on the left of the || logical operator is 'True', the right sub-
expression is not checked. - (correct answer)True



9. The '!' logical operator has higher precedence than the other logical

, operators. - (correct answer)!



10. Logical operators have ' ' precedence than relational operators. - (correct
answer)Lower



11. The '&&' logical operator works best when testing a number to determine if it is
within a range. - (correct answer)&&


12. The '||' logical operator works best when testing a number to determine if it is
outside a range. - (correct answer)||



13. A variable with " "(or local)' scope is only visible when the program is executing in
the block containing the variable's definition. - (correct answer)Block



14. The expression that follows the switch statement must have a(n) 'Integer' value. -
(correct answer)Integer



15. A program will "fall through" to the following case section if it is missing the 'Break'
statement. - (correct answer)Break



16. What value will be stored in the variable t after each of the following statements
executes? - (correct answer)A) t = (12 > 1); '1'
B) t = (2 < 0); '0'
C) t = (5 == (3 * 2)); '0'

D) t = (5 == 5); '1'



17. Write an if statement that assigns 100 to x when y is equal to 0. - (correct answer)if
(y==0)

x = 100;

Document information

Uploaded on
October 26, 2024
Number of pages
9
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$10.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
douglasmugwe82
5.0
(1)
Sold
2
Followers
0
Items
4215
Last sold
1 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions