Consider the following code segment in which the int variabl…

Consider the following code segment in which the int variable x has been properly declared and initialized. if (x % 2 == 1){ System.out.println(“YES”);}else{ System.out.println(“NO”);}Assuming that x is initialized to the same positive integer value as the original, which of the following code segments will produce the same output as the original code segment?I.if (x % 2 == 1){ System.out.println(“YES”);}if (x % 2 == 0){ System.out.println(“NO”);}II.if (x % 2 == 1){ System.out.println(“YES”);}else if (x % 2 == 0){ System.out.println(“NO”);}else{ System.out.println(“NONE”);}III.boolean test = x % 2 == 0;if (test){ System.out.println(“YES”);}else{ System.out.println(“NO”);}

Consider the following code segment. int start = 4;int end =…

Consider the following code segment. int start = 4;int end = 5;boolean keepGoing = true;if (start < end && keepGoing){ if (end > 0) { start += 2; end++; } else { end += 3; }}if (start < end){ if (end == 0) { end += 2; start++; } else { end += 4; }} What is the value of end after the code segment is executed?

Assume that a, b, and c are variables of type int. Consider…

Assume that a, b, and c are variables of type int. Consider the following three conditions. I. (a == b) && (a == c) && (b == c)II. (a == b) || (a == c) || (b == c)III. ((a – b) * (a – c) * (b – c)) == 0 Assume that subtraction and multiplication never overflow. Which of the conditions above is (are) always true if at least two of a, b, and c are equal?