邻居家的树压我的房子,怎么办?# Living
S*0
1 楼
Web development职位,不是很大的公司,先发邮件来做题,第一次碰到。
刚刚做完,过会发我的sample答案上来
1. Describe a deadlock. What causes it? What are the effects?
2. Consider class Car with method getMake() -> String. Write a function to
retrieve all Toyotas from the following data structure:
ArrayList cars
3. List the bugs/problems in the following code snippets:
a. select * from claim where diagnosis_id in (739.1) and where patient_id in
(select patient_id from patient where name is ‘SMITH’)
b.with a as (select * from claim)
select * from a where patient_id = 1231232;
c. class Test {
x int;
function inc() {
x = x + 1;
}
}
4. The following query is running slowly and returning bad results, fix and
optimize? What information do you need for optimization?
select *
from cars
where make = ?
and color = ?
or id = ?
5. Give three advantages of using the Model View Controller architecture
pattern.
6. What are the key traits of a successful manager?
7. You have a PHP Application that provides a lot of semi-static data to
users joined from many different MySQL schemas and tables in one page. The
elements on this page vary from tables, text, and charts. Over time as usage
and data grows, the page load elapsed time has increased from a half a
second when you first launched to 10 seconds during peak usage time
currently. You’ve spent a lot of time trying to optimize your queries and
PHP code, but no matter what you do, you cannot get it to perform any faster
. Most likely, you’ve run into a limitation in server performance and your
manager says that there is no money in the budget at this point in time for
a new server. You have to get the page to load in less than 2 seconds. What
would you do next?
8. Below is a method that is called from a page for retrieving a user’s
name from a database to return the user’s name and login for presentation
on the top portion of a “homepage”. Please identify the problem(s) with
the below example.
//method in “SomeClass” function
function getUserCreds($userId = null) {
$userId = 12;
$this->sql = “select first,last,login from user where id = $userId”;
$this->resultSet = mysql_query($this->sql);
foreach($row as mysql_fetch_array($this->result)) {
$this->user->first = $row[‘first’];
$this->user->last = $row[‘last’];
$this->user->login = $row[‘login’];
}
return $this->user;
}
//calling page
$userId = $_SESSION[‘userId’];
$user = SomeClass::getUserCreds($userId);
if(empty($user)) $user = “Guest”;
?>
Welcome
刚刚做完,过会发我的sample答案上来
1. Describe a deadlock. What causes it? What are the effects?
2. Consider class Car with method getMake() -> String. Write a function to
retrieve all Toyotas from the following data structure:
ArrayList
3. List the bugs/problems in the following code snippets:
a. select * from claim where diagnosis_id in (739.1) and where patient_id in
(select patient_id from patient where name is ‘SMITH’)
b.with a as (select * from claim)
select * from a where patient_id = 1231232;
c. class Test {
x int;
function inc() {
x = x + 1;
}
}
4. The following query is running slowly and returning bad results, fix and
optimize? What information do you need for optimization?
select *
from cars
where make = ?
and color = ?
or id = ?
5. Give three advantages of using the Model View Controller architecture
pattern.
6. What are the key traits of a successful manager?
7. You have a PHP Application that provides a lot of semi-static data to
users joined from many different MySQL schemas and tables in one page. The
elements on this page vary from tables, text, and charts. Over time as usage
and data grows, the page load elapsed time has increased from a half a
second when you first launched to 10 seconds during peak usage time
currently. You’ve spent a lot of time trying to optimize your queries and
PHP code, but no matter what you do, you cannot get it to perform any faster
. Most likely, you’ve run into a limitation in server performance and your
manager says that there is no money in the budget at this point in time for
a new server. You have to get the page to load in less than 2 seconds. What
would you do next?
8. Below is a method that is called from a page for retrieving a user’s
name from a database to return the user’s name and login for presentation
on the top portion of a “homepage”. Please identify the problem(s) with
the below example.
//method in “SomeClass” function
function getUserCreds($userId = null) {
$userId = 12;
$this->sql = “select first,last,login from user where id = $userId”;
$this->resultSet = mysql_query($this->sql);
foreach($row as mysql_fetch_array($this->result)) {
$this->user->first = $row[‘first’];
$this->user->last = $row[‘last’];
$this->user->login = $row[‘login’];
}
return $this->user;
}
//calling page
$userId = $_SESSION[‘userId’];
$user = SomeClass::getUserCreds($userId);
if(empty($user)) $user = “Guest”;
?>
Welcome