Showing posts with label PHP web development questions. Show all posts
Showing posts with label PHP web development questions. Show all posts

Thursday, 25 September 2014


Hello everyone...!!!
PHP technical interview Questions And answers for PHP developers, PHP programming multiple choice questions,


I got too many mails in my Inbox about why i didn't provide PHP test Questions yesterday as every Thursday.. Sorry Guys i was not able to do that.

That's why today i am here with PHP Questions.But today i have changed something, No theory only technical questions which will help you to prepare for technical interviews and will also enhance the web development skills of PHP developers.

Here we go....

PHP Questions 

 

Que.1 What will be the output of the following PHP code ?

<?php

$i = 0;

for ($i)

{

print $i;

}

?>

a) 0
b) infinite loop
c) no output
d) error




Que.2 . What will be the output of the following PHP code ?


<?php

$a = "1";

switch($a)

{

case 1:

break;

print "hi";

case 2:

print "hello";

break;

default:

print "hi1";

}

?>

a) hihellohi1
b) no output
c) hihi1
d) hi1



Que.3 What will be the output of the following PHP code ?


<?php

$x = 0;

if ($x == 1)

if ($x >= 0)

print "true";

else

rint "false";

?>

a) true
b) false
c) error
d) No output



Que.4 What will be the output of the following PHP code ?


<?php

$i = 0;

while ($i = 10)

{

print "hi";

}

print "hello";

?>

a) hello
b) infinite loop
c) hihello
d) error


Que.5 What will be the output of the following PHP code ?


<?php

for ($x = 0; $x <= 10; print ++$x)

{

print ++$x;

}

?>

a) 123456789101112
b) 12345678910
c) 1234567891011
d) infinite loop


Que.6 What will be the output of the following PHP code ?


<?php

switch($b)

{

case 2:

print "hello";

break;

case 1:

print "hi";

break;

}

?>

a) hello
b) hi
c) no output
d) error


Que.7 . What will be the output of the following PHP code ?


<?php

$i = 5;

while (--$i > 0 && ++$i)

{

print $i;

}

?>

a) 5
b) 555555555…infinitely
c) 54321
d) error


Que.8 What will be the output of the following PHP code ?


<?php

$a = 1;

if (echo $a)

print "True";

else

print "False";

?>

a) true
b) false
c) error
d) No output


Que.9 What will be the output of the following PHP code ?


<?php

for ($i++; $i == 1; $i = 2)

print "In for loop ";

print "After loop\n";


?>

a) In for loop
b) After for loop
c) In for loopAfter for loop
d) infinite loop


Que. 10 What will be the output of the following PHP code ?


<?php

$a = "a";

if ($a)

print "all";

else

print "some";

?>

a) all
b) some
c) error
d) no output


Answer-sheet of these questions will be available Tomorrow

For more questions CLICK THE LINKS BELOW


Share your experience or any suggestion with us .. VIA COMMENTS



Wednesday, 16 July 2014

Hello Friends ..


Today is Thursday, and as you know every Thursday we have  weekly test for PHP developers.... conducted by M2 Software Solutions

 

PHP test, PHP web development questions


 Here We go..

Que. 1. Which of the following is/are true for an abstract class?

 i) A class is declared abstract by prefacing the definition with the word abstract.

ii) A class is declare abstract by using the keyword implements.

iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.


iv) Attempting to instantiate an abstract class results in an error.


a) Only ii)
b) All of the mentioned
c) ii) and iv)
d) ii), iii) and iv)



Que. 2. If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?


a) Normal class
b) Static class
c) Abstract class
d) Interface



Que. 3. If your object must inherit behavior from a number of sources you must use a/an


a) Interface
b) Object
c) abstract class
d) static class



Que. 4. Which method is used to tweak an object’s cloning behavior?


a) clone()
b) __clone()
c) _clone

d) object_clone()



Que. 5. Which feature allows us to call more than one method or function of the class in single instruction?


a) Typecasting
b) Method Including
c) Method adding
d) Method chaining


Que. 6. Which magic method is used to implement overloading in PHP?


a) __call
b) __invoke
c) __wakeup
d) __unset


Que. 7. Which one of the following statements is true ?

  1. class CopyMe {}
  2. $first = new CopyMe();
  3. $second = $first;
a) In PHP 4: $second and $first are 2 distinct objects
b) In PHP 5: $second and $first are 2 distinct objects
c) In PHP 4: $second and $first refer to one object
d) None of the above





Que. 8. What will be the output of the following PHP code?

  1. class Checkout {
  2.     final function totalize() {
  3.         // calculate bill
  4.     }
  5. }
  6.  
  7. class IllegalCheckout extends Checkout {
  8.     final function totalize() {
  9.         // change bill calculation
  10.     }
  11. }
a) PHP Fatal error: Class Illegal Checkout may not inherit from final class
b) Value of the bill calculated
c) PHP Fatal error: Cannot find object
d) PHP Fatal error: Cannot override final method





Que. 9. __clone() is run on the ___ object.


a) original
b) pseudo
c) external
d) copied




Que. 10. Which keyword is used to put a stop on inheritance?


a) stop
b) end
c) break
d) final


Answer-sheet of this test will be available tomorrow...

Share your experience with us.. and give your suggestions in comments


Regards : M2 Software solutions












  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube