MIS 3371 Summer 2014 Parks Exam 1 Answers

Top 10,000 Passwords
from:
xato.net/passwords/more-top-worst-passwords
(with 129 obscenities removed)


This is the DIV with id=p1_out
1. (50 points)The textarea shown to the left is named ta in a form named f1. It contains the top 10,000 passwords in order of frequency of use -- each followed by a comma (except the last one). When the "Execute p1" button is clicked the javascript function p1 is executed. This function:
  1. has two arrays:
    1. an array named cbytes with 20 elements, initialize the elements of this array to zero. This array will be used to count the number of passwords with length: 0,1,2,3,...,18,19
    2. an array named cnumb with 20 elements, initialize the elements of this array to zero. This array will be used to count the number of passwords with of length: 0,1,2,3,...,18,19 that contain ONLY numbers
  2. retrieve the data from the textarea ta.
  3. split the data from step 2 into an array named a.
  4. for each password: determine its length, add one to the appropriate location in the array cbytes (e.g., if the length of the password is 6 bytes, add 1 to the value of cbytes[6])
  5. also, for each password: determine whether or not the password is composed of only the digits 0 thru 9. If the password is all digits add one to the value of cnumb for the length of the password (e.g., if the password is 7 bytes long AND contains only digits, add 1 to cnumb[7])
    (Hint: if isNAN(password string) is true, the password contains at least one byte that is NOT a digit; if false the password is composed of digits only).
  6. create a 20 row - three column table (Do not write the heading as shown in the answer). This table has 20 rows and 3 columns:
    1. column 1 contains the password length (zero thru 19).
    2. column2 shows the number of passwords with the length shown in column 1.
    3. column 3 shows the number of passwords whose length is shown in column 1 and that has ONLY digits.
  7. place the resulting table in the DIV block with id="p1_out".
Show NO HTML. Show only the javascript for the function p1.
All the Words
http://www.infochimps.com/datasets/word-list-100000-official-crossword-words-excel-readable/