Thursday, April 28, 2011

oDesk PHP Test Answers


  oDesk PHP Test Answers

 Advice.- Some of the things that you gotta have in mind before applying for a oDesk test is that even though right now you have the answer sheet information provided by this blog, the questions during the test might appear in a random sequence, therefore is always advisable to first read the whole post of questions & answer in order to be prepare for the test and finished it in less time, that way you will not only pass the test but maybe reach one of the top 10% or 20% contractors whom have taken this test.
 
Good luck on the test, let me know if there are any mistakes in the post with the spelling or answers.

 Question 1
The setrawcookie() method of setting cookie is different from php standard method of cookie setting as :
  1. It does not allow expiry time to be set
  2. It can be used only once
  3. It does not url- ENCODE the value on its own
  4. It does not allow domain setting

Question 2

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

  1. True
  2. False

Question 3

Which of the following is not a valid php connection status?
  1. Aborted
  2. Normal
  3. Open
  4. Timeout

Question 4

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

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

Question 5
What will be the result of following operation?
Print 4<<5;

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

Question 6

Which of the following type cast in not correct?

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

  1. real
  2. double
  3. decimal
  4. boolean

Question 7

What is the result of the following expression?

5+2*4+6
  1. 70
  2. 19
  3. 34
  4. 21

Question 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(){}

Question 9

Multiple select/load is possible with:
  1. checkbox
  2. select
  3. file
  4. all of the above

Question 10

State whether true or false

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

a.       True
b.      False

Question 11

What is the output of the following code?

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

  1. 100
  2. 200
  3. 500
  4. 0
  5. Syntax error

Question 12

You need to heck the size of a file in php function .
$size=X(filename);
which function will suitable replace “X”?

  1. Filesize
  2. Size
  3. sizeofFile
  4. getSize


Question 14
Which of the following is not true for a persistent connection?

  1. these are not closed even after the execution of the script
  2. these are mainly used to increase the efficiency of the system
  3. These can’t be converted to non-persistent connections
  4. These are preferable not used in the scripts involving transactions

Question 15

Which one is correct?

  1. $s=fwrite(“a string here”);
  2. $s=fwrite($fp,”a string here”);
  3. $s=fwrite(“a string here ”,$fp);
  4. none of the above

Question 16
Which of the following in not a correct way of printing text in php 5

a.       echo “plain text”
?>
b.     
c.      
d.      <#
echo “plain text”
#>

Question 17

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”;
?>
  1. 0.9
Not Equals
  1. 1
Equals
  1. 1
not Equals
  1. 1.1

Question 18

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

  1. Enctype=”multipart/form-date”
  2. Enctype=”singlepart/date”
  3. Enctype=”file”
  4. Enctype=”form-data/file”

Question 19

Late php versions support remote file accessing for the functions:

  1. Include()
  2. Include_once()
  3. Require_once()
  4. All of the above

Question 20

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 “???”?

  1. Parent:: getSal();
  2. Person::getSal();
  3. Parent::getsal;
  4. Person::getSal;

No comments:

Post a Comment