Node:Questions 18, Previous:Machine-level operators, Up:Advanced operators



Questions 18

  1. Hidden operators can be used in return statements, for example,
    return (++x);
    

    Would there be any point in writing the following?

    return (x++);
    

  2. What distinguishes a bit string from an ordinary variable? Can any variable be a bit string?
  3. What is the difference between an inclusive OR operation and an exclusive OR operation?
  4. Find out what the decimal values of the following operations are.
    1. 7 & 2
    2. 1 & 1
    3. 15 & 3
    4. 15 & 7
    5. 15 & 7 & 3

    Try to explain the results. (Hint: sketch out the numbers as bit strings.)

  5. Find out what the decimal values of the following operations are.
    1. 1 | 2
    2. 1 | 2 | 3
  6. Find out the decimal values of the following operations.
    1. 1 & (~1)
    2. 23 & (~23)
    3. 2012 & (~2012)
    (Hint: write a short program to work them out.)