Core Programming Flashcards
int
4 bytes / 32 bits
can store whole numbers only
from -2,147,483,648 to 2,147,483,647.
It is the preferred data type when we create variables with a numeric value.
long
8 bytes / 64 bits
can only store whole numbers
from
-9(Quintillion),223(Quadrillion),372(Trillion),036(Billion),854,775,808 to 9223372036854775807.
This is used when int is not large enough to store the value. Note that you should end the value with an “L”:
float
signed 4 bytes / 32 bits
Stores fractional numbers.
Sufficient for storing 6 to 7 decimal digits
The float data type can store fractional numbers from 3.4e−038 to 3.4e+038. Note that you should end the value with an “F”:
double
signed 8 bytes / 64 bits
Stores fractional numbers.
Sufficient for storing 15 decimal digits
bool
1 bit Stores true or false values
char
2 bytes / 16 bits
Stores a single character/letter, surrounded by single quotes
string
2 bytes / 16 bits per character Stores a sequence of characters, surrounded by double quotes
decimal
signed 16 bytes / 128 bits
Stores a fractional number
up to 28-29 digits
Should end in M - decimal price = 1.50M;
To minimize the amount of storage used on the hard drive by an application that generates many small files, you should make the ______ as small as possible.
a - partition
b - file allocation table
c - block size
d - folder and file names
block size
byte
unsigned 8 BIT / 1 byte
0 to 255
Define Integer type (Integral)
Numbers that are whole numbers without decimal points. It can be negative or positive numbers.
Define Floating-point type
Floating-point type is numbers with one or more decimal points. It can be negative or positive numbers.
sbyte
signed 8 BIT / 1 byte
-128 to 127
short
It occupies 2 bytes / 16-bit memory.
The short data type is a signed integer that can store numbers from -32,768 to 32,767.
Signed vs unsigned values
signed means specified as positive or negative, unsigned means positive by default