x9Vqys1dSq61ciaKAbaEFXEh5M0 Kholabangla: oDesk PHP Test Answers:

Menu Bar

Sunday, September 18, 2011

oDesk PHP Test Answers:

1) The setrawcookie() method of setting cookie 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


2) IF visibility is not defined for a method /member then it is treated as public static.

a. True
b. False

3) Which of the following is not a valid php connection status?

a. Aborted
b. Normal
c. Open
d. Timeout

4) Which of the following statements is not true with regard to abstract classes in php5?


a. Abstract classes are introduced in php 5
b. A class with a single abstract method must be declared abstract
c. Abstract class can contain abstract methods
d.Abstract method must have method definition and can have optional empty braces following it

5) What will be the result of following operation?

Print 4<<5;

a. 3
b.128
c.120
d. 6

6) Which of the following type cast in not correct?

$fig=23;
$varbl=(real)$fig;
$varb2=(double)$fig;
$varb3=(decimal)$fig;
$varb4=(bool)$fig;
?>

a. real
b. double
c. decimal
d. Boolean


7) What is the result of the following expression?

5+2*4+6

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

8) The classes are defined as follows

Abstract class BaseCls(
Protected abstract function getName();
}
Class childCls extends BaseCls{
}
Which of the following implementations of getName() in invalid in childCls?

a . Protected function getName(){}
b. Function getName(){}
c. Private function getName(){}
d. Public function getName(){}



9) Multiple select/load is possible with:

a. checkbox
b. select
c. file
d. all of the above

10)State whether true or false

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

a. True
b. False

11) What is the output of the following code?

$a=500;
$b=200;
echo $a % 2 * $b;
?>

a. 100
b. 200
c. 500
d. 0
e. Syntax error


12) You need to heck the size of a file in php function .
$size=X(filename);

which function will suitable replace “X”?


a.Filesize
b.Size
c.sizeofFile
d.getSize

13) Which of the following is not true for a persistent connection?

a. these are not closed even after the execution of the script
b. these are mainly used to increase the efficiency of the system
c. these can’t be converted to non-persistent connections
d. these are preferable not used in the scripts involving transactions

14) 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.none of the above

15) Which will be the output of the following code?

$a=0.0;

For($i=0;$i<10;$i++)
$a+=0.1;
print “$a\n”;
if ($a==1.0)
print “equals”;
else
print “not equals”;
?>

a.0.9
Not Equals
b.1
Equals
c.1
not Equals
d.1.1

16) Which of the following attribute is needed for file upload via form?

a. Enctype=”multipart/form-date”
b. Enctype=”singlepart/date”
c. Enctype=”file”
d. Enctype=”form-data/file”

17) Late php versions support remote file accessing for the functions:

a. Include()
b. Include_once()
c. Require_once()
d. All of the above

18) Given below is a small php script:

class person {
function getSal()
{
……
……
}
}
class emp extends person {
fucniton getSal()
{
???
}
}
?>
the getSal() of emp has to behave exacltyle as getSal() of person . Which of the following lines of code would you use to replace the “???”?

a. Parent:: getSal();
b. Person::getSal();
c. Parent::getsal;
d. Person::getSal;

No comments:

Post a Comment