Compare and Contrast Fundamental Data Types and Their Characteristics

By

Date: Aug 25, 2019

Return to the article

In this sample chapter from CompTIA IT Fundamentals+ FC0-U61 Cert Guide, you will learn how to compare and contrast fundamental data types and their characteristics: char, strings, numbers (integers and floats), and Boolean.

Whether you’re programming, crunching numbers with spreadsheets, or figuring out binary logic, understanding the fundamental data types used by Information Technology is foundational. In this chapter, you learn about IT Fundamentals+ Objective 1.2: Compare and contrast fundamental data types and their characteristics: char, strings, numbers (integers and floats), and Boolean.

Foundation Topics

 

Char

Char is an abbreviation for character. Many programming languages use char as a reserved keyword, including Visual Basic, SQL, Java, C languages, and others. Char is a data type that refers to a single character or a single-character variable. For example, each of the following is a char data type:

A char is equal to 1 byte.

Strings

A string is a series of characters that is interpreted literally by a script, such as “Abraham Lincoln” or “THX1138.” Computer programs usually connect a string to a variable. For example:

$string = "This is a string"
Print "The value of $string is " $string
Output:
The value of $string is This is a string

In this example, the variable $string is assigned the value "This is a string". Then, the second line prints “The value of $string is This is a string” when the script is run.

The amount of space set aside for a string can be variable (enabling strings of various lengths) or fixed. If a string has a length of 11 characters, but you attempt to enter more than 11 characters, the last characters will be left off. This is called truncation. Figure 3-1 illustrates an example of this problem.

Figure 3-1 Example of a Truncation

When data entry systems are designed to use fixed-size strings, watch out for truncation like this example. Data entry designers need to take into account both typical and larger examples of proper names or other data when sizing data entry fields.

Numbers

The common data types used for numbers include the following:

Integers

An integer (also known as int) is a positive or negative whole number (a number with no decimal points or fractions). For example, the following are positive integers: 3, 4096, and 65535. The following are negative integers (–2, –64, and –98765). What about 0? It’s also an integer.

The INT function in most programming languages drops the decimal or fractional value of a number such as 3.6 and leaves only the whole value (in this case, 3). This can be useful to obtain a whole number value after randomizing a range of numbers. The following example is written in Perl:

my $randnum = int(rand(100));
# int(rand(100)) discards decimal portion of randomized number
print "Here's a random number between 0 and 100: $randnum\n";

Floats

A float (also known as floating-point number) is a number that contains up to seven digits and has at least one decimal place. For example, the following are floats:

A float is a single-precision, floating-point, 32-bit value.

Floats can also be expressed using powers of ten or powers of two. This way, a fixed number of digits can be used to express a very wide range of numeric values. Here are some examples:

Singe-precision and double-precision floating point numbers are actually approximations of the true value of a number because of the rounding that takes place when non-integer numbers are used. The floating-point calculator at https://www.exploringbinary.com/floating-point-converter/ demonstrates this fact.

Boolean

Boolean values are used in Boolean logic, which evaluates whether a given condition is true (1) or false (0). These values are binary. In computers and other electronic devices, Boolean logic is used to determine if a circuit is charged or on (1) or not charged or off (0). Boolean logic can be used for searches. Boolean logic includes the following comparisons: AND, OR, NOT, and XOR, among others.

AND, OR, NOT, and XOR are used to compare two values.

Boolean logic is often used in performing searches online and elsewhere. Here are the results of a search of a local library’s book and media holdings:

Boolean algebra applies Boolean logic to solve equations, such as the following:

Boolean logic can be visualized using Venn diagrams. Figure 3-2 illustrates how a Venn diagram can be used to show the product lines of three major component manufacturers: Intel, AMD, and NVIDIA.

Figure 3-2 An Example of a Venn Diagram

The Venn diagram in this figure shows that Intel makes SSDs, whereas AMD does not make SSDs. Both Intel and AMD make motherboard chipsets and CPUs. Both AMD and NVIDIA make graphics processors (GPUs). NVIDIA does not make SSDs, chipsets, or CPUs. Intel does not make GPUs.

