This preview shows pages 1–3. Sign up to view the full content.
Lecture C4: Strings, IFstatement, bits and bytes
Response to 'Muddiest Part of the Lecture Cards'
(63 respondents, out of 72 students)
2)
What is Little/Big Endian?
(1 student)
I did not have time to cover that in class today. Will on Friday.
Endianness refers to which bytes (1 byte = 8 bits) are most significant in a multibyte data type. In a big
endian machine, the leftmost byte (the one with the lower address) is the most significant. In a little
endian machine, the righmost byte is the most significant. For example the 32 bit hexadecimal number
16#ABCDEF42# will on a bigendian machine be stored in 4 consecutive bytes in the following order:
AB CD EF 42. The same 32 bit number would on a littleendian machine be saved in the following byte
order: 42 EF CD AB. Examples of littleendian machines are the Intel x86. Examples of bigendian
machines are: Motorola 68k and the PowerPC.
3)
Could we get more practice using hexadecimal code?
(1 student)
Yes, absolutely! Maybe already in tomorrows recitation.
4)
What is FOR?
(1 student)
Ada provides the FOR statement for definite iteration. Definite iteration is where the set of actions is
performed a known number of times. The number might be determined by the program specification, or
it might not be known until the program is executing, just before starting the iteration. The FOR
statement will be covered in later lecture.
5)
Binary numbers
(3 students)
B inary numbers only use ones and zeros as their numbers. A binary number can be repsesented by any
set of bits (binary digits). We will see example of this in recitation tomorrow. Just as an example, the
decimal numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 are represented using 4 bits in the following way:
0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100. Arithmetic in binary is much
like arithmetic in other numberal systems:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (the 1 is a Carry/overflow)
6)
Concatenation of strings
(and other Stirng questions) (5 students)
The string concatenation operator
applied to 2 strings S1 and S2, concatenates, or "pastes together",
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Documentits two arguments. For example the statement
S3 := S1 & S2;
stores in S3 the concatenation of S1 and S2. The length of S3 must match the sum of the length of S1
and S2, if it does not, a constarint error will be raised. [Feldman page 436]
7)
What are the Boolean operators, and when can XOR be useful?
(2 students)
This is the end of the preview. Sign up
to
access the rest of the document.
 Winter '12
 CharlesColeman
 Aeronautics, Astronautics

Click to edit the document details