Ask Question
18 August, 09:47

Which of the following is the correct boolean expression to test for: int x being a value less than or equal to 500 or greater than 650, or int y not equal to 1000? a. ((x > = 500 && x < 650) && (y! = 1000)) b. ((x 650) AND! (y. equal (1000))) c. ((x 650) || (y! = 1000)) d. ((x 650) &&! (y = = 1000))

+5
Answers (1)
  1. 18 August, 10:05
    0
    c. ((x 650) || (y! = 1000))

    Step-by-step explanation:

    x is an in type variable y is an int type variable Lets understand the Boolean expression: According to the given condition, x has a value that should be less than or equal to 500. This shows that: x 650 x being a value less than or equal to 500 OR greater than 650 means that either of the two conditions can hold because there is an OR between these two. OR in Boolean is represented as ||. So the expression becomes:

    x 650

    y is not equal to 1000 shows: y!=100 Here NOT is represented by! int x being a value less than or equal to 500 OR greater than 650, OR int y not equal to 1000 which makes the following Boolean expression:

    ((x 650) || (y! = 1000))

    The first OR is between the two expressions of x and the second OR is between x and y expressions. Lets say the value of x entered is 400 and y is 900. The this expression evaluates to True. Lets say the value of x entered is 501 and value of y is 1000. Then this Boolean expression evaluates to False.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following is the correct boolean expression to test for: int x being a value less than or equal to 500 or greater than 650, or ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers