Logic Programming - M5 Quiz 1

Created
    English
  1. Other
  2. University
  3. AvatarRex Toledo
Best for asynchronous learning and homeworkAssign in student-paced mode
Best for live in-class or video conferencing lessonsStart teacher-led lesson
Preview as student

LOGIC PROGRAMMING

M5 - QUIZ 1

Name :

Course :

Score: __________________

Year & Section :

I. True or False

Direction: Write T if the statement is true. write false, if it's false.

  1. In an OR selection, only one of two conditions must be met in order for an event to take place.

  2. Most programming languages allow you to combine as many AND and OR operators in an expression as you need.

  3. When you nest selection structures because the resulting action requires that two conditions be true, either decision logically can be made first and the results will be the same.

  4. In any logical comparison expression, the two values compared can be either variables or constants.

  5. The case structure is used to test a single variable for multiple values.

  6. You always can avoid the confusion of mixing AND and OR decisions by nesting if statements instead of using AND and OR operators.

  7. You can perform a range check by making comparisons using the lowest value in each range of values you are using.

  8. The if-then clause is the part of a decision that executes when a tested condition in a decision is true.

  9. When you perform a range check, you compare a variable to every value in a series of ranges.

  10. A Boolean expression is defined as one that decides whether two values are equal.

  11. When you combine AND and OR operators, the AND operators take precedence, meaning the Boolean values of their expressions are evaluated first.

  12. To improve efficiency in a nested selection in which two conditions must be true for some action to occur, you should first evaluate the condition that is more likely to be true.

  13. The syntax of the case structure varies among programming languages.

  14. The else clause is the part of a decision that executes when a tested condition in a decision is false.

  15. When two selections are required for an action to take place, you often can improve your program's performance by appropriately choosing which selection to make first.

  16. You can perform a range check by making comparisons using the highest value in each range of values you are using.

  17. The value of x = y OR x > 5 is the same as the value of x = y OR NOT (x <= 5).

  18. When you use an OR selection with two conditions, you can choose to evaluate either condition first and still achieve a usable program.

  19. The general rule is: In an OR decision, first evaluate the condition that is more likely to be true.

  20. The value of x > y is the same as the value of NOT (x < y).

  21. The else clause is the part of a decision that executes when a tested condition in a decision is true.

  22. The value of x <> 0 is the same as the value of NOT (x = 0).

  23. The case structure is used when a series of decisions is based on multiple possible values for a single variable.

  24. The case structure is used when a series of decisions is based on multiple variables.

  25. In an OR selection, two or more conditions must be met in order for an event to take place.

  26. For efficiency in a nested selection, you should first evaluate the condition that is less likely to be true.

  27. Although deciding whether two values are equal is a Boolean expression, so is deciding whether one is greater than or less than another. A Boolean expression is one that results in a true or false value.

  28. Usually, you can compare only values that are of the same data type.

  29. When you combine AND and OR operators, the OR operators take precedence, meaning their Boolean values are evaluated first.

  30. When you use a range check, you compare a variable to a series of values that represent the ends of ranges. Depending on your logic, you can use either the high or low end of each range.