Trong bài này, chúng ta sẽ test một số kiến thức liên quan đến PHP và MySQL, gồm 25 câu.
Câu 1: What will this output
A. true
B. false
C. Nothing
D. An error
Câu 2: What can you use to replace like with hate in I like Regular Expressions?
A. preg_replace("/like/", "/hate/", "I like Regular Expressions")
B. preg_replace("/hate/", "/like/", "I like Regular Expressions")
C. preg_replace("/like/", "hate", "I like Regular Expressions")
D. preg_replace("/hate/", "like", "I like Regular Expressions")
E. preg_replace("like", "hate", "I like Regular Expressions")
F. preg_replace("hate", "like", "I like Regular Expressions")
Câu 3: What library do you need in order to process images?
A. GD library
B. ZIP library
C. Win32 API library
D. BOGUS library
Câu 4: What function sends mail:
A. mail()
B. imap_mail()
C. None of them
D. Both of them
Câu 5: What is the problem with <?=$expression ?> ?
A. There is no problem
B. It requires short tags and this is not compatible with XML
C. It requires a special PHP library that may not always be available
D. This syntax doesn't even exist
Câu 6: Put this line php display_errors=false in a .htaccess file when you deploy the application?
A. Good idea, increases security
B. Bad idea, I want to see when errors occur
C. That won't hide any error 'coz you can't use .htaccess to control the PHP engine
D. That won't hide any error 'coz it's not the correct code
Câu 7: Which of the following regular expressions will match the string go.go.go?
A. go?go?go
B. go*go*go
C. ..\...\...
D. \.\..\.\..\.\.
Câu 8: A constructor is a special kind of ...
A. Variable
B. Method
C. Class
D. Object
Câu 9: What does break; do?
A. Ends execution of the current for, foreach, while, do-while or switch structure
B. Moves on to the next iteration of the current for, foreach, while, do-while or switch structure
C. Ends execution of the current method
D. It doesn't exist
Câu 10: Can this PHP code be valid:
<?php
$a = false;
$b = true;
$c = false;
if ($a ? $b : $c) {
echo "false";
} else {
echo "true";
}
?>
A. true
B. false
C. Nothing
D. An error
Câu 2: What can you use to replace like with hate in I like Regular Expressions?
A. preg_replace("/like/", "/hate/", "I like Regular Expressions")
B. preg_replace("/hate/", "/like/", "I like Regular Expressions")
C. preg_replace("/like/", "hate", "I like Regular Expressions")
D. preg_replace("/hate/", "like", "I like Regular Expressions")
E. preg_replace("like", "hate", "I like Regular Expressions")
F. preg_replace("hate", "like", "I like Regular Expressions")
Câu 3: What library do you need in order to process images?
A. GD library
B. ZIP library
C. Win32 API library
D. BOGUS library
Câu 4: What function sends mail:
A. mail()
B. imap_mail()
C. None of them
D. Both of them
Câu 5: What is the problem with <?=$expression ?> ?
A. There is no problem
B. It requires short tags and this is not compatible with XML
C. It requires a special PHP library that may not always be available
D. This syntax doesn't even exist
Câu 6: Put this line php display_errors=false in a .htaccess file when you deploy the application?
A. Good idea, increases security
B. Bad idea, I want to see when errors occur
C. That won't hide any error 'coz you can't use .htaccess to control the PHP engine
D. That won't hide any error 'coz it's not the correct code
Câu 7: Which of the following regular expressions will match the string go.go.go?
A. go?go?go
B. go*go*go
C. ..\...\...
D. \.\..\.\..\.\.
Câu 8: A constructor is a special kind of ...
A. Variable
B. Method
C. Class
D. Object
Câu 9: What does break; do?
A. Ends execution of the current for, foreach, while, do-while or switch structure
B. Moves on to the next iteration of the current for, foreach, while, do-while or switch structure
C. Ends execution of the current method
D. It doesn't exist
Câu 10: Can this PHP code be valid:
$4bears = $bears->getFirst4();
A. Yes
B. No
Câu 11: Who created PHP as we know it today?
A. Bill Gates
B. Tim Berners-Lee
C. Rasmus Lerdorf
D. Jackie Chan
Câu 12: What will this output:
<?php
$dog = "Dogzilla";
$dragon = &$dog;
$dragon = "Dragonzilla";
echo $dog." ";
echo $dragon;
?>
A. Dogzilla Dragonzilla
B. Dragonzilla Dogzilla
C. Dogzilla Dogzilla
D. Dragonzilla Dragonzilla
Câu 13: How can you tell a page (like this one) has been created by PHP?
A. It has a .php extension
B. By looking at the HTTP headers
C. You can never be 100% sure if a page was created by PHP
Câu 14: Assuming all the variables a, b, c have already been defined, could this be a variable name: ${$a}[$b][$c] ?
A. Yes
B. No
Câu 15: In MySQL, if you want to find out about the structure of a table tblQuiz, what will you use?
A. DESCRIBE tblQuiz
B. DESCRIBE table tblQuiz
C. SHOW tblQuiz
D. SHOW table tblQuiz
Câu 16: How can you count all the rows in a table tblQuiz?
A. SELECT COUNT(*) FROM tblQuiz
B. SELECT COUNT(tblQuiz)
C. COUNT(tblQuiz)
D. COUNT ROWS FROM TABLE tblQuiz
Câu 17: In which of the following scenarios might you use the function md5?
A. perform large number multiplication
B. decode a message if you also have the key
C. encode a message which can then be decoded by the receiver
D. perform authentication without unnecessarily exposing the access credentials
Câu 18: Back to MySQL, can you select data from more than one table in a single query?
A. Yes
B. No
Câu 19: What is the logo of MySQL?
A. A tiger
B. A dolphin
C. A spider
D. A computer
E. A key
Câu 20: What does this function do:
<?php
function my_func($variable)
{
return (is_numeric($variable) && $variable % 2 == 0);
}
?>
A. tests whether $variable ends in 2
B. tests whether $variable is a number and ends in 2
C. tests whether $variable contains 2
D. tests whether $variable is a number and contains 2
E. tests whether $variable is an even number
Câu 21: How do you find the square root of a number?
A. In both PHP and MySQL you have a function called sqrt
B. In PHP, use the function squareroot; in MySQL use the function sqrt
C. In PHP, use the function squareroot; in MySQL you can't
D. In PHP, use the function Math.squareRoot; in MySQL you can't
Câu 22: Assuming results of a bunch of quizzes are kept in the following table, how do you print all the quizzes' names and their average score (quizName is 'Php Mysql', 'Css Html', 'Web Design' and so on for other quizzes)?
+--------------+--------------+
| Field | Type |
+--------------+--------------+
| userName | varchar(20) |
| userScore | tinyint(3) |
| userComments | varchar(255) |
| quizName | varchar(20) |
+--------------+--------------+
A. select quizName, avg(userScore) from tblQuiz group by quizName;
B. select quizName, avg(userScore) from tblQuiz order by quizName;
C. select quizName, userScore / count(userScore) from tblQuiz group by quizName;
D. select quizName, userScore / count(userScore) from tblQuiz order by quizName;
Câu 23: Is this quiz table normalized and is that OK?
+--------------+--------------+
| Field | Type |
+--------------+--------------+
| userName | varchar(20) |
| userEmail | varchar(20) |
| userScore | tinyint(3) |
| userComments | varchar(255) |
| quizName | varchar(20) |
| quizType | varchar(20) |
| quizUrl | varchar(20) |
+--------------+--------------+
A. it's not normalized, and that's OK
B. it's not normalized, and that's NOT OK
C. it is normalized, and that's OK
D. it is normalized, and that's NOT OK
Câu 24: Which is the correct timeline (OO stands for object oriented)?
A. OO Programming, OO Design, OO Analysis
B. OO Programming, OO Analysis, OO Design
C. OO Analysis, OO Design, OO Programming
D. OOD Design, OO Analysis, OO Programming
Câu 25: What does this output:
class T
{
public $m = "a";
function T()
{
$this->m = "b";
}
}
$t = new T();
$p = $t->m;
$p = "c";
echo $t->m;
A. a
B. b
C. c
Editor: Vinhhq (http://baomathethong.blogspot.com/)
Author & Source: Andong.co.uk
Không có nhận xét nào:
Đăng nhận xét