COMPUTER FUNDAMENTALS

COMPUTER SOFTWARE

PROGRAMMING LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following is NOT the name of a primitive data type?
A
Integer
B
Float
C
Decimal
D
String
Explanation: 

Detailed explanation-1: -Primitive data types-includes byte, short, int, long, float, double, boolean and char. Non-primitive data types-such as String, Arrays and Classes (you will learn more about these in a later chapter)

Detailed explanation-2: -Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc.

Detailed explanation-3: -Non-Primitive data types are classified as Array, Class, String, and Interface. Arrays in Java are used to store elements of the same data type in a contiguous manner.

Detailed explanation-4: -String is non-primitive because only class can have methods. Primitive can not. And String need many functions to be called upon while processing like substring, indexof, equals, touppercase. It would not have been possible without making it class.

Detailed explanation-5: -The four primitive data structures are integers, float, string, and boolean. Non-primitive Data Structures – These data structures store values, as well as a collection of values, in varying formats. The four built-in non-primitive data structures are lists, tuples, dictionaries, and sets.

There is 1 question to complete.