Data Types | CompTIA IT Fundamentals FC0-U61 | 1.2

In this video you will learn about various data types and their characteristics such as Char, Strings, Numbers & Boolean Logic.


The abbreviation char is used as a reserved keyword in some programming languages, such as C, C++, C#, and Java. It is short for character, which is a data type that holds one character (letter, number, etc) of data. The value of a char variable could be any one-character value, such as ‘1’, ‘2’, ‘A’, ‘Z’, ‘x’, ‘#’, ‘!’ and so on. A char is equal to 1 byte.


A string is a data type used in programming to represent text rather than numbers.  It is comprised of a set of characters that can also contain spaces and numbers. For example, “I Love Computers” or “HAPPY123”.  Typically, computer programmers must enclose strings within quotation marks for the data to be recognized as a string and not a variable name or number.  Strings are also used to execute scripts that connect a string to a variable, such as:

$string = “I love computers.”
Print “What do you love?” $string
What do you love? I love computers.

Strings can also have variable or fixed lengths.  For instance, if a string has a length of 10 characters, but you attempt to enter more than 10 characters, all characters after the 10th character will be left off.  This is called truncation.

Example of a Truncation

Data entry designers need to take into account both typical and larger examples of proper names or other data when sizing data entry fields.


The most common data types used for numbers are called integers & floats.


An integer is a positive or negative whole number with no decimal points or fractions.  Examples of integers are 1, 2, 3, 50, 100, 200, 1000 and so on. Examples of negative integers are -1, -2, -3, -50, -100, -200 and so on.  The number 0 is also considered an integer even though it has neither a positive or negative value. In most programming languages, you can convert a number into an integer using the int function.  As a result, the programming language will drop any decimal or fractional value of a number such as 4.5 and leave only the whole value (4).  This can be useful when seeking to obtain a whole number value after randomizing a range of numbers. Here’s an example written in the programming language Perl:

my $random = int(rand(50));
# int(rand(50))
print “Random number between 0 and 50: $random\n”;

Essentially, this script will generate a random number between 0 and 50 once executed.


A float (also known as floating-point number) is a number that contains up to seven digits and has at least one decimal place.  A float represents real numbers and is written with a decimal point dividing the integer and fractional parts.

Examples of floats:

  • 3.14
  • .012345
  • 5.9
  • .404

The float variable is often used to include currency values in a computer language.  Programmers can designate the number of placeholders after the decimal by using additional commands on a float variable.  In general, floats use the same operators as integers in similar ways. The addition, subtraction, multiplication and division of these variables is fairly straightforward in most cases.

Floats can also be expressed using powers of ten or powers of two.  Here are some examples:

  • 65.5 x 10^5 = 6,550,000
  • 65.5 x 10^-5 = 0.000655
  • 51.12 x 2^12 = 51,120,000,000,000
  • 51.12 x 2^-12 = 0.00000000005112


In computer science, a boolean values or bool is a data type that has two possible values:  true (1) or false (0). Boolean logic is named after the English mathematician George Boole, whose algebraic and logical systems are used in all modern digital computers.  Boolean values are binary. Boolean logic is used to determine if a circuit is charged or on (1) or not charged or off (0). Boolean logic can also be used for searches using the following comparisons:  AND, OR, NOT, and XOR, among others.

  • AND:  if both values 1 and 2 exist in a statement, the statement is TRUE. If only value 1 or value 2 exists in a statement, the statement is FALSE.
  • OR:  if either value 1 or 2 exists in a statement, the statement is TRUE.
  • NOT:  if neither value 1 nor 2 exists in a statement, the statement is TRUE.  If either or both exist, the statement is FALSE.
  • XOR:  if either value 1 or value 2 exists in a statement, that statement is TRUE.  If both exist, or if neither exists, the statement is FALSE.

Boolean logic can be used for performing searches online and elsewhere.  If you’ve ever had to log into a college’s online library database to perform a search, you can apply Boolean logic to help expedite your search results.  Here’s an example:

  • If you typed in a library database looking for toys, you might produce 244 results.
  • If you typed in the database looking for cars, you might produce 300 results.
  • If you typed in the database looking for toys AND cars, you might produce 10 results.
  • If you typed in the database looking for toys OR cars, you might produce 400 results.
  • If you typed in the database looking for toys NOT cars, you might produce 200 results.

Boolean logic can also be applied to algebraic equations, such as the following:

If x=1 AND y=1: x AND y=1
If x=1 OR y=0: x OR y=1
x=0: NOT x=1

Boolean logic can also be visualized using Venn diagrams

This Venn diagram shows that Burger King & Taco Bell both make fast food, whereas Burger King does not make Tacos but hamburgers as Taco bell does not make burgers, but tacos.