QUESTION 49 Assume x is 0. What is the output of the following statement? if (x 0) System out print(“xisgreater than 0), else if (x
Expert Answer
Answer is option 2;
Explanation:
Here x will be case 6, but here break statement is not used, so the valu of Y is initially 0, then 1, then finally incremented by 1Which is 2.
question 8
Answer is option C
Explanation:
>> First Welcome is printed, then 1 is printed then, 1*2 is printed.
public class TriangleArea {
public static void main(String args[]) {
System.out.println(“Welcome”+1+1*2);
}
}
Output: Welcome12.
Question 22:
True.
Explanation:
In Java all binary operators are left associative.
Question 28:
Answer: option 2 (!=)
Question 30:
Answer: option2 (Semicolon đŸ˜‰
question 31:
Answer: option D(196)
Explanation: When printing the character it prints the ASCII number, Here ASCII numbers of a&c aree added and gets printed.
Question 34:
Answer: option a(‘a’);
Question 38:
Answer: option C (-3):
% operator gives the remainder, here remainder is -3;
Question 45:
Answer: False (Assaignment is right associative)
Quesion 49:
Answer: Option C( X equuals 0);
Explanation: Here x is neither greater than nor less than 0, So else condition is executed (X equals 0);