Java MCQ Questions and Answers
Practice ModeShowing 10 of 22 questions
Q11
Which of the following are true about the Error and Exception classes?
Answer: Option A
Q12
Which of the following are true?
Answer: Option D
Q13
Which of the following will output -4.0
Answer: Option C
Q14
Which of the following are valid statements
Answer: Option D
Q15
) What will happen if you attempt to compile and run the following code?
Integer ten=new Integer(10);
Long nine=new Long (9);
System.out.println(ten + nine);
int i=1;
System.out.println(i + ten);
Answer: Option A
Q16
Which of the following statements are true?
Answer: Option D
Q17
Which of the following statements are true?
a)When you construct an instance of File, if you do not use the file naming semantics of the local machine, the constructor will throw an IOException.
b)When you construct an instance of File, if the corresponding file does not exist on the local file system, one will be created.
c)When an instance of File is garbage collected, the corresponding file on the local file system is deleted.
d)None of the above
Answer: Option C
Q18
Which of the following are true?
a)The InputStream and OutputStream classes are byte-oriented.
b)The ObjectInputStream and ObjectOutputStream do not support serialized object input and output.
c)The Reader and Writer classes are character-oriented.
d)The Reader and Writer classes are the preferred solution to serialized object output.
Answer: Option D
Q19
Which of the following are true about I/O filters?
a)Filters are supported on input, but not on output.
b)Filters are supported by the InputStream/OutputStream class hierarchy, but not by the Reader/Writer class hierarchy.
c)Filters read from one stream and write to another.
d)A filter may alter data that is read from one stream and written to another.
Answer: Option B
Q20
Which of the following are true?
a)Any Unicode character is represented using 16-bits.
b)7-bits are needed to represent any ASCII character.
c)UTF-8 characters are represented using only 8-bits.
d)UTF-16 characters are represented using only 16-bits.
Answer: Option C