oDesk PHP Test Answers 2015
Ques: The setrawcookie() method of setting cookies is different from PHP standard method of cookie setting as:
It does not allow expiry time to be set
It can be used only once
It does not URL-ENCODE the value on its own
It does not allow domain setting
Ques: 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?
Add a member varibale that gets incremented in the default constructer and decremented the destructer.
Add a local variable that gets incremented in each constructer and decremented in the desructer
Add a static member variable that gets incremented in each constructer and decreented in the destructor
This cannot be accomplished since the creation of objects is being done dynamically via “new”
Ques: which of the following variable declaration within a class is invalid in PHP5?
private $type = “moderate”;
var $term = 3;
public $amn = “500″;
protected $name = ‘Quantes Private Limited’;
Ans: d
Ques: which of the following is not valid PHP parser tag?
script
?p
%
?php;
Ans: c
Ques: How can you hide the fact that web pages are written in PHP?
By using AddType application/X-httpd-php asp
Specify all file names without any dot and extension
By using .htaccess diretive in Apeche
All of the above
Ans: C
Ques: What is the output of the following code?
$a = 3;
$b = 2;
echo (int)$a/(int)$b
?>
1
1.5
2
3
Eroor
Ans: b
Ques: Which one is correct?
$s = fwrite (“a string here”);
$s = fwrite ($fp,”a string here”);
$s = fwrite (“a string here”,$fp);
non of the above
Ans: b
Ques: Which of the following set of operations is not valid in PHP 5?
>, >=
=,==
!==,!==
+=, *=
Ans: C
Ques: Late PHP version support remote file accessing for the functions:
include()
include_once()
require_once()
All of the above
Ans: D
Ques: What will be the output of the following script?
$count=50;
function Argument()
{
$count++;
echo $count;
}
Argument()
?>
It will print 50
It will print 51
It will print 52
It will print 1
Ans: D
Ques: which of the following are used for code reuse?
Loops
functions
Database
include files
Ans: B,D
Ques: which of the following is the corect way of specifying default value?
Function GetDiscount($Type = “Special”) {………}
Function GetDiscount(Type := “Special”) {………}
Function GetDiscount($Type: = “Special”) {………}
Function GetDiscount($Type : “Special”) {………}
Ans: b
Ques: Which of the following are “magic constant”?
__LINE__
__FILE__
c __PRETTY_FUNCTION__
d __CLASS__
__METHOD__
Ans: c
Ques: 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?
mail($to, $subject,$body)
sendmail($to, $subject,$body)
mail(to, subject,body)
sendmail(to, subject,body)
Ans: a
Ques: Which one of the following is turnary operator?
&
=
?:
+=
&&
Ans: D
Ques: What is the result of the following Exprssion?
5+2*4+6
70
19
34
21
Ans: B
Ques: The default value of register global in PHP is:
Off
On
Ans: A
Ques: What would b the outpur of the following code?
$string = ‘good day’;
$string = ucword($string);
echo $string;
?>
good day
GOOD DAY
Good Day
non of the above
Ans: C
Ques: If you want to pass a value to a function by reference, the correct way is:
function ModifyReport(&$Rptfile){}
function ModifyReport($Rptfile){}
function ModifyReport(ByRef $Rptfile){}
function ModifyReport(&Rptfile){}
Ans: D
Ques: The setrawcookie() method of setting cookies is different from PHP standard method of cookie setting as:
It does not allow expiry time to be set
It can be used only once
It does not URL-ENCODE the value on its own
It does not allow domain setting
Ques: 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?
Add a member varibale that gets incremented in the default constructer and decremented the destructer.
Add a local variable that gets incremented in each constructer and decremented in the desructer
Add a static member variable that gets incremented in each constructer and decreented in the destructor
This cannot be accomplished since the creation of objects is being done dynamically via “new”
Ques: which of the following variable declaration within a class is invalid in PHP5?
private $type = “moderate”;
var $term = 3;
public $amn = “500″;
protected $name = ‘Quantes Private Limited’;
Ans: d
Ques: which of the following is not valid PHP parser tag?
script
?p
%
?php;
Ans: c
Ques: How can you hide the fact that web pages are written in PHP?
By using AddType application/X-httpd-php asp
Specify all file names without any dot and extension
By using .htaccess diretive in Apeche
All of the above
Ans: C
Ques: What is the output of the following code?
$a = 3;
$b = 2;
echo (int)$a/(int)$b
?>
1
1.5
2
3
Eroor
Ans: b
Ques: Which one is correct?
$s = fwrite (“a string here”);
$s = fwrite ($fp,”a string here”);
$s = fwrite (“a string here”,$fp);
non of the above
Ans: b
Ques: Which of the following set of operations is not valid in PHP 5?
>, >=
=,==
!==,!==
+=, *=
Ans: C
Ques: Late PHP version support remote file accessing for the functions:
include()
include_once()
require_once()
All of the above
Ans: D
Ques: What will be the output of the following script?
$count=50;
function Argument()
{
$count++;
echo $count;
}
Argument()
?>
It will print 50
It will print 51
It will print 52
It will print 1
Ans: D
Ques: which of the following are used for code reuse?
Loops
functions
Database
include files
Ans: B,D
Ques: which of the following is the corect way of specifying default value?
Function GetDiscount($Type = “Special”) {………}
Function GetDiscount(Type := “Special”) {………}
Function GetDiscount($Type: = “Special”) {………}
Function GetDiscount($Type : “Special”) {………}
Ans: b
Ques: Which of the following are “magic constant”?
__LINE__
__FILE__
c __PRETTY_FUNCTION__
d __CLASS__
__METHOD__
Ans: c
Ques: 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?
mail($to, $subject,$body)
sendmail($to, $subject,$body)
mail(to, subject,body)
sendmail(to, subject,body)
Ans: a
Ques: Which one of the following is turnary operator?
&
=
?:
+=
&&
Ans: D
Ques: What is the result of the following Exprssion?
5+2*4+6
70
19
34
21
Ans: B
Ques: The default value of register global in PHP is:
Off
On
Ans: A
Ques: What would b the outpur of the following code?
$string = ‘good day’;
$string = ucword($string);
echo $string;
?>
good day
GOOD DAY
Good Day
non of the above
Ans: C
Ques: If you want to pass a value to a function by reference, the correct way is:
function ModifyReport(&$Rptfile){}
function ModifyReport($Rptfile){}
function ModifyReport(ByRef $Rptfile){}
function ModifyReport(&Rptfile){}
Ans: D
No comments:
Post a Comment