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
c) Both
d) None of the mentioned
View Answer
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?
a) 4
b) 2
c) 8
d) 7
View Answer
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?
a) short
b) long
c) int
d) all of the mentioned
View Answer
Explanation: None.
4. Which of the following data types comes under ‘Floating’ data type?
a) float
b) byte
c) double
d) a and c
View Answer
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?
a) enum
b) short
c) byte
d) char
View Answer
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
b) String
c) Letter
d) Digit
View Answer
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?
a) short
b) long
c) byte
d) double
View Answer
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?
a) Bytes
b) Byte
c) bytes
d) byte
View Answer
Explanation: None.
9. Which of the following data type is used to create a number for counting or indexing arrays?
a) byte
b) long
c) int
d) float
View Answer
Explanation: None.
10. Which of the following data type stores longest floating-point value?
a) boolean
b) double
c) float
d) long
View Answer
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.
Here’s the list of Best Books in Object Oriented System Design.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]