Understand Computer Storage and Data Types


Apprentice Developer

Which of the following data types would be the best choice for keeping track of peoples ages using the least amount of memory?
* Short
* Byte
* Int

Answer: A byte would be the best choice here as it uses the least amount of memory and a byte goes upto 255 which is more than enough for peoples ages.

Some data is stored on the heap while other data is stored on the stack, which of the following will be stored on the heap?
* Name
* Height
* Age

Answer: The answer is a name (string), remember strings aren’t value types. The variable itself (the reference to the string) will be stored on the stack, while the actual data in the char[] will be stored on the heap.

It would make sense to store one of these variables as a char, which one? *Name * Weight * Gender

Answer:…

View original post 364 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s