Total Visitor

Saturday, April 21, 2012

Odesk php5 test answers


1……
Following is a php code block:
$m=9;
$n=99;
$z=8;
$z=$n++/$m++ + –$z;

2……
what will be the output?
a. 16
b. 18
c. 19
d. 20
e. 17
3……

 Which of the following is the correct 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”) { . . . }

4……..


What will be the output on running the script?

a. Text Line1Text Line2
b. Text Line1 Text Line2
c. ‘Text Line1′
d. ‘Text Line2′
e. Error message will be printed

5…….


What will be the ouput of the following code?

for ($i = 0; $i < i =”=””>

a. 0
1
2
3
4
5
b. 0
1
3
4
c. 2
d. 0
1
2
4
e. None of the above

6………

Late PHP versions support remote file accessing for the functions:

a. include()
b. include_once()
c. require_once()
d. Both a and b
e. Both b and c


7………..

How can you access the username entered by the user in the ‘Validate.php’ webpage?

a. $var= $_POST['username'];
b. $var= $_REQUEST['username'];
c. import_request_variables(‘p’, ‘p_’);
$var= $p_username;
d. All of the above


8………..

How can you access the username entered by the user in the ‘Validate.php’ webpage?

a. $var= $_POST['username'];
b. $var= $_REQUEST['username'];
c. import_request_variables(‘p’, ‘p_’);
$var= $p_username;
d. All of the above




9………….
what would be the output of the following code?
$stg=’good day’;
$stg= ucwords($stg);
echo $stg;
?>
a. good day
b. GOOD DAY
c. Good Day
d None of the above
10……….
which of the following command line interface constant is not defined in the cli sapi?

a. STDIN
b. STDOUT
c. STDPRT
d STDERR
11………….

if the session_cache_expire()is not set,then by default the session cache will expire after:

a. 1 hr
b. 2 hr
c. 3 hr
d 4 hr

12………….

Which of the following is not a correct way of commenting in php?
a. //php comment
b. /*php comment*/
c. #php comment
d /# php comment

13……………

If the session_cache_expire() is not set, then by default the session cache will expire after:

a. 1 hr
b. 2 hrs
c. 3 hrs
d. 4 hrs


14……………

What will be the output of the following code?

$a = 0.0;

for ($i = 0; $i < a =”=””>

a. 0.9
Not Equals
b. 1
Equals
c. 1
Not Equals
d. 1.1
Not Equals
e. None of the above


15………….


What will be the output of the following code?

$i=4;
$j=30;
$k=0;
$k=$j++/$i++;
echo $i . ” ” . $j . ” ” . $k . ” “;

a. 5 31 6
b. 5 31 6.2
c. 5 31 7
d. 4 31 7.5
e. 5 31 7.5


16………..


Which of the following is a not a correct way of commenting in php?

a. //PHP Comment
b. /*PHP Comment*/
c. #PHP Comment
d. /#PHP Comment


17………….

What will be the output of the following script?

$count=50;
function Argument()
{
$count++;
echo $count;
}
Argument();
?>

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


18…………..

State whether True or False

Paamayim Nekudotayim operator allows access only to the static members of a class?

a. True
b. False

19………….

Which of the following statements is true with regard to comparisons in PHP5?

a. With “= =” operator, two object instances are equal if they have the same attributes and values, and are instances of a different class.
b. With “==” operator two object instances are equal if they have the same attributes and values, and are instances of the same class.
c. With (===) operator, object variables are identical if and only if they refer to the same instance of the same class.
d. With (===) operator, object variables are identical if and only if they refer to the different instance of the same class.


20………….

What should be the code in line 3, if the file name to upload is “SalesFile”?

a.
b.
c.
d.


21………….


Which of the following built-in function assist in checking if actually the function exists or not?

a. exists
b. function_exists
c. fexists
d. isFunction

Answer: b;


22………….

Which of the following statements is correct with regard to final and abstract?

a. An abstract class cannot have final methods
b. An abstract class cannot have non abstract methods
c. A final class cannot have abstract methods
d. A final class cannot have final methods


23………..

Which composite data types are supported by php?

a. Array
b. Enumeration
c. List
d. Object
e. Integer


24……………

The default value of register_globals in PHP is:

a. Off
b. On


25………….

Which of the following is not a valid PHP connection status?

a. aborted
b. normal
c. open
d. timeout

26…………….

Choose the correct statement:

a. include() includes and evaluates a specific file
b. require() includes and evaluates a specific file
c. include_once() includes and evaluates a specific file only if it has not been included before
d. require_once() includes and evaluates a specific file only if it has not been included before
e. All of the above


27……………
given below is a small php script:

class person{
Function getSal()
{
…..
…..
…..
}
}
Class emp extends person{
funciton GetSal()
{
???
}
}
?>
The getSal() of emp has to behave exactly as getSal() of person .which of the folliwing lines of code would you use to replce the

????
a. perent:: getSal();
b. person:: getSal();
c. parent:: getSal;
d. person:: getSal;



0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More