Computer Science, asked by snehashissensen17, 1 year ago

What are differences between a primitive data type and a composite data type


tia206: plz mark me brainest

Answers

Answered by nain31
2
ANSWER..


PRIMITIVE DATA TYPES ARE ALREADY PRESENT IN THE SYSTEM MEMORY LOCOTATION AND HAS FIXED VALUES.
EX.. int, long,float,double,short,boolean.

COMPOSITIVE DATA TYPES ARE THE ONES MADE BY USER WITH THE HELP OF PRIMITIVE DATA TYPES.
EX. array, Class.

HOPE IT HELPS
Answered by tia206
1
Primitive Data & Composite Data.

So far we've been working mostly with numbers and strings, which are the most common primitivedatatypes. Primitive datatypes are the basic units of a language; each primitive value contains a single datum (as opposed to an array of multiple items) and describes that datum literally. Primitive data is very straightfor ward.
ActionScript supports these primitive datatypes: number, string, boolean, undefined, and null. ActionScript does not have a separate single-character datatype (i.e., char) as found in C/C++.

Primitive datatypes are, as their name suggests, simple. They can hold text messages, frame numbers, movie clip size values, and so on, but they don't readily accommodate higher levels of complexity. For more elaborate data handling -- such as simulating the physics of a dozen bouncing balls or managing a quiz with 500 questions and answers -- we turn to composite datatypes. Using composite data, we can manage multiple pieces of related data as a single datum.

ActionScript supports the following composite datatypes: array, object, and movieclip. Functions are technically a type of object and are therefore considered composite data, but we rarely manipulate them as such.

Whereas a single number is a primitive datum, a list (i.e., an array) of multiple numbers is a compositedatum. Here's a practical example of how composite datatypes are useful: Suppose we wanted to track the profile of a customer named Derek. We could create a series of variables that store Derek's attributes as primitive values, like this:

var custName = "Derek"; var custTitle = "Coding Genius"; var custAge = 30; var custPhone = "416-222-3333";

However, this format gets pretty cumbersome once we add even a few more customers. We're forced to use sequentially named variables to keep track of everything.
-- cust1Name,cust2Name, cust1Title, cust2Title, and so on. Yuck! But if we use an array, we can store our information much more efficiently:

cust1 = ["Derek", "Coding Genius", 30, "416-222-3333"];

When we want to add more customers we just create new arrays:

cust2 = ["Komlos", "Comic Artist", 28, "515-515-3333"]; cust3 = ["Porter", "Chef", 51, "515-999-3333"];

plz mark me as brainest if my answer is helpful for you.
Similar questions