Exam Preparation Topics

 

Review Topics

Review the most important topics in this chapter, noted with the Key Topics icon in the outer margin of the page. Table 3-1 lists these key topics and the page number on which each is found.

Table 3-1 Key Topics for Chapter 3

Key Topic Element

Description

Page Number

Paragraph

Strings

27

Figure 3-1

Example of a Truncation

28

Paragraph

Integers

29

Paragraph

Floats

29

Paragraph

Booleans

30

Define Key Terms

Define the following key terms from this chapter and check your answers in the glossary:

Practice Questions for Objective 1.2

  1. The values 47.67, 8.21, and .7352 are examples of which of the following?

    1. Floats

    2. Integers

    3. Boolean

    4. strings

  2. Which of the following is true about a float?

    1. A float is a 64-bit, single-precision data type.

    2. It has at least seven digits.

    3. It has at least one decimal point.

    4. It cannot be expressed using powers of two.

  3. When multiplying a number that is greater than zero (0) by a negative exponent, which of the following is correct about the result?

    1. The result is a negative number.

    2. The number of decimals equals the number in the exponent.

    3. The result is a positive number.

    4. The digits in the original value are never present in the answer.

  4. You are creating a Boolean search that is looking for information that matches both of your search terms. Which of the following do you use between the terms?

    1. AND

    2. LIKE

    3. OR

    4. NOT

  5. Which of the following equations is correct?

    1. IF x=4 OR y=4, then x<>4

    2. IF x=0 AND y<0, then x>y

    3. IF a≠b OR b≠c, then a=c

    4. IF NOT a=b, then b=c

  6. Which of the following is true about the char data type?

    1. It can only be used for calculation.

    2. It can represent a variable.

    3. It cannot be used for calculation.

    4. It can occupy more than one byte.

  7. You are attempting to enter the phrase “wide world of sports” into a data entry field that can only accept 12 characters. Which of the following is what you will see when you enter this text?

    1. wide world o

    2. ld of sports

    3. wide sports

    4. de world of

  8. Which of the following is an int?

    1. Lincoln

    2. 3.14159

    3. 84

    4. 4/3

  9. Which of the following orders would you use at the Boolean Hamburger stand if you want to get a burger with pickle and ketchup but no mustard or onions?

    1. Burger AND pickle AND ketchup OR mustard OR onions

    2. Burger AND pickle NOT ketchup OR mustard OR onions

    3. Burger AND mustard OR onions NOT ketchup OR pickle

    4. Burger AND ketchup AND pickle NOT mustard NOT onions

  10. You are specifying a data entry system that needs to have enough room for a user to enter a phone number, including area code. The data entry app will automatically put in the parentheses and dashes as needed. Which of the following specifications will allow correct telephone number data entry?

    1. Ten alphanumeric characters

    2. Fourteen numeric characters

    3. Eleven numeric characters

    4. Twelve alphanumeric characters

  11. Which data type refers to a single character or a single-character variable?

    1. Strings

    2. Numbers

    3. Char

    4. Boolean

  12. Which type of logic is used to determine if a circuit is charged or on (1) or not charged or off (0)?

    1. Integers

    2. Strings

    3. Floats

    4. Boolean

  13. Which of the following can be expressed using powers of ten or powers of two?

    1. Boolean

    2. Floats

    3. Strings

    4. Char

  14. If a string has a length of 11 characters and you attempt to enter more than 11 characters, the last characters will be left off. What is this called?

    1. Truncation

    2. Boolean logic

    3. Char overflow

    4. Floating-point

  15. What are numbers with floating-point decimals that contain more than seven digits and up to 15 digits total known as?

    1. Logic gate

    2. 64-bit single precision

    3. Double or double-precision

    4. Boolean algebra

Your Next Steps (More Certs)

If data types excite you, you might be on the road to being a programmer or database designer. Along the way, you might want to pick up the CompTIA A+, Network+, and Security+ certifications. Specific certifications in the database arena are available from IBM, Microsoft SQL, Oracle, and SAP.

800 East 96th Street, Indianapolis, Indiana 46240

vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |