Upwork Test Answer PHP Skill Test

Question: 01
The setrawcookie() method of setting cookies is different from PHP standard method of cookie setting as:

a. It does not allow expiry time to be set
b. It can be used only once
c. It does not URL-ENCODE the value on its own
d.It does not allow domain setting
Answer: c. It does not URL-ENCODE the value on its own

Question: 02
How can you hide the fact that web pages are written in PHP?

a. By using AddType application/X-httpd-php asp
b. Specify all file names without any dot and extension
c. By using .htaccess diretive in Apeche
d. All of the above
Answer: c. By using .htaccess diretive in Apeche

Question: 03
What is the output of the following code?

$a = 3;
$b = 2;
echo (int)$a/(int)$b

a. 1
b. 1.5
c. 2
d. 3
e. Eroor
Answer: b. 1.5

Question: 04
Which one is correct?

a. $s = fwrite (“a string here”);
b. $s = fwrite ($fp,”a string here”);
c. $s = fwrite (“a string here”,$fp);
d. non of the above
Answer: b. $s = fwrite ($fp,”a string here”);

Question: 05
Which of the following set of operations is not valid in PHP 5?
a. >, >=
b. =,==
c. !==,!==
d. +=, *=
Answer: c. !==,!==

Question: 06
Late PHP version support remote file accessing for the functions:

a. include()
b. include_once()
c. require_once()
d. All of the above
Answer: d. All of the above

Question: 07
What will be the output of the following script?

function Argument()
echo $count;

a. It will print 50
b. It will print 51
c. It will print 52
d. It will print 1
Answer: d. It will print 1

Question: 08
which of the following are used for code reuse?

a. Loops
b. functions
c. Database
d. include files
Answer: b. functions, d. include files

Question: 09
Which one of the following is turnary operator?

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

Question: 10
What is the result of the following Exprssion?


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

Question: 11
The default value of register global in PHP is:

a. Off
b. On
Answer: a. Off

Question: 12
What would b the outpur of the following code?

$string = ‘good day’;
$string = ucword($string);
echo $string;

a. good day
c. Good Day
d. non of the above
Answer: c. Good Day

Question: 13
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){}
Answer: d. function ModifyReport(&Rptfile){}

Question: 14
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”) {………}
Answer: ---

Question: 15
Which of the following are ”magic constant’?

a. __LINE__
b. __FILE__
d __CLASS__
e. __METHOD__
Answer: ----

Question: 16
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)
Answer: -----

Question: 17
You need to keep an eye on the existing number of objects of a given class without introducing a non-class varibale. which of the following makes this happen?

a. Add a member varibale that gets incremented in the default constructer and decremented the destructer.
b. Add a local variable that gets incremented in each constructer and decremented in the desructer
c. Add a static member variable that gets incremented in each constructer and decreented in the destructor
d. This cannot be accomplished since the creation of objects is being done dynamically via “new”
Answer: ----

Question: 18
which of the following variable declaration within a class is invalid in PHP5?

a. private $type = “moderate”;
b. var $term = 3;         
c. public $amn = “500″;
d. protected $name = ‘Quantes Private Limited’;
Answer: ----

Question: 19
which of the following is not valid PHP parser tag?

a. script
b. ?p
c. %
d. ?php;
Answer: -----

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Post a comment ➜

No Comment