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. |
The string class deals with string of only character type.(a) True(b) FalseI got this question in an international level competition.This intriguing question comes from String Class topic in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct option is (a) True |
|
| 2. |
If two arguments are passed to the indexOf() function then ___________________(a) Second argument indicates the occurrence number of specified character from starting(b) Second argument indicates the occurrence number of specified character from end(c) Second argument indicates the index of the character in first argument(d) Second argument indicates the index of the character from the last of the stringThis question was addressed to me in a national level competition.I need to ask this question from String Class topic in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» Right option is (a) Second ARGUMENT INDICATES the occurrence number of SPECIFIED character from starting |
|
| 3. |
Function replace() accepts _____________ arguments.(a) 1(b) 2(c) 3(d) 4I got this question in semester exam.Enquiry is from String Class in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct option is (b) 2 |
|
| 4. |
String trim() function is used to _______________________(a) Remove all the white spaces from the string(b) Remove white space from start of string(c) Remove white space at end of string(d) Remove white space from both the ends of stringThis question was posed to me during an online exam.My question is from String Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» The CORRECT OPTION is (d) Remove white space from both the ends of STRING |
|
| 5. |
String class provides function toUpper() to _____________________(a) Convert first character to uppercase(b) Convert last character to uppercase(c) Convert the whole string characters to uppercase(d) Convert uppercase to lower and lower to uppercasesThe question was posed to me during an interview.Origin of the question is String Class topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct option is (c) Convert the WHOLE string CHARACTERS to uppercase |
|
| 6. |
The compareTo() function is used to ________________(a) Compare strings value to string object(b) Compare string value to string value(c) Compare string object to another string object(d) Compare string object to another string valueThis question was posed to me in an internship interview.This intriguing question originated from String Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Right CHOICE is (c) COMPARE string OBJECT to another string object |
|
| 7. |
Function equals() is _______________ and equalIgnoreCase() is _________________(a) Case Insensitive, case insensitive(b) Case sensitive, Case insensitive(c) Case sensitive, case sensitive(d) Case insensitive, case sensitiveI have been asked this question during an interview.Origin of the question is String Class topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» Right answer is (b) CASE sensitive, Case insensitive |
|
| 8. |
The function lastIndexOf() is used to ___________________(a) Get the index of last occurrence of specified character in argument(b) Get the index of first occurrence of specified character in argument(c) Get the index of last occurrence of first character in string(d) Get the index of last occurrence of last character of stringThis question was addressed to me by my school teacher while I was bunking the class.This question is from String Class topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Right choice is (a) Get the INDEX of last OCCURRENCE of specified character in argument |
|
| 9. |
String class have a concat() function that is used to _____________________(a) Replace old string by new string(b) Add two strings(c) Append one string at end of another string(d) Remove a string from end of one stringI have been asked this question during an online exam.Origin of the question is String Class topic in division Inbuilt Classes of Object Oriented Programming |
|
Answer» RIGHT choice is (c) Append one string at end of another string The explanation is: The CONCAT FUNCTION is USED to append string into another string. The new string is always appended at the end of source string. The target string is appended as it is and the whole string is then ended by null CHARACTER. |
|
| 10. |
If two index are given as argument to substring function then ___________________(a) String of length equal to sum of two arguments is returned(b) String starting from first index and of length equal to send argument(c) String starting from first index and of length equal to sum of two arguments(d) String starting from first index and ending at second index positionThis question was posed to me in my homework.This key question is from String Class in division Inbuilt Classes of Object Oriented Programming |
|
Answer» The CORRECT OPTION is (d) String starting from first index and ENDING at second index position |
|
| 11. |
If only one parameter is passed to substring function then __________________(a) It returns the character at the specified position(b) It returns the string of length 1 from the specified index(c) It returns the string from specified index till the end(d) It returns the string from starting of string till the specified indexThis question was posed to me in examination.This intriguing question comes from String Class in section Inbuilt Classes of Object Oriented Programming |
|
Answer» The CORRECT option is (C) It returns the string from specified index till the END |
|
| 12. |
Which is the function to get the character present at a particular index in the string?(a) char charAt(index);(b) char charIn(StringName);(c) char charAt(StringName);(d) char charIn(index);I got this question in homework.My enquiry is from String Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» RIGHT answer is (a) char charAt(index); The explanation: The function can be called USING dot operator with the string object. Char is the return TYPE of the function to return the character at specified position. The index MUST be an integer value, less than the length of string. |
|
| 13. |
What does function length do in String class?(a) Returns length of string including null character(b) Returns length of string excluding null character(c) Returns length of substring(d) Returns size of string in bytesThis question was addressed to me in an international level competition.My question is based upon String Class in division Inbuilt Classes of Object Oriented Programming |
|
Answer» The CORRECT ANSWER is (b) Returns length of string excluding null character |
|
| 14. |
How to declare an object of class String?(a) String object_Name = value;(b) String object_name = new;(c) String object_name= new value;(d) String object_name= value new;I have been asked this question in an interview for job.My query is from String Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» The CORRECT ANSWER is (a) String object_Name = value; |
|
| 15. |
Which is a true statement for object of String class?(a) Object are immutable(b) Object are mutable(c) Object are created only once(d) Object can’t be createdI had been asked this question in a national level competition.The origin of the question is String Class topic in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct option is (a) Object are IMMUTABLE |
|
| 16. |
Which among the following is a serialization descriptor for any class?(a) StreamClass(b) ObjectStreamClass(c) ObjectStream(d) StreamObjectClassI had been asked this question in examination.The above asked question is from IO Class topic in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» Right choice is (b) OBJECTSTREAMCLASS |
|
| 17. |
RandomAccessFile can be used to _______________________(a) Read from a random access file(b) Write to a random access file(c) Read and write to a random access file(d) Restricts read and write to a random access fileI got this question in class test.I need to ask this question from IO Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Right option is (c) Read and write to a random access file |
|
| 18. |
PushBackReader allows the streams to be pushed back to the stream.(a) True(b) FalseThe question was posed to me in a national level competition.My question is based upon IO Class topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Right CHOICE is (a) True |
|
| 19. |
Which exception handler can be used when character encoding is not supported?(a) UnsupportedException(b) UnsupportedEncodingException(c) SupportException(d) EncodingExceptionThis question was posed to me in an online quiz.My question is from IO Class topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct ANSWER is (B) UnsupportedEncodingException |
|
| 20. |
StringReader handles _____________________(a) Any character stream(b) A character stream whose source is an array(c) A character stream whose source is character array(d) A character stream whose source is String onlyI had been asked this question in an interview.My doubt is from IO Class topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» Right ANSWER is (d) A character stream whose source is STRING only |
|
| 21. |
Which class can handle IO class interrupt?(a) ExceptionIO(b) InteruptedIO(c) InteruptedIOException(d) IOInteruptExceptionI have been asked this question by my school principal while I was bunking the class.Origin of the question is IO Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Right choice is (C) InteruptedIOException |
|
| 22. |
Reader class is _________________(a) Used to read from files(b) Abstract class to read character streams(c) Abstract class to input character streams(d) Used to take input from standard input streamThe question was posed to me by my college director while I was bunking the class.The query is from IO Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct option is (b) ABSTRACT CLASS to read character streams |
|
| 23. |
Which class among the following makes incorrect assumptions?(a) LineNumberInputStream(b) LineNumberReader(c) LineReader(d) LineBufferI got this question during an interview for a job.Question is taken from IO Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Right OPTION is (a) LineNumberInputStream |
|
| 24. |
What does FilePermission class do?(a) This class is used to give permission rights to a file(b) This class is used to restrict the use of permissions(c) This class is used to represent device access permissions(d) This class is used to represent file access permissionsI had been asked this question in an interview.This interesting question is from IO Class topic in division Inbuilt Classes of Object Oriented Programming |
|
Answer» Right answer is (d) This class is used to REPRESENT file access permissions |
|
| 25. |
FileInputStream _________________________(a) Gets the input stream from any device file(b) Gets the input stream from any open socket(c) Gets the input stream from any cache(d) Gets the input stream from any open file onlyThis question was addressed to me in unit test.I'm obligated to ask this question of IO Class topic in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct answer is (d) Gets the input STREAM from any open file only |
|
| 26. |
What is a FileDescriptor?(a) A handle for machine specific structure of an open file(b) A handle for program specific structure of an open file(c) A handle for compiler specific structure of an open file(d) A handle for representing device files structureThe question was asked in homework.I want to ask this question from IO Class topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct ANSWER is (a) A HANDLE for machine specific structure of an open FILE |
|
| 27. |
File class is ____________________________(a) An abstract of file representation only(b) An abstract of path names only(c) An abstract which can be used to represent path names or file(d) An abstract which can represent a file in any formatThis question was addressed to me during an interview.Enquiry is from IO Class topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct answer is (C) An abstract which can be used to represent path names or file |
|
| 28. |
Which among the following class contains the methods to access character based console device?(a) Console(b) File(c) Device(d) PipeThe question was posed to me during an interview.Enquiry is from IO Class in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct OPTION is (a) Console |
|
| 29. |
IO class provides input and output through ______________________(a) Data streams(b) Serialization(c) File system(d) Data streams, serialization and file systemThe question was posed to me in an interview for job.This is a very interesting question from IO Class topic in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct option is (d) DATA streams, SERIALIZATION and file system |
|
| 30. |
What is the use of IO class?(a) To handle all the input operations(b) To handle all the output operations(c) To handle all the input and output operations(d) To handle all the input and output to the standard inputI got this question in unit test.Asked question is from IO Class in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» CORRECT option is (c) To handle all the input and output operations Easiest explanation - The IO class provides FUNCTIONS that can be used to handle input and output operations. All the inputs from standard input and standard output, and also from the files can be handled. This GIVES the FLEXIBILITY to make the programs more user friendly. |
|
| 31. |
Which package contains the utility classes?(a) java.lang(b) java.utility(c) java.util(d) java.ioThis question was posed to me during an online interview.My doubt stems from Inbuilt Classes in section Inbuilt Classes of Object Oriented Programming |
|
Answer» Right OPTION is (C) java.util |
|
| 32. |
Which is not a System class variable?(a) err(b) out(c) in(d) putThis question was posed to me in final exam.I need to ask this question from Inbuilt Classes in section Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct answer is (d) PUT |
|
| 33. |
What does load(String)::= function do, in System class?(a) Loads dynamic library for a path name(b) Loads all the dynamic libraries(c) Loads all the Number in string format(d) Loads the processor with calculationsI had been asked this question in an online quiz.My question is taken from Inbuilt Classes topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» RIGHT answer is (a) Loads dynamic library for a path name Explanation: Only the SPECIFIED path NAMED dynamic libraries are loaded. All the dynamic libraries can’t be loaded at a time. Hence we use this function for specific libraries. |
|
| 34. |
Which class contain runFinalization() method?(a) Finalize(b) System(c) Final(d) SystemFinalI got this question during an online exam.My enquiry is from Inbuilt Classes topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct answer is (b) System |
|
| 35. |
Which function should be used to exit from the program that is provided by System class?(a) exit(int);(b) gc();(c) terminate();(d) halt();I have been asked this question in unit test.I want to ask this question from Inbuilt Classes topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct answer is (a) exit(INT); |
|
| 36. |
Number class can’t manipulate ____________________(a) Integer values(b) Float values(c) Byte values(d) Character valuesThis question was addressed to me during an online exam.This intriguing question comes from Inbuilt Classes in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» CORRECT answer is (d) Character values Explanation: The Number class is used to WORK with all the number type of values. The integers, FLOAT, double, byte etc. are all number type values. Character is not a number VALUE. |
|
| 37. |
Which attribute can be used to get the size of an array?(a) Size.Array(b) Array.Size(c) Array_name.length(d) length.Array_nameI had been asked this question during an online interview.This intriguing question originated from Inbuilt Classes in section Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct ANSWER is (c) Array_name.length |
|
| 38. |
DataInputStream is derived from ______________________(a) StreamingInput(b) StreamedInput(c) StreameInput(d) StreamInputI got this question in an internship interview.The origin of the question is Inbuilt Classes topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» CORRECT option is (d) StreamInput Explanation: The DataInputStream is more SPECIFIC class for operating on specific type of DATA inputs. This is USED to read data of specific type. The same can be used to read data in a specific FORMAT. |
|
| 39. |
What is the use of Math class?(a) To use the mathematical functions with strings(b) To use the mathematical functions(c) To suppress the use of mathematical functions(d) To complex the calculationsThis question was addressed to me by my school teacher while I was bunking the class.This intriguing question comes from Inbuilt Classes in section Inbuilt Classes of Object Oriented Programming |
|
Answer» RIGHT option is (B) To USE the mathematical functions Best explanation: The Math class is provided with some special functions. These functions can be used to CALCULATE and get result of some special and usual mathematical functions. We don’t have to write the code to calculate the trigonometric function results, instead we can use Math functions. |
|
| 40. |
Which statement is true for the Array class?(a) Arrays can have variable length(b) The length array can be changed(c) Each class has an associated Array class(d) Arrays can contain different type of valuesThe question was posed to me in an online interview.I would like to ask this question from Inbuilt Classes topic in division Inbuilt Classes of Object Oriented Programming |
|
Answer» Right option is (c) Each CLASS has an associated ARRAY class |
|
| 41. |
What is the InputStream class meant for?(a) To handle all input streams(b) To handle all output streams(c) To handle all input and output streams(d) To handle only input from fileThe question was asked in an interview for internship.My question is taken from Inbuilt Classes in division Inbuilt Classes of Object Oriented Programming |
|
Answer» RIGHT option is (a) To handle all input streams Easy explanation - The INPUTSTREAM is an inbuilt class which is used to handle all the TASKS related to input handling. This class extends input from keyboard or FILE or any other possible input stream. |
|
| 42. |
Which among the following not an inbuilt class in C++?(a) System(b) Color(c) String(d) FunctionsI have been asked this question in quiz.I would like to ask this question from Inbuilt Classes topic in section Inbuilt Classes of Object Oriented Programming |
|
Answer» CORRECT option is (d) Functions To EXPLAIN: There is no inbuilt CLASS named function in java. The others are classes already provided in java. All those classes contain some special functions to be USED in programming. |
|
| 43. |
What doesn’t inbuilt classes contain?(a) Function prototype(b) Function declaration(c) Function definitions(d) ObjectsI had been asked this question by my school teacher while I was bunking the class.Question is from Inbuilt Classes in chapter Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct CHOICE is (c) FUNCTION definitions |
|
| 44. |
Inbuilt class __________________________(a) Must be included before use(b) Are not necessary to be included for use(c) Are used by the compiler only(d) Can be modified by programmer alwaysThe question was posed to me in examination.This interesting question is from Inbuilt Classes topic in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» The correct OPTION is (a) MUST be included before use |
|
| 45. |
What are inbuilt classes?(a) The predefined classes in a language(b) The classes that are defined by the user(c) The classes which are meant to be modified by the user(d) The classes which can’t be used by the userI have been asked this question in a job interview.The question is from Inbuilt Classes in portion Inbuilt Classes of Object Oriented Programming |
|
Answer» Correct choice is (a) The predefined classes in a LANGUAGE |
|