Java MCQ Questions and Answers
Practice ModeShowing 10 of 22 questions
Q1
What output is displayed as the result of executing the following statement?
System.out.println("// Looks like a comment.");
Answer: Option A
Q2
In order for a source code file, containing the public class Test, to successfully compile,
which of the following must be true?
Answer: Option B
Q3
Which of the following declare an array of string objects?
a)String[ ] s;
b) String [ ]s:
c)String[ s]:
d) String s[ ]:
Answer: Option D
Q4
What is the value of a[3] as the result of the following array declaration?
Answer: Option D
Q5
Which of the following are primitive types?
Answer: Option A
Q6
What is the range of the char type?
Answer: Option D
Q7
What is an example of polymorphism?
Answer: Option C
Q8
Which of the following classes is used to perform basic console I/O?
Answer: Option A
Q9
Which of the following are true?
a)The Class class is the superclass of the Object class.
b)The Object class is final.
c)The Class class can be used to load other classes.
d)The ClassLoader class can be used to load other classes.
Answer: Option D
Q10
Which of the following methods are methods of the Math class?
Answer: Option B