Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Which of these is a method to clear all the data present in output buffers?(a) clear()(b) flush()(c) fflush()(d) close()This question was posed to me in an interview for internship.Query is from Java.io Byte Streams in section Exploring java.lang & java.io of Java

Answer» RIGHT choice is (B) FLUSH()

EASY EXPLANATION: None.
52.

Which of these data type is returned by every method of OutputStream?(a) int(b) float(c) byte(d) none of the mentionedThis question was addressed to me during an interview for a job.The origin of the question is Java.io Byte Streams in division Exploring java.lang & java.io of Java

Answer»

Correct option is (d) none of the mentioned

For EXPLANATION: Every method of OUTPUTSTREAM RETURNS VOID and throws an IOExeption in case of errors.

53.

Which of these class is used to read and write bytes in a file?(a) FileReader(b) FileWriter(c) FileInputStream(d) InputStreamReaderI got this question during an interview.I'm obligated to ask this question of Java.io Byte Streams in section Exploring java.lang & java.io of Java

Answer»

The correct ANSWER is (c) FileInputStream

For EXPLANATION I would SAY: NONE.

54.

Which of these method of InputStream is used to read integer representation of next available byte input?(a) read()(b) scanf()(c) get()(d) getInteger()I had been asked this question by my school teacher while I was bunking the class.This interesting question is from Java.io Byte Streams in section Exploring java.lang & java.io of Java

Answer» CORRECT CHOICE is (a) READ()

To EXPLAIN: NONE.
55.

Which of these classes is used for input and output operation when working with bytes?(a) InputStream(b) Reader(c) Writer(d) All of the mentionedThis question was addressed to me during a job interview.Asked question is from Java.io Byte Streams topic in chapter Exploring java.lang & java.io of Java

Answer»

The CORRECT choice is (a) InputStream

The BEST I can explain: InputStream & OutputStream are designed for byte STREAM. Reader and writer are designed for CHARACTER stream.

56.

Which of these is specified by a File object?(a) a file in disk(b) directory path(c) directory in disk(d) none of the mentionedThis question was posed to me in quiz.My question is based upon Java.io Introduction in portion Exploring java.lang & java.io of Java

Answer» RIGHT ANSWER is (c) directory in disk

The explanation: NONE.
57.

Which of these class is not related to input and output stream in terms of functioning?(a) File(b) Writer(c) InputStream(d) ReaderI have been asked this question by my school principal while I was bunking the class.This is a very interesting question from Java.io Introduction in section Exploring java.lang & java.io of Java

Answer»

Right option is (a) File

The explanation: A File describes properties of a file, a File object is used to obtain or MANIPULATE the information ASSOCIATED with a disk file, such as the permissions, time date, and directories PATH, and to NAVIGATE SUBDIRECTORIES.

58.

Which of these packages contain classes and interfaces used for input & output operations of a program?(a) java.util(b) java.lang(c) java.io(d) all of the mentionedThis question was posed to me during an interview.I need to ask this question from Java.io Introduction topic in portion Exploring java.lang & java.io of Java

Answer»

The correct option is (C) java.io

To explain I would SAY: java.io provides support for INPUT and output operations.

59.

Which of these interface is not a member of java.io package?(a) DataInput(b) ObjectInput(c) ObjectFilter(d) FileFilterThis question was addressed to me in homework.My question is based upon Java.io Introduction in division Exploring java.lang & java.io of Java

Answer» CORRECT CHOICE is (C) ObjectFilter

For EXPLANATION: NONE.
60.

Which of these class is not a member class of java.io package?(a) String(b) StringReader(c) Writer(d) FileI have been asked this question by my college director while I was bunking the class.My question comes from Java.io Introduction topic in section Exploring java.lang & java.io of Java

Answer» CORRECT CHOICE is (a) String

Explanation: NONE.
61.

Which of these method of Double wrapper can be used to check whether a given value is infinite or not?(a) Infinite()(b) isInfinite()(c) checkInfinite()(d) None of the mentionedThe question was posed to me in an interview for internship.I want to ask this question from Java.lang in section Exploring java.lang & java.io of Java

Answer»

The correct ANSWER is (b) isInfinite()

Best explanation: isInfinite() METHODS RETURNS true if the specified VALUE is an infinite value otherwise it returns false.

62.

Which of these methods can be used to check whether the given value is a number or not?(a) isNaN()(b) isNumber()(c) checkNaN()(d) checkNumber()The question was posed to me in an interview for internship.The doubt is from Java.lang in chapter Exploring java.lang & java.io of Java

Answer»

The CORRECT answer is (a) isNaN()

For explanation: isNaN() METHODS returns true if num SPECIFIED is not a number, OTHERWISE it returns false.

63.

Which of the following methods return the value as a double?(a) doubleValue()(b) converDouble()(c) getDouble()(d) getDoubleValue()I got this question in an online quiz.This intriguing question comes from Java.lang in division Exploring java.lang & java.io of Java

