Preview

unit 5 assignment 1

Satisfactory Essays
Open Document
Open Document
423 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
unit 5 assignment 1
Yvanna Escalera
PT 1420
Unit 5 Assignment 1
Homework
Short answer
1. Conditionally executed means it is performed only when a certain condition is true.
2. You would use a dual alternative decision structure.
3. You would use a nested decision structure.
4. The AND operator connects two Boolean expressions into one compound expression. Both must be true for the compound expression to be true.
5. The OR operator connects two Boolean expressions into one compound expression. One or both must be true for the compound expression to be true. It doesn’t matter which one.
6. When determining if a number is within a range, the OR operator would be best to use.
7. A flag is a variable that signals when some condition exists in the program.
Algorithm Workbench
1. If variable x > 100 Then
Set variable y = 20
Set variable z = 40 End If
2. If variable a < 10 Then
Set variable b = 0
Set variable c = 1 End if
3. If variable a < 10 Then
Set variable b = 0 Else Set variable b = 99 End If
4. If score < 60 Then
Display “Your grade is F.” Else If score < 70 Then Display “Your grade is D.” Else

If score < 80 Then Display “Your grade is C.” Else If score < 90 Then Display “Your grade is B.” Else Display “Your grade is A.” End If End If End If End If
5. If amount1 > 10
And
If amount2 < 100 Then
If amount1 > amount2 Then Display amount 1
Else
Display amount2
End if

Programming Exercises
1. Declare Integer number
If number variable is set to 1, it displays “ I “
If number variable is set to 2, it displays “ II “
If number variable is set to 3, it displays “ III “
If number variable is set to 4, it displays “ IV “
If number variable is set to 5, it displays “ V “
If number variable is set to 6, it displays “ VI “
If number variable is set to 7, it displays “ VII “
If number variable is set to 8, it displays “ VIII “
If number variable is set to 9, it displays “ IX “
If number variable is set

You May Also Find These Documents Helpful

  • Powerful Essays

    Is505 Final

    • 1919 Words
    • 8 Pages

    4. (TCO D) Which of the following is not an example of a logical operator? (Points : 5)…

    • 1919 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    Week 1 HW Graded

    • 1751 Words
    • 26 Pages

    The output of an AND gate should be 1 when ALL inputs are 1. The output of an AND gate should be 0 when ANY input is 0. For more information, refer to the Week 1 Lecture or page 59 of the textbook.…

    • 1751 Words
    • 26 Pages
    Satisfactory Essays
  • Good Essays

    Comparing Primitives vs Comparing Strings There is a difference Comparing Primitives • Primitives are compared with an operator: = = < <= > >= ! = //given…

    • 464 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Book of Proof

    • 105259 Words
    • 422 Pages

    2.1. Statements 2.2. And, Or, Not 2.3. Conditional Statements 2.4. Biconditional Statements 2.5. Truth Tables for Statements 2.6. Logical Equivalence 2.7. Quantifiers 2.8. More on Conditional Statements 2.9. Translating English to Symbolic Logic 2.10. Negating Statements 2.11. Logical Inference 2.12. An Important Note…

    • 105259 Words
    • 422 Pages
    Powerful Essays
  • Satisfactory Essays

    Excel Formula

    • 316 Words
    • 2 Pages

    Operators (in order of evaluation) Reference Range : Intersection Space Union , Arithmetic Negation Percentage % Exponentation ^ Multiplication * Division / Addition + Subtraction Text Join & Comparison (equal precendence) Equal = Greater than >…

    • 316 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    the java

    • 4105 Words
    • 18 Pages

    2) Of the following if statements, which one correctly executes three instructions if the condition is true?…

    • 4105 Words
    • 18 Pages
    Better Essays
  • Satisfactory Essays

    Basic Logic Gates

    • 315 Words
    • 2 Pages

    The OR gate is a circuit which gives a high output if one or more of its inputs are high. A plus sign (+) is used to indicate the OR operation.…

    • 315 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    I. True or False. Write “TRUE” if the statement is true and “FALSE” if the statement is false.…

    • 132077 Words
    • 529 Pages
    Good Essays
  • Satisfactory Essays

    Symbolic Logic

    • 542 Words
    • 3 Pages

    _____________10. It asserts that two alternatives cannot be true at the same time or both alternative may be false.…

    • 542 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    PLF - Program Design

    • 819 Words
    • 5 Pages

    These Venn diagrams help to visualize the meaning of AND, OR and NOT; the colored area indicates the items that will be retrieved in each case.…

    • 819 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Consider the following formula _ and its two interpretations I1 and I2 ]] 〈: (x)[Px  (y)[Qxy  ¬Qyy (x)[¬Px] I1: Domain: the set of natural numbers Px α ”x is a prime number‘ Qxy α ”y divides x‘ I2: same as I1 except that Px = ”x is a composite number‘. Which of the following statements is true? (A) I1 satisfies 〈, I2 does not (C) Neither I2 nor I1 satisfies 〈 (B) I2 satisfies 〈, I1 does not (D) Both I1 and 12 satisfy 〈…

    • 5183 Words
    • 21 Pages
    Good Essays
  • Good Essays

    bca qstn

    • 1776 Words
    • 8 Pages

    6. Conditional operator (?:) is a handy operator which acts like a shortcut for ---------a. if else statement…

    • 1776 Words
    • 8 Pages
    Good Essays
  • Powerful Essays

    Entity Relationship Diagram

    • 3067 Words
    • 13 Pages

    Arithmetic Expressions: Operators A unary operator has one operand A binary operator has two operands A ternary operator has three operands Arithmetic Expressions: Operator Precedence Rules The operator precedence rules for expression evaluation define the order in which “adjacent” operators of different precedence levels are evaluated Typical precedence levels…

    • 3067 Words
    • 13 Pages
    Powerful Essays
  • Satisfactory Essays

    Logical Design

    • 781 Words
    • 4 Pages

    To this end, there are several rules of Boolean algebra presented in this section for use in reducing expressions to their simplest forms. The identities and properties already reviewed in this chapter are very useful in Boolean simplification, and for the most part bear similarity to many identities and properties of "normal" algebra. However, the rules shown in this section are all unique to Boolean mathematics.…

    • 781 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    ghjk

    • 3544 Words
    • 15 Pages

    Know and apply the conditions under which a compound statement (conjunction, disjunction, conditional, biconditional) is true…

    • 3544 Words
    • 15 Pages
    Good Essays