<< Chapter < Page Chapter >> Page >

Answer 17

Question 18

When the plus operator (+) is used as a concatenation operator, what is the nature of its behavior if its left operand is of type String and its right operand is not of type String ? If the right operand is a variable that is not of type String , what is the impact of this behavior on that variable.

Answer 18

Question 19

Show and describe four unary arithmetic operators supported by Java.

Answer 19

Question 20

What is the type returned by relational operators in Java?

Answer 20

Question 21

Show and describe six different relational operators supported byJava.

Answer 21

Question 22

Show the output that would be produced by the Java application shown in Listing 2 .

Listing 2 . Listing for Question 22.
class relat01 { //define the controlling class public static void main(String[]args){ //define main System.out.println("The relational 6<5 is " + (6<5 )); System.out.println("The relational 6>5 is " + (6>5 )); }//end main}//End relat01 class. Note no semicolon required //End Java application

Answer 22

Question 23

Show and describe three operators (frequently referred to as conditional or logical operators) that are often combined with relational operators to construct more complex expressions (often called conditional expressions) . Hint: The || operator returns true if either the left operand, the right operand, or both operands are true. What are the other two and how do theybehave?

Answer 23

Question 24

Describe the special behavior of the || operator in the following expression for the case where the value of the variable a is less than the value of the variable b .

(a<b) || (c<d)

Answer 24

Question 25

Show the symbols used for the bitwise and operator and the bitwise inclusive or operator.

Answer 25

Question 26

Show and describe seven operators in Java that perform actions on the operands one bit at a time (bitwise operators) .

Answer 26

Question 27

True or false? In Java, the signed right shift operation populates the vacated bits with the zeros, while the left shift and the unsigned right shift populate the vacated bits with the sign bit. If your answer is False,explain why.

Answer 27

Question 28

True or false? In a signed right-shift operation in Java, the bits shifted off the right end are lost. If your answer is False, explain why.

Answer 28

Question 29

Using the symbols 1 and 0, construct a truth table showing the four possible combinations of 1 and 0. Using a 1 or a 0, show the result of the bitwise and operation on these four combinations of 1 and 0.

Answer 29

Question 30

Using the symbols 1 and 0 construct a truth table showing the four possible combinations of 1 and 0. Using a 1 or a 0, show the result of the bitwise inclusive or operation on these four combinations of 1 and 0.

Answer 30

Question 31

Using the symbols 1 and 0 construct a truth table showing the four possible combinations of 1 and 0. Using a 1 or a 0, show the result of the bitwise exclusive or operation on these four combinations of 1 and 0.

Answer 31

Question 32

True or false? For the exclusive or , if the two bits are different, the result is a 1. If the two bits are the same, the result is a 0. If youranswer is False, explain why.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask