CS: 1.4 Data Types, Data Structures and Algorithms

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/244

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

245 Terms

1
New cards

Describe the importance of using the right data type when writing a program.

Using the right data type ensures that the correct operations can be performed on the data.

2
New cards

Define an integer data type.

An integer is a whole number that includes zero and negative numbers but cannot have a fractional part.

3
New cards

Describe the Boolean data type.

Named after mathematician George Boole, Booleans can only have values of True or False, making them useful for data that can only take two values.

4
New cards

Define a bit and a byte in computing.

A bit is a single binary digit, while a byte consists of eight binary digits.

5
New cards

How do computers count in binary?

Computers count in base 2, where each place represents a value of two times the previous place.

6
New cards

Do you know what a nybble is in computing?

Half a byte, which consists of four bits, is called a nybble.

7
New cards

Describe the concept of least significant bit and most significant bit in binary numbers.

The least significant bit is the rightmost bit, while the most significant bit is the leftmost bit in a binary number.

8
New cards

How can you convert a binary number to decimal?

Multiply each digit by its place value and sum the results to get the decimal equivalent.

9
New cards

Define the term 'Boolean' in computing.

Boolean, named after George Boole, is a data type with values limited to True and False.

10
New cards

What is the significance of the least significant bit in binary representation?

The least significant bit represents the smallest place value in a binary number, always equal to 1.

11
New cards

How is a byte related to a nybble in computing?

A byte consists of eight bits, while a nybble is half a byte, containing four bits.

12
New cards

Describe the importance of Booleans in programming.

Booleans are crucial for representing binary logic and conditions in programming, as they can only have values of True or False.

13
New cards

Describe the process of converting a decimal number to binary.

Find the largest power of two smaller than the number, write out place values in powers of two, place a 1 or 0 in each position to add up to the number.

14
New cards

Do you write a 1 or 0 in each position when converting a decimal to binary?

Write a 1 if the place value is less than or equal to the value, and a 0 otherwise.

15
New cards

Define the term 'most significant bit' in binary conversion.

It is the bit representing the largest place value in the binary number.

16
New cards

How do you determine the value to write in each position when converting to binary?

By checking if the place value is less than or equal to the remaining value.

17
New cards

Describe what happens when the bit value is greater than the remaining value in binary conversion.

A 0 is placed in that position, and the remaining value stays the same for the next step.

18
New cards

Describe the process of converting the binary number 101111 to decimal.

Starting from the right, each bit value is multiplied by 2 raised to the corresponding power, then summed up to get the decimal equivalent, which in this case is 47.

19
New cards

Define the term 'whole number of bytes' in the context of binary representation.

It refers to a binary number that is a multiple of eight bits, often padded with leading zeros to fill a byte.

20
New cards

How is the decimal number 47 represented as a byte in binary?

To represent 47 as a byte, it is written as 00101111, with two leading zeros added to make it a full 8-bit binary number.

21
New cards

Do you add leading zeros when representing a binary number as a byte? Why?

Yes, leading zeros are added to make the binary number a full byte (8 bits) for standardization, without altering the value of the number.

22
New cards

Describe the rules for binary addition.

The rules are: 0 + 0 + 0 = 0, 0 + 0 + 1 = 1, 0 + 1 + 1 = 10, and 1 + 1 + 1 = 11, which are used when adding binary numbers.

23
New cards

Describe the process of adding binary numbers as per the given example.

Place the binary numbers above each other, aligning digits. Add column by column, applying specific rules for each case. Carry over if the result is more than one digit.

24
New cards

What is the result of adding the binary numbers 1011 and 1110 as shown in the example?

The result is 11001.

25
New cards

How can you verify the accuracy of your binary addition result according to the content?

You can check your answer by converting the binary result to decimal.

26
New cards

Define the term 'least significant bit' in the context of binary addition.

The least significant bit is the rightmost bit in a binary number, representing the lowest place value.

27
New cards

Do you need to follow specific rules when adding binary numbers column by column?

Yes, specific rules apply for different scenarios, such as carrying over if the result exceeds one digit.

28
New cards

Describe how negative numbers are represented in binary using sign magnitude method.

In sign magnitude representation, a leading 1 is added for negative numbers and a leading 0 for positive numbers in binary.

29
New cards

Do a conversion from sign magnitude binary to decimal for the number 101101001.

The sign magnitude number 101101001 is negative. Removing the leading 1 leaves 01101001, which is 105 in decimal. Adding the minus sign results in -105.

30
New cards

Define two's complement method for representing negative numbers in binary.

Two's complement involves making the most significant bit negative by flipping all bits in the positive binary number and adding one.

31
New cards

How does two's complement simplify binary arithmetic with negative numbers?

Two's complement simplifies binary arithmetic by making addition and subtraction of negative numbers straightforward through bit manipulation.

32
New cards

Describe the process of converting a binary number to two's complement.

To convert to two's complement, flip all bits in the positive binary number and add one to obtain the equivalent negative representation.

33
New cards

Describe how to calculate the decimal equivalent of a binary number using the given bit values.

To calculate the decimal equivalent, multiply each bit value by its corresponding power of 2 and sum the results.

34
New cards

Define Two's Complement in binary subtraction.

Two's Complement simplifies binary subtraction by treating it as adding a negative number.

35
New cards

How does Two's Complement make binary subtraction easier?

It allows subtraction to be performed by adding a negative number, simplifying the process.

36
New cards

Do a binary subtraction example using Two's Complement: Subtract 12 from 8.

-16 + 8 + 4 + 2 = -4, showing how the calculation is correct.

37
New cards

Describe the process of adding two numbers in Two's Complement.

Add the two numbers using the same technique for adding binary numbers, then read off the result as the final answer.

38
New cards

Describe hexadecimal in terms of its base and character usage.

Hexadecimal is a base 16 number system that uses the numbers 0-9 and the characters A-F to represent 10-15.

39
New cards

Define the place values in hexadecimal.

Place values in hexadecimal start with 1 (16^0) and increase in powers of 16.

40
New cards

How is the hexadecimal number 4E7F converted to decimal?

By multiplying each digit by its corresponding place value in powers of 16 and summing the results.

41
New cards

Do you remember the decimal equivalents of E and F in hexadecimal?

E represents 14 and F represents 15 in decimal.

42
New cards

Describe the process of converting a hexadecimal number to decimal.

Multiply each digit by the corresponding power of 16 and sum the results to obtain the decimal equivalent.

43
New cards

Describe the process of converting from hexadecimal to binary.

Convert each hexadecimal digit to a decimal digit, then to a binary nybble, and combine the nybbles to form a single binary number.

44
New cards

Do you convert hexadecimal digit 'B' to binary?

Yes, 'B' is converted to '1011' in binary.

45
New cards

Define a binary nybble.

A binary nybble is a group of 4 binary digits.

46
New cards

How do you combine binary nybbles to form a binary number?

You combine them in order to create a single binary number.

47
New cards

Describe the conversion of hexadecimal 'B2' to binary.

Split 'B2' into 'B' and '2', convert to binary ('1011' and '0010'), then combine to get '10110010' in binary.

48
New cards

Do you add the decimal values of binary nybbles to get the final result?

Yes, you add the decimal values of the binary nybbles to obtain the final decimal result.

49
New cards

Define the decimal value of the binary number '10110010'.

The decimal value is 178.

50
New cards

How do you represent the decimal value 178 in hexadecimal?

In hexadecimal, 178 is represented as 'B2'.

51
New cards

Describe the process of converting from hexadecimal to decimal.

One way is to convert to binary first and then to decimal, or use the place values of hexadecimal directly.

52
New cards

How can floating point numbers in binary be compared to scientific notation?

They are similar, with a mantissa and exponent providing information to represent the actual value.

53
New cards

Define the components of a floating point binary number.

It consists of a mantissa and an exponent, along with a sign bit for positive or negative numbers.

54
New cards

Do you need to include information about the size of the mantissa and exponent in binary floating point numbers?

Yes, to accurately represent the value.

55
New cards

Describe the structure of a binary number with a sign bit, a 10-bit mantissa, and a 6-bit two's complement exponent.

It includes a sign bit, a mantissa with the binary point after the most significant bit, and a two's complement exponent.

56
New cards

Describe the process of converting a binary number to decimal using an exponent

Convert the exponent to decimal and move the binary point accordingly.

57
New cards

Do the conversion of the binary number 110010.0111 to decimal

Add the respective decimal values of each bit position to get 50.4375.

58
New cards

Define the components of a binary number format with a single sign bit, a 10-bit mantissa, and a 6-bit two's complement exponent

Components include sign bit, mantissa, and two's complement exponent.

59
New cards

How do you determine the sign, mantissa, and exponent of a binary number

Analyze the bits to determine the sign, mantissa value, and two's complement exponent.

60
New cards

Do the conversion of the binary number 0.101101000 to decimal

Move the binary point three places to the left and sum the decimal values to get -3.

61
New cards

Describe the process of converting a negative binary number to decimal

Identify the sign bit, use two's complement for the exponent, and adjust the binary point accordingly.

62
New cards

Define the significance of the two's complement in binary number representation

Two's complement is used to represent negative numbers in binary form.

63
New cards

How is the decimal value 45 represented in binary

In binary, 45 is represented as 101101.

64
New cards

Do the conversion of the binary number 0.000101101 to decimal

Sum the decimal values of each bit position to get 45.

65
New cards

Describe the significance of the binary point in binary number conversion

The binary point determines the position of the decimal point in the converted decimal number.

66
New cards

Describe the process of normalizing floating point numbers in a given number of bits.

Floating point numbers are normalized to maximize precision by adjusting the mantissa to start with '01' for positive numbers and '10' for negative numbers.

67
New cards

How do you normalize a binary number in floating point representation?

