This set of Object Oriented System Design Multiple Choice Questions & Answers (MCQs) focuses on “Data Types”.
1. Which of the following data types are available in Java?
a) Primitive Datatypes
b) Reference Datatypes
d) None of the mentioned
Explanation: Primitive Datatypes are defined by Java. Reference Datatypes are user defined, created using defined constructors of class.
2. How many Primitive data types are there in Java?
Explanation: Java defines eight simple types of data which are put in four groups. They are integers, floating-point numbers, boolean, characters.
3. Which of the following data types comes under ‘Integer’ data type?
d) all of the mentioned
4. Which of the following data types comes under ‘Floating’ data type?
d) a and c
Explanation: Only ‘float’ and ‘double’ belong to floating-point numbers. ‘byte’ comes under ‘Integer’ data type.
5. Which of the following is not a primitive data type?
Explanation: An ‘enum’ data type is special data type that enables a variable to store set of predefined constants.
6. Which of following cannot be stored in character data type?
a) Special symbols
Explanation: String is a collection of characters and is stored in a variable of string data type.
7. Which of the following is smallest integer data type?
Explanation: ‘byte’ is signed 8-bit smallest integer data type that has range from -128 to 127.
8. Which of the following keyword is used to declare Byte data type?
9. Which of the following data type is used to create a number for counting or indexing arrays?
10. Which of the following data type stores longest floating-point value?
Explanation: ‘double’ is the longest data type with 64-bit defined by Java to store floating-point values.
Sanfoundry Global Education & Learning Series – Object Oriented System Design.