To Lecture Notes

IT130 Notes -- 5/13/09

Review Questions

  1. Which C# method call causes a jump to a new webpage?
    Ans: Response.Redirect
     
  2. The ASP.Net Code produces this output:
            Name  Gender  Age
    ====  =====   ===
    
    What is wrong?
     
    Ans: Since all whitespace within pre tags is preserved, any indentation spaces before the Literal control are also preserved.
     
  3. Convert 9Ehex to decimal.
    Ans: 9Ehex = 16 * 9 + E = 128 + 14 = 142dec
     
  4. Convert 75dec to hex.
    Ans: 75dec = (75/16)(75%16) = (4)(11) = 4Bhex
     
  5. Give the hex color codes for these colors:
     

  6. This code is supposed to find the total of all integers in an array. Find all the errors you can: Ans:
    1. total should be initialized to 0.
    2. int a should be declared as int[ ] a.
    3. The for loop should go from 0 to a.Length - 1 instead of 1 to a.Length.
    4. =+ should be +=.
    5. a(i) should be a[i].

  7. Convert the textfile persons.txt into an Access 97 database.
     
    Ans: See the document Importing a Textfile into Access
     
  8. You are given the database table Persons with columns FirstName (class string), Gender (class string), and Age (class int). Write SQL statements to do the following:
     
    1. Show all the names in the table.
      Ans: SELECT * FROM Persons;
       
    2. Show the ages of everyone named Fred.
      Ans: SELECT Age FROM Persons WHERE Name='Fred';
       
    3. Show the names of all women.
      Ans: SELECT Name FROM Persons WHERE Gender='F';
       
    4. Show the ages of all men over 21.
      Ans: SELECT Age FROM Persons WHERE Gender='M' And Age>21;
       
    5. Show the names of all men less than 25 and the names of all women less than 21.
      Ans: SELECT Age FROM Persons WHERE (Gender='M' And Age>25) Or (Gender='F' And Age>21);

 

Database Examples