Professional Documents
Culture Documents
sanfoundry.com
Answer: a
Explanation: The classes that are already provided in a
programming language for use are inbuilt classes. These
classes provide some functions or objects that can be used
by the programmer for easier code.
1 of 7 3/19/18, 10:29 AM
Inbuilt Classes - Object Oriented Programming... about:reader?url=https://www.sanfoundry.com/...
Answer: a
Explanation: The inbuilt classes must be included in the
program. Whenever some functions are used, they must
have a declaration before use. The same is case with
classes.
Answer: c
Explanation: The classes contain the definitions of the
special functions that are provided for the programmers
use. Those functions can be used to make the
programming easy and to reuse the already existing code.
Answer: d
Explanation: There is no inbuilt class named function in
java. The others are classes already provided in java. All
2 of 7 3/19/18, 10:29 AM
Inbuilt Classes - Object Oriented Programming... about:reader?url=https://www.sanfoundry.com/...
Answer: a
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.
Answer: c
Explanation: The Array class is associated with all the other
classes. This gives us flexibility to declare an array of any
type. The index goes from 0 to n, where n is some fixed
size for array.
3 of 7 3/19/18, 10:29 AM
Inbuilt Classes - Object Oriented Programming... about:reader?url=https://www.sanfoundry.com/...
Answer: b
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.
Answer: d
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.
Answer: c
4 of 7 3/19/18, 10:29 AM
Inbuilt Classes - Object Oriented Programming... about:reader?url=https://www.sanfoundry.com/...
Answer: d
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.
Answer: a
Explanation: The exit function should be used to terminate
the program. The function is passed with an argument. The
argument indicated the type of error occurred.
5 of 7 3/19/18, 10:29 AM
Inbuilt Classes - Object Oriented Programming... about:reader?url=https://www.sanfoundry.com/...
b) System
c) Final
d) SystemFinal
View Answer
Answer: b
Explanation: The runFinalization() Function is defined in the
System class. The function is used to finalize an object
which undergo destruction. The action is required to
terminate the object properly.
Answer: a
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.
Answer: d
Explanation: Put is not a System class variable. The most
6 of 7 3/19/18, 10:29 AM
Inbuilt Classes - Object Oriented Programming... about:reader?url=https://www.sanfoundry.com/...
general and basic variables are err, out and in. The
variables can handle most of the tasks performed in a
program.
Answer: c
Explanation: The package java.util contains all the utility
classes. This package also contains generic data
structures, date, time etc. These can be used in any java
program, you just have to include java.util package.
7 of 7 3/19/18, 10:29 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
sanfoundry.com
Answer: c
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 flexibility to make the
programs more user friendly.
1 of 7 3/19/18, 10:30 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
a) Data streams
b) Serialization
c) File system
d) Data streams, serialization and file system
View Answer
Answer: d
Explanation: The IO classes are made such that those can
support the input and output from any type of source or
destination. The input can be taken from system file and
standard input and also some special devices if conned.
Same is case to show the output.
Answer: a
Explanation: The Console class contains the methods to
access the character based devices. The devices which can
stream the data as character set. All those devices can be
made use of by using the methods of class Console.
2 of 7 3/19/18, 10:30 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
Answer: c
Explanation: The File class is made to operate with the files.
The file can be of any type. All the input and output
operations that have to be performed on a file can be done
using File class object.
5. 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 structure
View Answer
Answer: a
Explanation: The machine specific structure of an open file
have to be handled in some special ways. FileDescriptor
class can handle those files. The FileDescriptor can also
handle open socket, another source, sink of bytes.
6. 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 only
View Answer
Answer: d
Explanation: The most specific answer is that the
FileInputStream can only be used for the opened files. The
class can work only for the file type. No socket or another
3 of 7 3/19/18, 10:30 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
Answer: d
Explanation: The FilePermission can’t get access to the
device access permissions. The Permission is given to a file
when it is created or otherwise when a privileged user
changes it. Then these permission rights can be accessed
using the FilePermission class.
Answer: a
Explanation: The LineNumberInputStream class makes
false assumptions. The false assumption is that it assumes,
all the byte data is a character. Which is actually not the
case, instead the character have one byte memory space.
4 of 7 3/19/18, 10:30 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
Answer: b
Explanation: The Reader class is an abstract class which
can be used to read characters stream. It can’t be used for
any kind of input. It can just read the existing data.
Answer: c
Explanation: The only class which handles the IO class
interrupts is InteruptedIOException class. This class is
specially provided to handle any case that involves the
execution interrupt.
Answer: d
Explanation: The StringReader can only work with the string
type data. Even if a character array is given, it might
5 of 7 3/19/18, 10:30 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
Answer: b
Explanation: The encoding that is unsupported in a system
can be handled. The exception handler is
UnSupportedEncodingException class. An object of this
class can be created which will catch the exception and
handle it.
Answer: a
Explanation: The PushBackReader allows the character
streams handling. The main feature is that the stream can
be pushed back to the stream. This is used in special cases
of handling input stream.
6 of 7 3/19/18, 10:30 AM
IO Class - Object Oriented Programming Questi... about:reader?url=https://www.sanfoundry.com/...
Answer: c
Explanation: The RandomAccessFile class instance can be
created to handle input and output operations to a random
access file. It first checks the permissions on the file and
then any required operation can be done on a random
access file. Comparatively faster than other files access.
Answer: b
Explanation: The ObjectStreamClass object can be created
to handle serializations. The class is provided specially for
the serializations. It is descriptor like we have a file
descriptor to handle/access files.
7 of 7 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
sanfoundry.com
Answer: a
Explanation: The object of string class are mostly
immutable. This means that the String objects are constant.
These can’t be changed once created.
1 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
Answer: a
Explanation: The class name String is given. And then the
object name is mentioned. There are two ways to declare
and initialize the string. Either by giving direct string value or
by using new keyword. But if new operator is used,
constructor of String class have to be called. From the
given options, the direct string value declaration is correct.
Answer: b
Explanation: The length function returns the length of string.
The length is the number of characters in the string but the
last null character is not counted. The string length can be
used to loop through each character in the string.
Answer: a
2 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
Answer: c
Explanation: The substring function returns a string value.
The string is the substring starting from the specified index
till the end. The substring function have to be called with the
object of string class.
3 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
Answer: d
Explanation: A value of string type is returned from this
function. The returned string is a substring that starts from
the first argument position, till the second index position.
The indices must be less than the length of actual string.
Answer: c
Explanation: 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.
Answer: a
Explanation: The function is used to get the last occurrence
4 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
Answer: b
Explanation: Both the functions return Boolean value. The
function equal() is case sensitive and returns false even if a
single character is case different in two strings. The other
function ignores the case sensitivity and only checks if the
spellings are same.
Answer: c
Explanation: The source and target must be objects of the
string class. The compare is always case sensitive. To
compare two string objects without case sensitivity then we
5 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
Answer: c
Explanation: The function is used to convert each character
of the string. If the character is already upper case then it
remains the same. But if some character is in lower case
then it will be converted to upper case.
Answer: d
Explanation: The function is used to remove any white
space from both the ends of a given string. The white space
include space, tab, next line etc. It will be removed both
from the starting of string and from end of string.
6 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
c) 3
d) 4
View Answer
Answer: b
Explanation: The first argument is the target character. This
target character will be replaced by another character. The
new character is the second argument to the function. Only
the characters can be passed as argument, not a string.
Answer: a
Explanation: The string may have more than one
occurrence of a character. We use this function to get the
index at which the specified number of times a specific
character has occurred in a string. For example, we can get
the index of 5th occurrence of character “j” in a string.
15. The string class deals with string of only character type.
a) True
b) False
7 of 8 3/19/18, 10:30 AM
String Class - Object Oriented Programming Qu... about:reader?url=https://www.sanfoundry.com/...
View Answer
Answer: a
Explanation: The string class objects can be used for any
string consisting of characters. The characters include
numbers, alphabets and few special characters. String
class is not necessary to be used but provides a huge set of
inbuilt functions to make the string operations easier.
8 of 8 3/19/18, 10:30 AM