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
View Answer

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
View Answer

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
View Answer

Answer: d
Explanation: None.

advertisement
advertisement

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

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
View Answer

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
View Answer

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
View Answer

Answer: c
Explanation: ‘byte’ is signed 8-bit smallest integer data type that has range from -128 to 127.
advertisement

8. Which of the following keyword is used to declare Byte data type?
a) Bytes
b) Byte
c) bytes
d) byte
View Answer

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
View Answer

Answer: c
Explanation: None.
advertisement

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

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

To practice all areas of Objection Oriented System Design, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.