Adjust the mantissa to start with '01' for positive numbers or '10' for negative numbers, shifting bits accordingly and updating the exponent to maintain the same value representation.

68
New cards

Define normalizing a binary number in the context of floating point representation.

Normalizing involves adjusting the mantissa and exponent of a binary number to ensure maximum precision and consistent representation in a given number of bits.

69
New cards

Do you need to adjust the exponent when normalizing a floating point number?

Yes, the exponent needs to be adjusted when normalizing a floating point number to maintain the same value representation.

70
New cards

How does normalizing a floating point number affect the mantissa and exponent?

Normalizing involves shifting the mantissa to start with '01' or '10' and adjusting the exponent accordingly to ensure precision and consistent representation.

71
New cards

Describe the steps involved in normalizing a floating point number with an example.

Split the number into mantissa and exponent, adjust the mantissa to start with '01' or '10', shift bits as needed, update the exponent, and ensure consistent representation.

72
New cards

What is the purpose of normalizing floating point numbers?

The purpose of normalizing floating point numbers is to maximize precision and make efficient use of the available bits for representation.

73
New cards

How does normalizing a binary number impact the mantissa size?

Normalizing a binary number may increase or decrease the mantissa size depending on the shifting of bits to start with '01' or '10' for positive or negative numbers, respectively.

74
New cards

Describe the process of adding floating point binary numbers when their exponents are not the same.

When adding floating point binary numbers with different exponents, the numbers must first be modified so that they have the same exponent by shifting the mantissas accordingly.

75
New cards

Do you need to normalize the result after adding floating point binary numbers? If so, how?

Yes, the result of adding floating point binary numbers needs to be normalized by shifting the mantissa one bit to the left and decreasing the exponent by one.

76
New cards

Define the term 'normalizing' in the context of floating point arithmetic.

Normalizing in floating point arithmetic refers to adjusting the binary representation of a number to ensure a consistent format, typically by shifting the mantissa and adjusting the exponent.

77
New cards

How can you verify the correctness of the addition of floating point binary numbers?

You can verify the addition by converting each of the numbers to decimal and checking the result.

78
New cards

Describe the importance of having the same exponents when adding floating point binary numbers.

Having the same exponents is crucial for adding floating point binary numbers as it allows for a straightforward addition of the mantissas and simplifies the normalization process.

79
New cards

Do floating point subtraction involve converting to two's complement and adding?

Yes, the first stage is making the exponents the same, then converting the mantissa of the number to be subtracted to two's complement.

80
New cards

Describe logical shifts in binary numbers.

Logical shifts involve moving all bits in a binary number a specified number of places to the right or left, adding leading or trailing zeros.

81
New cards

How does a logical shift affect a binary number?

A logical shift left multiplies the number by 2 to the power of the places shifted, while a logical shift right divides the number.

82
New cards

Define masks in binary operations.

Masks are applied using logic gates to combine binary numbers, where the AND gate multiplies inputs to produce an output based on common 1s.

83
New cards

Do AND gates in binary masking produce 1s?

AND gates only produce a 1 output if both corresponding bits in the two numbers being masked are 1.

84
New cards

Do

Perform a logical OR operation on the given inputs.

85
New cards

Describe

What is a character set in computing?

86
New cards

Define

What is ASCII and what does it stand for?

87
New cards

How

How many characters can ASCII represent and how many bits does it use?

88
New cards

Describe a one-dimensional array.

An array that is a linear, ordered, finite set of elements of a single type, with elements accessed by index.

89
New cards

How are arrays typically indexed if not specified otherwise?

Arrays are typically zero-indexed, meaning the first element is at position zero.

90
New cards

Define a two-dimensional array.

A two-dimensional array can be visualized as a table or spreadsheet, with elements accessed by row and column indices.

91
New cards

Do you go down the rows or across the columns first when searching through a two-dimensional array?

You first go down the rows and then across the columns when searching through a 2D array.

92
New cards

Describe a three-dimensional array.

A three-dimensional array can be visualized as a multi-page spreadsheet, consisting of multiple 2D arrays, with elements accessed using z, y, and x coordinates.

93
New cards

How is an element selected in a three-dimensional array?

An element in a 3D array is selected using the syntax threeDimensionalArray

94
New cards

Describe what a record is in the context of databases.

A record is more commonly referred to as a row in a file and is made up of fields.

95
New cards

How is a record declared in programming?

A record is declared by specifying the data types and names of fields within the record.

96
New cards

Define how to access a specific field in a record.

Each field in the record can be identified by recordName.fieldName.

97
New cards

Do records in databases have a specific structure?

Yes, records in databases have a defined structure with fields containing specific data.

98
New cards

Describe the concept of a list in programming.

A list is a data structure consisting of ordered items where items can occur more than once.

99
New cards

How are list values stored compared to arrays?

List values are stored non-contiguously, unlike arrays where data is stored next to each other in memory.

100
New cards

Define the flexibility of data types in lists compared to arrays.

Lists can contain elements of more than one data type, unlike arrays which typically store elements of the same data type.