21 solutions available
Question 1What are logical operators? Give an example of each.
Question 2What is an assignment operator? Give an example.
Question 3Explain the shorthand assignment operator with an example.
Question 4What is the use and syntax of a ternary operator?
Question 5State the difference between = and ==.
Question 6If a = 5, b = 9, calculate the value of: a += a++ - ++b + a
Question 7If x = 3, y = 7, calculate the value of:x -= x++ - ++y
Question 8What will be the output of the following if x=5?i. 5 * ++xii. 5 * x++
Question 9What is type conversion? How is an implicit type conversion different from explicit type conversion?
Question 10What do you understand by type conversion?
Question 11What is typecasting in Java? Give an example.
Question 12What are precedence and associativity?
Question 13Evaluate 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 14Write the Java expressions for the following:i. (a + b)2 + b
Question 15Rewrite the following statements without using shorthand operators.a. p /= qb. p -= 1c. p *= q + rd. p -= q - r
Question 16Determine the output of the following program.public class Test { public static void main(String[] args) { int a = 1, b =...
Question 17What is the difference between the following two statements? Explain the results.x -= 5;x =- 5;
Question 18What is concatenation? On which data type is concatenation performed?
Question 19Determine the output of the following program.public class PredictOutput1 { public static void main(String args[]) { int a = 4,...
Question 20Determine the output of the following program.public class PredictOutput2 { public static void main(String args[]) { int a = 6,...
Question 21Determine the output of the following program.public class PredictOutput3 { public static void main(String args[]) { int a = 2,...