Для тех кто жаждет дополнительных знаний и заданий предлагаю сделать реальные тестовое задание по web-программированию:
_MySQL_ Imagine you have the following MySQL schema:
CREATE TABLE Student (
id int unsigned
, name varchar(255) -- The name of the student
, schoolName varchar(255) -- The name of the school the student attends
, PRIMARY KEY (id)
);
CREATE TABLE StudentResults (
studentId int unsigned -- The unique id of each student
, examId int unsigned -- The unique id of each exam
, percentage int unsigned -- Result the student achieved on the exam as a percentage
);
With some example data:
INSERT INTO Student (id, name, schoolName)
VALUES
(1, 'Peter', 'Southland Primary')
, (2, 'Paul', 'Southland Primary')
, (3,'Mary', 'Long Beach Primary School')
, (4, 'Michelle', 'Southland Primary');
INSERT INTO StudentResults (studentId, examId, percentage)
VALUES
(1,1,50), (1,1,65), (1,1,75), (1,1,90), (1,1,100), (1,2,85), (1,3,90), (1,4,75), (1,5,90)
, (2,1,100), (2,2,95), (2,3,100), (2,6,90), (2,7,100)
, (3,1,100), (3,2,95), (3,3,40);
Write SQL queries to solve the following. Please use any MySQL
extensions or functions you would like.
Example question: How many grades greater than 50 percent?
SELECT COUNT(*)
FROM StudentResults
WHERE percentage > 50;
1. What is the average percentage achieved by each student across all
their results?
2. How many Students from "Southland Primary" have attempted at least
three different exams?
3. If a Fail is a grade 0 - 49, and a Pass is a grade 50 - 64 and a
Credit is a grade 65 - 100, write a query to find how many students
got a Fail/Pass/Credit for each exam. Only consider the students best
results in this query.
Добавлено (20.02.11, 23:53)
---------------------------------------------
_PHP_
4. Given a PHP function with the following signature:
function randStr($length=64, $charSet='abcdefghijklmnopqrstuvwxyz')
{
}
Complete the function body so that given a string of characters,
$charSet, the function returns a string of length $length, consisting
of characters choosen at random from the string $charSet.
Example usage:
> <?php
> $token1 = randStr(10, '0123456789abcdef');
> $token2 = randStr(10, '0123456789abcdef');
>
> print $token1;
> print $token2;
Output:
89cf255e8a
97426b9719
5. In your own words; what is the Model View Controller (MVC)
architecture? How is it commonly applied to web applications?
6. Suppose you have a MySQL database table:
CREATE TABLE Student (
id int unsigned
, name varchar(255) -- The name of the student
, schoolName varchar(255) -- The name of the school the student attends
, PRIMARY KEY (id)
);
Using PHP 5 OOP features, design a "iStudent" Interface that you would
be happy to use which supports creating, modify and deleting
*individual* records in the Student table.
Please note: You only need to write out the method signatures of the
iStudent Interface with a short comment describing what each method
would do. You do not need to write any code for the method bodies.