4.Identify fundamental data types and their characteristics Flashcards
Char
A variable that stores a single character, which could be a digit, letter, or symbol. Examples include ‘7’, ‘X’, and ‘#’.
String
A sequence of characters, like words or sentences. Examples include “Hello World,” “3.14,” and “555-1212.”
Integers or int
Whole numbers like -7, 23, or 65536. An integer data type uses 1 to 8 bytes of computer storage. They don’t have a fraction or decimal place.
Floating-point numbers
: Numbers that can have decimal fractions, like 4.1, 26.4, or 5.62. A floating-point number (or just “float”) uses between 4 and 8 bytes of storage. A float can also store whole numbers (like 4.0). You use a float when you need more precision.
Fixed-point
Real numbers with a specific number of digits after the decimal point. They are common in financial calculations where accuracy is important, like $9.95.
Double
Similar to a float, but a double variable can store larger and more precise float numbers.
Boolean
Boolean operations follow a format similar to binary numbers, a system of one of two states. Their 1 or 0, however, represents either True or False.
And
If both conditions are TRUE, the whole statement is considered TRUE.
OR
If either condition is TRUE, the whole statement is also considered TRUE.
XOR
If one condition is TRUE and the other condition is FALSE, the whole statement is considered TRUE. If both conditions are TRUE, the whole statement is considered FALSE. In other words, if the conditions are different from each other, this Boolean operator sees the statement as correct. If the conditions are the same (either TRUE-TRUE or FALSE-FALSE), then the statement is incorrect.
NOT
The whole statement is not TRUE.
&& (Logical AND)
If both conditions are TRUE, the whole statement is TRUE.
|| (Logical OR
If either condition is TRUE, the whole statement is TRUE.
^ (Logical XOR)
If one condition is TRUE and the other condition is FALSE, the whole statement is considered TRUE. If both conditions are TRUE, the whole statement is considered FALSE.
! (Logical NOT
The whole statement is not TRUE.