This set of Object Oriented Programming (OOPs) Multiple Choice Questions & Answers (MCQs) focuses on “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
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.
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
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.
3. What doesn’t inbuilt classes contain?
a) Function prototype
b) Function declaration
c) Function definitions
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.
4. Which among the following not an inbuilt class in C++?
Explanation: 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 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
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.
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
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.
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
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.
8. DataInputStream is derived from ______________________
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.
9. Which attribute can be used to get the size of an array?
Explanation: 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
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.
11. Which function should be used to exit from the program that is provided by System class?
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.
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.
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
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.
14. Which is not a System class variable?
Explanation: 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?
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.
Sanfoundry Global Education & Learning Series – Object Oriented Programming (OOPs).
To practice all areas of Object Oriented Programming (OOPs), here is complete set of 1000+ Multiple Choice Questions and Answers.