assign Soln

  1. Download http://www.google-analytics.com/ga.js to a file named ga_local.js on your machine.


    1. How did you accomplish this?

    2. This file is full of a lot of gibberish. Are there more instances of the character a or g? How many of each? How did you determine this?

    3. Google has sensibly chosen size over readability for this file. Suppose that for your local copy, however, you wanted to rename the variables a, b, c, and g to apple, banana, carrot, and grapefruit. How would you do this?



 

  1. Write a regular expression to capture the three components of a standard 10 digit US telephone number. Your regular expression should handle, at a minimum, the following formats:


· xxx-xxx-xxxx · (xxx) xxx-xxxx · xxx xxx xxxx · xxx.xxx.xxxx Adapt your regular expression to support the area code being optional.  

  1. An attempt to load the webpage http://www.google.com/ results in a blank browser window, with no progress indicator or errors. What steps would you take to diagnose and debug this problem?


 

  1. On the sign-up form for a website, the user is asked to fill in their desired username, their password two times and a large text area with their hobbies and interests. If the user does not enter the same password in both fields, they are returned to the same page with an error message. The rest of the form should be filled in just as it had been. On occasion, the hobbies/interests field ends up blank even when the user had entered information. Describe this problem as a formal defect report.


 

  1. Identify test cases for the following scenario:

    Users have the ability to upload a CSV file via a web form. The site will process the file and provide some basic statistics.

    • Number of lines in the file
    • Breakdown of number of lines by number of columns, e.g. 5 lines have 3 columns, 10 lines have 9 columns, 1 line has 0 columns
    • Any lines that are not well formed CSV


         

  1. You are an IT support person charged with maintaining your school exam database and pulling information out of it.  Answer all of the questions below and return the scripts you used to answer each to OPOWER.


  Migrate the database to your own computer for local testing.  We have provided a gzipped backup of a mysqldump of the database called opower_hw.sql.gz.  Use this to restore the data and table structure to your local machine.   NOTE: If you don't currently have MySQL on your machine please download and install verison 5.1 on your local machine or find a computer at your school that has it already.  You do not need to include details of this installation in the homework, but please include the commands you ran to restore the database. a.       The Dean wants to know what the 3 most common last names of students are and how often each occurs.  Write a query to produce this report and provide the query and its results. b.       A second student named Al Ryan wants to enroll at your school but the tech's database update doesn't support having two students with the same name.  Write a SQL script to alter the schema to resolve this issue. c.        You've been given a separate file listing all the members of each of the school's clubs called opower_hw_club_list.csv.  Create a table or tables in the database to efficiently store this data and then load this file into your updated schema.  Do all of this using only SQL scripts. d.      The Dean is concerned that some students aren't active enough in outside activities.  Write a query to summarize how many clubs each student is in.  The Dean just wants a concise report so consolidate it to show just the count of students based on the number of clubs they are in.   Sample report (your numbers and basic styling may differ) students, clubs_per_student 600, 0 300, 1 200, 2    

  1.  Using a programming language of your choice write a function that accepts an array as a single parameter and prints the frequency of each element in the array. Code will be evaluated based upon logic and accuracy of the implementation.


 

  1. Imagine your function (from Question 7) is now used to process extremely large arrays. What would you do to improve the performance of your code? 

Powered by