Sunday, October 30, 2011

Exercise Questions

Exercise Questions

Question 1:
$locations = array('Selangor' => array('PJ', 'Puchong', 'Ampang'), 'Penang' => array('George Town', 'Seberang Jaya'), 'Sarawak' => array('Kuching', 'Miri', 'Bintulu'));

1. Write a single line code to output Seberang Jaya
2. Write a single line code to find the total number of towns in Penang
3. Using loop statements, create and HTML output in the following format:
Locations in Selangor: PJ, Puchong, Ampang
Locations in Penang: George Town, Seberang Jaya
Locations in Sarawak: Kuching, Miri, Bintulu

4. Write a single line code to insert the location \"Prai\" to the end of the array \"Penang\".
Overwrite \"Puchong\" with \"Damansara\" in the array \"Selangor\"

Question 2: Loop
Using a loop statement, produce the following output:
3, 6, 9, 12, 15, 18, 21

Question 3: Arrays
Output the values in the following array in ascending order using your preferred sort algorithm (do not use the asort() PHP function):
array(10, 38, 3, 58, 1, 4, 0, 29, 48, 29, 22, 66, 23, 76);

Question 4: PHP Date/Time
Using mktime() in PHP, find out what day of the week is it on your 30th birthday

Question 5: Database
Using SQL, find out the date 60 days ago.

Question 6: Database
Study and analyse the following table structure:
employees(employee_id, full_name, dept_id, position, phone, fax)
departments(dept_id, dept_name, hod_manager)
attendance(attendance_id, employee_id, clock_in, clock_out)
payroll(payroll_id, employee_id, payroll_date, gross_salary, total_claims,
total_deductions, net_salary)

1. Create a database and its tables based on the above definition
2. Produce the SQL statement to retrieve all employees arriving to work after 9:00am in the last 25 days
3. Produce the SQL statement to retrieve all employees in descending order with gross salary below 5,000.00 and total claims above 1500.00 in the last 25 days
4. Produce the SQL statement to retrieve all employees' full name, position, and phone from IT department (dept_id as '1000') who leaves work after 9:00pm in the last 25 day
5. Produce the SQL statement to retrieve only 100 employees\nProduce the SQL statement to retrieve the top 10 highest earning employees


JAWAPAN ADA DI SINI.

No comments:

Post a Comment