Answer» RIGHT OPTION is (a) doubleValue()

BEST EXPLANATION: NONE.
64.

Which of these method can set the out stream to OutputStream?(a) setStream()(b) setosteam()(c) setOut()(d) streamtoOstream()This question was posed to me in class test.My query is from Java.lang in portion Exploring java.lang & java.io of Java

Answer» RIGHT option is (c) SETOUT()

To ELABORATE: NONE.
65.

Which of these is a super class of wrappers Double and Float?(a) Long(b) Digits(c) Float(d) NumberI had been asked this question in class test.My enquiry is from Java.lang topic in section Exploring java.lang & java.io of Java

Answer»

The correct answer is (d) Number

Explanation: Number is an ABSTRACT class containing SUBCLASSES DOUBLE, FLOAT, Byte, Short, Integer and Long.

66.

Which of these methods loads the specified dynamic library?(a) load()(b) library()(c) loadlib()(d) loadlibrary()The question was asked during an online exam.This intriguing question originated from Java.lang in division Exploring java.lang & java.io of Java

Answer»

The correct CHOICE is (a) LOAD()

The explanation is: load() methods LOADS the dynamic library whose name is SPECIFIED.

67.

Which of these methods initiates garbage collection?(a) gc()(b) garbage()(c) garbagecollection()(d) Systemgarbagecollection()The question was posed to me in unit test.The above asked question is from Java.lang topic in chapter Exploring java.lang & java.io of Java

Answer» RIGHT ANSWER is (a) GC()

EXPLANATION: NONE.
68.

Which of these exceptions is thrown by methods of System class?(a) IOException(b) SystemException(c) SecurityException(d) InputOutputExceptionI had been asked this question during an interview.This intriguing question originated from Java.lang in portion Exploring java.lang & java.io of Java

Answer»

Right answer is (c) SecurityException

Easy explanation: System class METHODS THROW SecurityException.

69.

Which of these method is a rounding function of Math class?(a) max()(b) min()(c) abs()(d) all of the mentionedI got this question in an international level competition.My doubt is from Java.lang topic in portion Exploring java.lang & java.io of Java

Answer»

The correct choice is (d) all of the mentioned

The EXPLANATION is: MAX(), min() and ABS() are all rounding functions.

70.

Which of these class contains only floating point functions?(a) Math(b) Process(c) System(d) ObjectThe question was posed to me by my school teacher while I was bunking the class.This intriguing question comes from Java.lang in chapter Exploring java.lang & java.io of Java

Answer»

The correct answer is (a) Math

Explanation: Math CLASS contains all the floating point FUNCTIONS that are used for geometry, trigonometry, as well as several GENERAL purpose methods. Example : sin(), cos(), exp(), SQRT() etc.

71.

What is the value of double consonant ‘E’ defined in Math class?(a) approximately 3(b) approximately 3.14(c) approximately 2.72(d) approximately 0I have been asked this question in a national level competition.Question is taken from Java.lang topic in section Exploring java.lang & java.io of Java

Answer»

The correct ANSWER is (C) APPROXIMATELY 2.72

Easiest explanation: NONE.

72.

Which of these method of Object class can generate duplicate copy of the object on which it is called?(a) clone()(b) copy()(c) duplicate()(d) dito()This question was addressed to me in an interview.The doubt is from Java.lang topic in division Exploring java.lang & java.io of Java

Answer»

The CORRECT ANSWER is (a) CLONE()

EXPLANATION: NONE.

73.

Which of the following is method of System class is used to find how long a program takes to execute?(a) currenttime()(b) currentTime()(c) currentTimeMillis()(d) currenttimeMillis()This question was addressed to me in an internship interview.I'm obligated to ask this question of Java.lang in section Exploring java.lang & java.io of Java

Answer»

The CORRECT OPTION is (C) currentTimeMillis()

EXPLANATION: NONE.

74.

Which of these class can encapsulate an entire executing program?(a) Void(b) Process(c) Runtime(d) SystemThe question was posed to me in an interview for job.This interesting question is from Java.lang topic in division Exploring java.lang & java.io of Java

Answer»

The CORRECT CHOICE is (B) Process

Easy EXPLANATION: NONE.

75.

Which of these class is a superclass of all other classes?(a) Math(b) Process(c) System(d) ObjectThis question was posed to me by my school teacher while I was bunking the class.Enquiry is from Java.lang topic in portion Exploring java.lang & java.io of Java

Answer»

The correct answer is (d) Object

Best EXPLANATION: The object CLASS class is a superclass of all other CLASSES.

76.

Standard output variable ‘out’ is defined in which class?(a) Void(b) Process(c) Runtime(d) SystemThis question was addressed to me during an interview for a job.Enquiry is from Java.lang in chapter Exploring java.lang & java.io of Java

Answer»

Right answer is (d) System

