26 solutions available
Question 1We have two variables x and y. Write Java statements to calculate the result of division of y by x and calculate the remainder of the...
Question 2Assign the value of pi (i.e., 3.142) to a variable with requisite data type.
Question 3What are logical operators? Give an example of each.
Question 4What is an assignment operator? Give an example.
Question 5Explain the shorthand assignment operator with an example.
Question 6What is the purpose of the new operator?
Question 7What is the use and syntax of a ternary operator?
Question 8State the difference between = and ==.
Question 9If a = 5, b = 9, calculate the value of: a += a++ - ++b + a
Question 10Distinguish between the following:a. Prefix and Postfix Increment
Question 11If m=5, n=2; what will be the output of m and n after execution?i. m -= n ii. n = m + m/n
Question 12If x = 3, y = 7, calculate the value of:x -= x++ - ++y
Question 13What will be the output of the following if x=5?i. 5 * ++xii. 5 * x++
Question 14What is type conversion? How is an implicit type conversion different from explicit type conversion?
Question 15What do you understand by type conversion?
Question 16Explain the term 'typecasting'.
Question 17What are precedence and associativity?
Question 18Evaluate the following expressions, if the values of the variables are a = 2, b = 3 and c = 3i. a - (b++) * (--c)ii. a * (++b) %c
Question 19Write the Java expressions for the following:i. (a + b)2 + b
Question 20Rewrite the following statements without using shorthand operators.a. p /= qb. p -= 1c. p *= q + rd. p -= q - r
Question 21Determine the output of the following program.public class Test { public static void main(String[] args) { int a = 1, b =...
Question 22What is the difference between the following two statements in terms of execution? Explain the results.x -= 5;x =- 5;
Question 23What is concatenation? On which data type is concatenation performed?
Question 24Determine the output of the following program.public class PredictOutput1 { public static void main(String args[]) { int a = 4,...
Question 25Determine the output of the following program.public class PredictOutput2 { public static void main(String args[]) { int a = 6,...
Question 26Determine the output of the following program.public class PredictOutput3 { public static void main(String args[]) { int a = 2,...