Question

4. (2 point each) What value will be assigned to the answer variable below? If the expression will not compile in Java, exp
g. int x = 5; boolean answer = 3 < x < 10; h. boolean holder = false; boolean answer = (holder = true); i. boolean yes - truethis is java


4. (2 point each) What value will be assigned to the answervariable below? If the expression will not compile in Java, expla
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer -

A Boolean expression is an expression that returns a boolean value: 1 (true) or 0 (false).

a. true

Explanation - 6<2 is false and 7>3 is true, therefore false || true is true (logical OR).

b. false

Explanation - Logical AND of 1 and 0 is 0 i.e. false.

c. true

Explanation - since 87 is not equal to 80 so it is false and ! (logical NOT) of false is true.

d. true

Explanation - since 1>0, therefore true.

Hope this helped. Please do upvote and if there are any queries please ask in the comments section.

Add a comment
Know the answer?
Add Answer to:
this is java 4. (2 point each) What value will be assigned to the "answer" variable...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA 5) What is the output of the following code? int a = 70; boolean b...

    JAVA 5) What is the output of the following code? int a = 70; boolean b = false; if(a >= 70) { System.out.print(1); if(b==true) { System.out.print(2); } } else { System.out.print(3); if(b==false) { System.out.print(4); } } System.out.print(5); 6) What is the output of the code above using these initial values? int a = 43; boolean b = false; 7) The following method is SYNTACTICALLY correct (meaning it will compile). True or false? public boolean method() { int value = 5;...

  • 1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true &&...

    1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true && false c. false d. False (2). You save text files containing Java language source code using the file extension___ a. .java b. .class c. .txt d. .src    (3). Which of the following is not a primitive data type in the Java programming language? a. boolean b. byte c. int d. Point (4). Given the Java statement int[][] vari = new int[5][7]; the value...

  • Provide the expected output AS IT WOULD APPEAR IN A JAVA PROGRAM as the result of a print statement. (i.e. Enter true or...

    Provide the expected output AS IT WOULD APPEAR IN A JAVA PROGRAM as the result of a print statement. (i.e. Enter true or false (all lower case letters). If you enter TRUE, F, True, etc these will be marked wrong). Given the following declarations: int x = 25; int y = -4; int z = 17; boolean b = false; What would be the output of the following Boolean expressions? (x % 2 != 0) && b b && !b...

  • Please help to make the program working. Can not compile. import java.io.*; import java .util.*; public...

    Please help to make the program working. Can not compile. import java.io.*; import java .util.*; public class Puzzlee {                 static int NN = 9; // Grid Size // sample input static int myGrid[][] = {                                                                                                                                                                                                                                                                                {0,0,0,1,0,5,0,6,8},                                                                                                                 {0,0,0,0,0,0,7,0,1},                                                                                                                 {9,0,1,0,0,0,0,3,0},                                                                                                                 {0,0,7,0,2,6,0,0,0},                                                                                                                 {5,0,0,0,0,0,0,0,3},                                                                                                                 {0,0,0,8,7,0,4,0,0},                                                                                                                 {0,3,0,0,0,0,8,0,5},                                                                                                                 {1,0,5,0,0,0,0,0,0},                                                                                                                 {7,9,0,4,0,1,0,0,0}                                                                                                 };    static class myCell {                 int myRow, myColumn;                 public myCell(int myRow, int myColumn)                 {                                 super();                                ...

  • java by the way What is the value of the variable y after the following code...

    java by the way What is the value of the variable y after the following code is executed? int x = 10; int y = 0; while (x > 0) { x = x / 2; y++; } 4 3 2 1

  • for java 12) Suppose you have defined variables int x 42 String y ="lunchtime" a) Evaluate...

    for java 12) Suppose you have defined variables int x 42 String y ="lunchtime" a) Evaluate each expression below y.equals ("breakfast") 11 x !-42 5 1 (y.length )>0 66 ! (x < =0)) x !( (x>0 GG x > 1) || x > 2) b) Using the variables x and y above, for each phrase below, write a Java boolean expression that captures its meaning. Then determine whether the expression is true or false using the values of x and...

  • Question 4 (2 points) Consider the C statements below. Assume x has been assigned a value....

    Question 4 (2 points) Consider the C statements below. Assume x has been assigned a value. int mask = 0xFF000000; y = x ^ mask; Which one of the following best describes the value computed for variable y? Question 4 options: y contains the most significant byte of x complemented, with the rest of the bits unchanged y contains the most significant byte of x unchanged, with the rest of the bits 0 y contains the most significant byte of...

  • QUESTION 3 Assume x = 4 and y = 5, which of the following is true?...

    QUESTION 3 Assume x = 4 and y = 5, which of the following is true? x < 5 || y < 5 x > 5 || y > 5 x < 5 && y < 5 x > 5 && y > 5 QUESTION 14 Which of the following statements are the same? (A) x -= x + 4 (B) x = x + 4 - x (C) x = x - (x + 4) (A) and (B) are...

  • 1. Consider the following questions a) Is it True or False that “Call by value” in...

    1. Consider the following questions a) Is it True or False that “Call by value” in a C function (C programming language) always return a value? b) Based on the following: x := 10; y := 5; z := x + y; write(z); Execution of these statements prints the value 42 on the console. Is this language Declarative or Imperative? c) Which language processing component detects the following Java error? int x, y; boolean z; z = x + y...

  • 10. Which of the following correcthy milites elements each with value 0? super Bass to com...

    10. Which of the following correcthy milites elements each with value 0? super Bass to com I inttl superBass { 0, 0, 0, 0, 0 ); int(1 superBass = new int [5] inttl superBass = new int (5) for (int i = 0; i < super Bass.length superBass ) = 0; +) (A) (B) I only II only I and II only I and III only I. II, and III (D) (E) 17. Consider the following Java program public class...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT