250+ TOP MCQs on Inbuilt Classes and Answers

Object Oriented Programming (OOPs) Multiple Choice Questions & Answers (MCQs) on “Inbuilt Classes”.

1. 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 user
Answer: a
Clarification: 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.

2. 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 always
Answer: a
Clarification: The inbuilt classes must be included in the program. Whenever some functions are used, they must have a declaration before use. The same is the case with classes.

3. What doesn’t inbuilt classes contain?
a) Function prototype
b) Function declaration
c) Function definitions
d) Objects
Answer: c
Clarification: 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.

4. Which among the following not an inbuilt class in C++?
a) System
b) Color
c) String
d) Functions
Answer: d
Clarification: 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.

5. 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 file
Answer: a
Clarification: 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.

6. 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 values
Answer: c
Clarification: The Array class is associated with all the other classes. This gives us the flexibility to declare an array of any type. The index goes from 0 to n, where n is some fixed size for array.

7. 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 calculations
Answer: b
Clarification: 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.

8. DataInputStream is derived from ______________________
a) StreamingInput
b) StreamedInput
c) StreameInput
d) StreamInput
Answer: d
Clarification: 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.

9. 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_name
Answer: c
Clarification: The array name is given of which the length have to be calculated. The array length is stored in the attribute length. Hence we access it using dot operator.

10. Number class can’t manipulate ____________________
a) Integer values
b) Float values
c) Byte values
d) Character values
Answer: d
Clarification: 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.

11. 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();
Answer: a
Clarification: 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.

12. Which class contain runFinalization() method?
a) Finalize
b) System
c) Final
d) SystemFinal
Answer: b
Clarification: 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.

13. 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 calculations
Answer: a
Clarification: 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.

14. Which is not a System class variable?
a) err
b) out
c) in
d) put
Answer: d
Clarification: Put is not a System class variable. The most general and basic variables are err, out and in. The variables can handle most of the tasks performed in a program.

15. Which package contains the utility classes?
a) java.lang
b) java.utility
c) java.util
d) java.io
Answer: c
Clarification: 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.

Leave a Reply

Your email address will not be published. Required fields are marked *