Math Quiz: Math for - Strings

  1. A factory produces two components. Component X has a serial number "SNX45A" and Component Y has a serial number "YID092B". If these components are assembled into a larger unit, its serial number is formed by joining the serial number of Component X followed by the serial number of Component Y. What is the total number of characters in the new serial number?

  2. Consider the sequence of numbers: $S = (5, 8, 2, 0, 6, 3, 9, 4)$. If we label the position of the first number as 0, the second as 1, and so on, what number is at position 5?

  3. A digital message is represented by the sequence of symbols: $M = (\text{A, B, C, D, E, F, G, H, I, J})$. A sub-message is extracted starting from position 2 up to (but not including) position 7.

    List the symbols in this sub-message.

    How many symbols are there?

  4. A simple sensor system uses binary codes to represent states. If the system outputs the binary code $1101_2$, what is its equivalent value in the decimal system (base 10)?

  5. Consider the sequence of characters: $C = \text{"AXBYAWCBYD"}$. We are searching for the sub-sequence "BY". List all starting positions (0-indexed) where the sub-sequence "BY" is found in $C$.

  6. A message of total length $L$ characters is composed of a header, a payload, and a trailer. The header has $H$ characters and the trailer has $T$ characters.

    1. Write a formula for the length of the payload, $P$, in terms of $L, H,$ and $T$.

    2. If a message has a total length of 25 characters, a header of 4 characters, and a trailer of 3 characters, what is the length of the payload?

    3. What if the total length $L$ is 10 characters, the header $H$ is 5 characters, and the trailer $T$ is 6 characters? What would this imply about the payload length, and is it a valid scenario for a message structure?