To EXPLAIN I would say: Standard OUTPUT variable ‘out’ is defined in System class. out is USUALLY used in print STATEMENT i:e System.out.print().

77.

Which of the following method of Process class can terminate a process?(a) void kill()(b) void destroy()(c) void terminate()(d) void exit()This question was addressed to me in exam.My doubt is from Java.lang in division Exploring java.lang & java.io of Java

Answer»

Correct answer is (b) void destroy()

To EXPLAIN I WOULD say: Kills the subprocess. The subprocess REPRESENTED by this Process OBJECT is forcibly terminated.

78.

Which of these class have only one field ‘TYPE’?(a) Void(b) Process(c) System(d) RuntimeThis question was posed to me in an online quiz.This key question is from Java.lang topic in chapter Exploring java.lang & java.io of Java

Answer»

Right choice is (a) VOID

The explanation: The Void class has one FIELD, TYPE, which holds a REFERENCE to the Class OBJECT for the type void.

79.

Which of the following is method of wrapper Integer for converting the value of an object into int?(a) bytevalue()(b) int intValue();(c) Bytevalue()(d) Byte Bytevalue()I got this question in exam.My enquiry is from Java.lang topic in chapter Exploring java.lang & java.io of Java

Answer» RIGHT option is (B) INT intValue();

To EXPLAIN: None.
80.

Which of the following is a method of wrapper Float for converting the value of an object into byte?(a) bytevalue()(b) byte byteValue()(c) Bytevalue()(d) Byte Bytevalue()This question was addressed to me in examination.The above asked question is from Java.lang Introduction in portion Exploring java.lang & java.io of Java

Answer»

The CORRECT OPTION is (B) BYTE byteValue()

The best I can explain: None.

81.

Which of these is a wrapper for simple data type char?(a) Float(b) Character(c) String(d) IntegerThis question was addressed to me in quiz.This interesting question is from Java.lang in chapter Exploring java.lang & java.io of Java

Answer»

The CORRECT OPTION is (B) Character

For EXPLANATION: NONE.

82.

Which of these is a super class of wrappers Long, Character & Integer?(a) Long(b) Digits(c) Float(d) NumberThis question was addressed to me in an online quiz.This intriguing question comes from Java.lang in section Exploring java.lang & java.io of Java

Answer» RIGHT ANSWER is (d) Number

To elaborate: Number is an abstract class CONTAINING subclasses Double, Float, Byte, Short, INTEGER and Long.
83.

Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?(a) int hash()(b) int hashcode()(c) int hashCode()(d) Integer hashcode()The question was posed to me in an internship interview.This intriguing question originated from Java.lang topic in section Exploring java.lang & java.io of Java

Answer» CORRECT OPTION is (c) INT hashCode()

To explain I would say: None.
84.

Which of these is a wrapper for data type int?(a) Integer(b) Long(c) Byte(d) DoubleThis question was posed to me in class test.Question is from Java.lang topic in section Exploring java.lang & java.io of Java

Answer» CORRECT ANSWER is (a) Integer

Explanation: NONE.
85.

Which of these methods is used to check for infinitely large and small values?(a) isInfinite()(b) isNaN()(c) Isinfinite()(d) IsNaN()The question was asked in an internship interview.My question is taken from Java.lang Introduction in portion Exploring java.lang & java.io of Java

Answer»

The CORRECT answer is (a) isInfinite()

BEST explanation: isinfinite() METHOD returns true is the VALUE being tested is infinitely LARGE or small in magnitude.

86.

Which of these is a wrapper for simple data type float?(a) float(b) double(c) Float(d) DoubleI got this question by my college director while I was bunking the class.My question comes from Java.lang Introduction in portion Exploring java.lang & java.io of Java

Answer»

Correct CHOICE is (C) Float

The best EXPLANATION: NONE.

87.

Which of these is a super class of wrappers Double & Integer?(a) Long(b) Digits(c) Float(d) NumberThe question was asked during an internship interview.This intriguing question originated from Java.lang Introduction topic in division Exploring java.lang & java.io of Java

Answer» CORRECT option is (d) Number

The BEST EXPLANATION: Number is an ABSTRACT class CONTAINING subclasses Double, Float, Byte, Short, Integer and Long.
88.

Which of these is a process of converting a simple data type into a class?(a) type wrapping(b) type conversion(c) type casting(d) none of the MentionedThe question was asked in an interview for job.My doubt is from Java.lang Introduction in portion Exploring java.lang & java.io of Java

Answer» RIGHT choice is (a) TYPE wrapping

The BEST explanation: NONE.
89.

Which of these classes is not included in java.lang?(a) Byte(b) Integer(c) Array(d) ClassThe question was asked in my homework.The above asked question is from Java.lang Introduction topic in section Exploring java.lang & java.io of Java

Answer» CORRECT ANSWER is (c) ARRAY

Easiest explanation: Array class is a MEMBER of java.util.