The On Demand Global Workforce - oDesk

Wednesday, November 3, 2010

PHP Test And solutions oDesk

PHP Test And solutions
Question.11.

which of the following are used for code reuse?

a. Loops
b. functions
c. Database
d. include files


Solution:

B,D

Question.13.

which of the following is the corect way of specifying default value?

a. Function GetDiscount($Type = "Special") {.........}
b. Function GetDiscount(Type := "Special") {.........}
c. Function GetDiscount($Type: = "Special") {.........}
d. Function GetDiscount($Type : "Special") {.........}

Solution:

Question.14.

Which of the following are ''magic constant'?

a. __LINE__
b. __FILE__
c __PRETTY_FUNCTION__
d __CLASS__
e. __METHOD__

Solution:

Question.15.

you have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email?

a. mail($to, $subject,$body)
b. sendmail($to, $subject,$body)
c. mail(to, subject,body)
d. sendmail(to, subject,body)

Solution:

Question.16.

Which one of the following is turnary operator?

a. &
b. =
c. :?
d. ?:
e. +=
f. &&

Solution

D

Question.17.

What is the result of the following Exprssion?
5+2*4+6

a. 70
b. 19
c. 34
d. 21

Solution:
B

Question.18.

The default value of register global in PHP is:

a. Off
b. On

Solution:

A

Question.19.


What would b the outpur of the following code?

$string = 'good day';
$string = ucword($string);
echo $string;
?>

a. good day
b. GOOD DAY
c. Good Day
d. non of the above

Solution:

C

Question.20.

If you want to pass a value to a function by reference, the correct way is:

a. function ModifyReport(&$Rptfile){}
b. function ModifyReport($Rptfile){}
c. function ModifyReport(ByRef $Rptfile){}
d. function ModifyReport(&Rptfile){}

Solution:

D

No comments:

Post a Comment