Object Oriented System Design Questions and Answers – Data types

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

Answer: b
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

Answer: c
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

Answer: d
Explanation: None.

4. Which of the following data types comes under ‘Floating’ data type?
a) float
b) byte
c) double
d) a and c

Answer: d
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

Answer: a
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

Answer: b
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

Answer: c
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

Answer: d
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

Answer: c
Explanation: None.

10. Which of the following data type stores longest floating-point value?
a) boolean
b) double
c) float
d) long

Answer: b
Explanation: ‘double’ is the longest data type with 64-bit defined by Java to store floating-point values.

Leave a Comment