PRACTICE JAVA
Which of the following is the correct expression of character 4?
a. 4 b. “4” c. ‘4’ d. ‘\4’ Answer: c. ‘4’ Explanation: Whenever character literals are written, they should be enclosed inside the single quotes.
The main method header is written as?
a. public static void main(string[] args) b. public static void Main(string[] args) c. public static void main(Strings[] args) d. public static void main(String[] args) Answer: d. public static void main(String[] args) Explanation: The main method
In java, boolean array elements automatically are assigned the value ____.
a. True b. False Answer: b. false Explanation: Variables with boolean data type are not assigned the value automatically.
The java compiler generates
a machine code b. byte code c. source code d. HTML Answer: b. byte code Explanation: The Java compiler generates byte code which is then understood by the computer which then generates the output.
Which of the following is the correct statement to return java?
a. toUpperCase(“Java”) b. “Java”.toUpperCase(“Java”) c. “Java”.toUpperCase() d. String.toUpperCase(“Java”) Answer: C. “Java”.toUpperCase() Explanation: “Java”.toUpperCase() is the correct statement used to return Java.
Which of the following cannot be used as identifiers in java?
a. variable names b. class names c. key words d. objects Answer: c. key words Explanation: We cannot use keywords like int, float , etc as identifiers in Java.
Aniket Malik
CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS
My students are the presents from God to me
Do you want to learn
Programming?
Hey, I’m Aniket. I’m determined to make you one of the best developers in the history of Information technology.
My only question is, are you ready?