21.) Which of the following is NOT a valid variable name in Java?
A) myVariable
B) _value
C) 123variable
D) variable123
22.) In Java, which of the following is used to initialize an instance variable of an object during object creation?
A) Constructor
B) finalize()
C) new
D) this
23.) In Java, what is the data type of the result when dividing two integers?
A) int
B) long
C) double
D) float
24.) How is a constant variable typically declared in Java?
A) const int VALUE = 10;
B) constant int VALUE = 10;
C) int VALUE = 10;
D) final int VALUE = 10;
25.) What will happen if you try to change the value of a constant variable in Java?
A) It will raise a compilation error.
B) It will automatically update the new value throughout the program.
C) It will prompt the user to enter a new value during runtime.
D) It will replace the old value with the new value without any error.
26.) Which of the following data types can be used to declare a constant in Java?
A) int
B) double
C) String
D) All of the above
27.) In Java, the word true
is?
A) A Boolean literal
B) A Java keyword
C) Similar to value 1
D) Similar to value 0
Related