InterviewSolution
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.
| 1. |
Which system property stores installation directory of JRE?(a) user.home(b) java.class.path(c) java.home(d) user.dirThe question was asked by my school principal while I was bunking the class.This interesting question is from Environment Properties topic in portion Exploring java.lang & java.io of Java |
|
Answer» Correct choice is (c) JAVA.home |
|
| 2. |
Java system properties can be set at runtime.(a) True(b) FalseI had been asked this question in an interview for internship.Question is taken from Environment Properties in section Exploring java.lang & java.io of Java |
|
Answer» Correct choice is (a) True |
|
| 3. |
Which of the following is true about Java system properties?(a) Java system properties are accessible by any process(b) Java system properties are accessible by processes they are added to(c) Java system properties are retrieved by System.getenv()(d) Java system properties are set by System.setenv()I had been asked this question by my college professor while I was bunking the class.I want to ask this question from Environment Properties in section Exploring java.lang & java.io of Java |
|
Answer» Right ANSWER is (B) Java system properties are accessible by PROCESSES they are ADDED to |
|
| 4. |
Which object Java application uses to create a new process?(a) Process(b) Builder(c) ProcessBuilder(d) CreateBuilderThe question was asked by my college professor while I was bunking the class.My question is based upon Environment Properties in chapter Exploring java.lang & java.io of Java |
|
Answer» Right choice is (c) PROCESSBUILDER |
|
| 5. |
Which of this interface is implemented by Thread class?(a) Runnable(b) Connections(c) Set(d) MapConnectionsThe question was posed to me in semester exam.This is a very interesting question from Java.lang in portion Exploring java.lang & java.io of Java |
|
Answer» RIGHT ANSWER is (a) Runnable The EXPLANATION is: NONE. |
|
| 6. |
Which of these methods of a Thread class is used to suspend a thread for a period of time?(a) sleep()(b) terminate()(c) suspend()(d) stop()I had been asked this question in homework.My enquiry is from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» Right option is (a) SLEEP() |
|
| 7. |
Which of the interface contains all the methods used for handling thread related operations in Java?(a) Runnable interface(b) Math interface(c) System interface(d) ThreadHandling interfaceThe question was asked in class test.I'd like to ask this question from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» Right ANSWER is (a) Runnable INTERFACE |
|
| 8. |
Which of these class is used to make a thread?(a) String(b) System(c) Thread(d) RunnableThe question was asked in a national level competition.This intriguing question comes from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» Correct choice is (c) THREAD |
|
| 9. |
Which of these methods return a class object given its name?(a) getClass()(b) findClass()(c) getSystemClass()(d) findSystemClass()I have been asked this question in an online interview.I would like to ask this question from Java.lang topic in division Exploring java.lang & java.io of Java |
|
Answer» CORRECT choice is (d) findSystemClass() Easiest explanation: findSystemClass() returnsa CLASS object GIVEN its NAME. |
|
| 10. |
Which of these methods returns the class of an object?(a) getClass()(b) Class()(c) WhoseClass()(d) WhoseObject()I had been asked this question by my college director while I was bunking the class.My enquiry is from Java.lang in portion Exploring java.lang & java.io of Java |
|
Answer» RIGHT option is (a) GETCLASS() The best explanation: NONE. |
|
| 11. |
Which of these methods returns the total number of bytes of memory available to the program?(a) getMemory()(b) TotalMemory()(c) SystemMemory()(d) getProcessMemory()I had been asked this question during an internship interview.My question comes from Java.lang in division Exploring java.lang & java.io of Java |
|
Answer» Right option is (B) TotalMemory() |
|
| 12. |
Which of these classes encapsulate runtime state of an object?(a) Class(b) System(c) Runtime(d) CacheThis question was posed to me during a job interview.My query is from Java.lang topic in division Exploring java.lang & java.io of Java |
|
Answer» CORRECT CHOICE is (a) Class The EXPLANATION is: NONE. |
|
| 13. |
Which of the following exceptions is thrown by every method of Runtime class?(a) IOException(b) SystemException(c) SecurityException(d) RuntimeExceptionI had been asked this question in an interview for job.My question comes from Java.lang in division Exploring java.lang & java.io of Java |
|
Answer» The correct ANSWER is (C) SecurityException |
|
| 14. |
Which of these classes encapsulate runtime environment?(a) Class(b) System(c) Runtime(d) ClassLoaderI had been asked this question in a job interview.This is a very interesting question from Java.lang in chapter Exploring java.lang & java.io of Java |
|
Answer» The CORRECT ANSWER is (C) Runtime |
|
| 15. |
toRadian() and toDegree() methods were added by which version of Java?(a) Java 1.0(b) Java 1.5(c) Java 2.0(d) Java 3.0The question was asked in an interview for job.Question is from Java.lang in portion Exploring java.lang & java.io of Java |
|
Answer» The CORRECT choice is (c) JAVA 2.0 |
|
| 16. |
Which of these method converts radians to degrees?(a) toRadian()(b) toDegree()(c) convertRadian()(d) converDegree()I got this question in semester exam.Origin of the question is Java.lang in chapter Exploring java.lang & java.io of Java |
|
Answer» CORRECT choice is (B) TODEGREE() The EXPLANATION: None. |
|
| 17. |
Which of these method returns the remainder of dividend / divisor?(a) remainder()(b) getRemainder()(c) CSIremainder()(d) IEEEremainder()I had been asked this question during an internship interview.My enquiry is from Java.lang topic in division Exploring java.lang & java.io of Java |
|
Answer» The correct CHOICE is (d) IEEEremainder() |
|
| 18. |
Which of these method return a pseudorandom number?(a) rand()(b) random()(c) randomNumber()(d) randGenerator()I had been asked this question in an interview.I need to ask this question from Java.lang topic in section Exploring java.lang & java.io of Java |
| Answer» | |
| 19. |
Which of these class contains all the methods present in Math class?(a) SystemMath(b) StrictMath(c) Compiler(d) ClassLoaderThe question was posed to me by my college director while I was bunking the class.Enquiry is from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» The correct choice is (b) StrictMath |
|
| 20. |
Which of these methods is used to know whether a string contains “true”?(a) valueOf()(b) valueOfString()(c) getString()(d) none of the mentionedI got this question by my college director while I was bunking the class.My enquiry is from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» RIGHT answer is (a) valueOf() Best explanation: valueOf() RETURNS true if the specified string contains “true” in lower or UPPERCASE and FALSE OTHERWISE. |
|
| 21. |
Which of these methods return string equivalent of Boolean object?(a) getString()(b) toString()(c) converString()(d) getStringObject()This question was addressed to me in my homework.My query is from Java.lang topic in portion Exploring java.lang & java.io of Java |
|
Answer» RIGHT OPTION is (B) TOSTRING() The explanation: None. |
|
| 22. |
Which of the following constant are defined in Boolean wrapper?(a) TRUE(b) FALSE(c) TYPE(d) All of the mentionedThis question was posed to me in my homework.This interesting question is from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» Correct OPTION is (d) All of the mentioned |
|
| 23. |
Which of these methods is used to know whether a given Character object is part of Java’s Identifiers?(a) isIdentifier()(b) isJavaIdentifier()(c) isJavaIdentifierPart()(d) none of the mentionedI had been asked this question during an internship interview.My question is based upon Java.lang topic in portion Exploring java.lang & java.io of Java |
|
Answer» The CORRECT CHOICE is (C) isJavaIdentifierPart() |
|
| 24. |
Which of these is a super class of Character wrapper?(a) Long(b) Digits(c) Float(d) NumberI have been asked this question in an interview.Asked question is from Java.lang topic in section Exploring java.lang & java.io of Java |
|
Answer» Right choice is (d) Number |
|
| 25. |
Which of these methods of Boolean wrapper returns boolean equivalent of an object.(a) getBool()(b) booleanValue()(c) getbooleanValue()(d) getboolValue()I had been asked this question during an online interview.My question is taken from Java.lang in portion Exploring java.lang & java.io of Java |
|
Answer» CORRECT OPTION is (B) booleanValue() For EXPLANATION: NONE. |
|
| 26. |
Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.(a) get()(b) getVhar()(c) charValue()(d) getCharacter()The question was posed to me during an interview for a job.Asked question is from Java.lang in section Exploring java.lang & java.io of Java |
|
Answer» Correct ANSWER is (c) charValue() |
|
| 27. |
Which of the following constant are defined in Character wrapper?(a) MAX_RADIX(b) MAX_VALUE(c) TYPE(d) All of the mentionedI had been asked this question in an online quiz.My question is from Java.lang in division Exploring java.lang & java.io of Java |
|
Answer» The correct choice is (d) All of the mentioned |
|
| 28. |
Which of these methods of Byte wrapper can be used to obtain Byte object from a string?(a) toString()(b) getString()(c) decode()(d) encode()The question was asked at a job interview.My question is based upon Java.lang in chapter Exploring java.lang & java.io of Java |
|
Answer» Right option is (c) DECODE() |
|
| 29. |
Which of the following methods Byte wrapper return the value as a double?(a) doubleValue()(b) converDouble()(c) getDouble()(d) getDoubleValue()The question was posed to me in examination.My question is from Java.lang in section Exploring java.lang & java.io of Java |
|
Answer» CORRECT ANSWER is (a) doubleValue() For explanation: doubleValue() RETURNS the value of invoking OBJECT as double. |
|
| 30. |
Which of these is a super class of wrappers Byte and short wrappers?(a) Long(b) Digits(c) Float(d) NumberThe question was asked in my homework.I'd like to ask this question from Java.lang in division Exploring java.lang & java.io of Java |
|
Answer» RIGHT answer is (d) Number Explanation: Number is an ABSTRACT class CONTAINING subclasses DOUBLE, Float, BYTE, Short, Integer and Long. |
|
| 31. |
Which of these methods return a smallest whole number greater than or equal to variable X?(a) double ceil(double X)(b) double floor(double X)(c) double max(double X)(d) double min(double X)This question was posed to me in an interview.This intriguing question originated from Java.lang topic in chapter Exploring java.lang & java.io of Java |
|
Answer» The correct answer is (a) double ceil(double X) |
|
| 32. |
Which of these method returns a largest whole number less than or equal to variable X?(a) double ceil(double X)(b) double floor(double X)(c) double max(double X)(d) double min(double X)This question was addressed to me in quiz.Question is from Java.lang in chapter Exploring java.lang & java.io of Java |
|
Answer» The correct CHOICE is (b) double FLOOR(double X) |
|
| 33. |
Which of these exceptions will be thrown if we use null reference for an arithmetic operation?(a) ArithmeticException(b) NullPointerException(c) IllegalAccessException(d) IllegalOperationExceptionI had been asked this question by my school principal while I was bunking the class.I'd like to ask this question from Java’s Built in Exceptions topic in chapter Exploring java.lang & java.io of Java |
|
Answer» Right CHOICE is (b) NullPointerException |
|
| 34. |
Which of these class provides various types of rounding functions?(a) Math(b) Process(c) System(d) ObjectThis question was addressed to me in an online quiz.This interesting question is from Java.lang topic in division Exploring java.lang & java.io of Java |
|
Answer» The CORRECT CHOICE is (a) Math |
|
| 35. |
Which of these packages contain all the Java’s built in exceptions?(a) java.io(b) java.util(c) java.lang(d) java.netI got this question in homework.My doubt is from Java’s Built in Exceptions topic in portion Exploring java.lang & java.io of Java |
|
Answer» RIGHT OPTION is (C) java.lang Best EXPLANATION: NONE. |
|
| 36. |
Which of these exceptions handles the situations when an illegal argument is used to invoke a method?(a) IllegalException(b) Argument Exception(c) IllegalArgumentException(d) IllegalMethodArgumentExcepetionThe question was posed to me in my homework.My doubt stems from Java’s Built in Exceptions in chapter Exploring java.lang & java.io of Java |
|
Answer» RIGHT answer is (c) IllegalArgumentException The BEST EXPLANATION: NONE. |
|
| 37. |
Which of these exceptions will be thrown if we declare an array with negative size?(a) IllegalArrayException(b) IllegalArraySizeExeption(c) NegativeArrayException(d) NegativeArraySizeExeptionThe question was posed to me in a job interview.Asked question is from Java’s Built in Exceptions topic in portion Exploring java.lang & java.io of Java |
|
Answer» Right choice is (d) NegativeArraySizeExeption |
|
| 38. |
Where is String Pool stored?(a) Java Stack(b) Java Heap(c) Permanent Generation(d) MetaspaceThe question was asked in an interview.The doubt is from Memory Management topic in section Exploring java.lang & java.io of Java |
|
Answer» Correct CHOICE is (b) JAVA Heap |
|
| 39. |
Classes and Methods are stored in which space?(a) Eden space(b) Survivor space(c) Tenured space(d) Permanent spaceI had been asked this question in a job interview.Enquiry is from Memory Management topic in section Exploring java.lang & java.io of Java |
|
Answer» Right answer is (d) Permanent space |
|
| 40. |
What is the Java 8 update of PermGen?(a) Code Cache(b) Tenured Space(c) Metaspace(d) Eden spaceThis question was addressed to me in homework.Question is taken from Memory Management in section Exploring java.lang & java.io of Java |
|
Answer» The correct answer is (C) Metaspace |
|
| 41. |
Which of the following is not a memory classification in java?(a) Young(b) Old(c) Permanent(d) TemporaryI got this question during an online interview.My question is based upon Memory Management topic in division Exploring java.lang & java.io of Java |
|
Answer» Right OPTION is (d) Temporary |
|
| 42. |
Which class loader loads jar files from JDK directory?(a) Bootstrap(b) Extension(c) System(d) HeapI had been asked this question in semester exam.This is a very interesting question from Memory Management topic in section Exploring java.lang & java.io of Java |
|
Answer» The CORRECT answer is (B) Extension |
|
| 43. |
Which one of the following is a class loader?(a) Bootstrap(b) Compiler(c) Heap(d) InterpreterI had been asked this question by my college director while I was bunking the class.This intriguing question comes from Memory Management in section Exploring java.lang & java.io of Java |
|
Answer» Correct ANSWER is (a) BOOTSTRAP |
|
| 44. |
Does code Segment loads the java code?(a) True(b) FalseI had been asked this question in a job interview.I need to ask this question from Memory Management in portion Exploring java.lang & java.io of Java |
|
Answer» Right option is (a) True |
|
| 45. |
What is JVM?(a) Bootstrap(b) Interpreter(c) Extension(d) CompilerThis question was addressed to me in homework.My doubt is from Memory Management topic in section Exploring java.lang & java.io of Java |
|
Answer» Right option is (b) Interpreter |
|
| 46. |
Which of the following is not a segment of memory in java?(a) Stack Segment(b) Heap Segment(c) Code Segment(d) Register SegmentThe question was asked in an interview.My question is based upon Memory Management in portion Exploring java.lang & java.io of Java |
|
Answer» Correct answer is (d) Register Segment |
|
| 47. |
Which of these class can be used to implement the input stream that uses a character array as the source?(a) BufferedReader(b) FileReader(c) CharArrayReader(d) FileArrayReaderThis question was addressed to me in an interview for job.My enquiry is from Java.io Character Streams topic in portion Exploring java.lang & java.io of Java |
|
Answer» Correct choice is (c) CharArrayReader |
|
| 48. |
Which of these class is used to read characters in a file?(a) FileReader(b) FileWriter(c) FileInputStream(d) InputStreamReaderThe question was asked during an internship interview.I need to ask this question from Java.io Character Streams in chapter Exploring java.lang & java.io of Java |
|
Answer» CORRECT ANSWER is (a) FileReader Explanation: NONE. |
|
| 49. |
Which of these method of FileReader class is used to read characters from a file?(a) read()(b) scanf()(c) get()(d) getInteger()I got this question during an interview for a job.I would like to ask this question from Java.io Character Streams topic in section Exploring java.lang & java.io of Java |
|
Answer» CORRECT OPTION is (a) READ() For EXPLANATION: NONE. |
|
| 50. |
Which of these stream contains the classes which can work on character stream?(a) InputStream(b) OutputStream(c) Character Stream(d) All of the mentionedI had been asked this question in a national level competition.My question comes from Java.io Character Streams topic in division Exploring java.lang & java.io of Java |
|
Answer» The correct answer is (C) CHARACTER Stream |
|