PHP & MySQL

20 Questions | Attempts: 499
Share

SettingsSettingsSettings
PHP Quizzes & Trivia

This test is for checking your ability to join ITP/Web Development


Questions and Answers
  • 1. 

    What is the difference between DROP a table and TRUNCATE a table ?

  • 2. 

    What are the different types of errors in php ?

  • 3. 

    How many times will the function counter() be executed in the following code? function counter($start, &$stop) { if ($stop > $start) { return; } counter($start--, ++$stop); } $start = 5; $stop = 2; counter($start, $stop);

    • A.

      3

    • B.

      4

    • C.

      5

    • D.

      6

    Correct Answer
    C. 5
  • 4. 

    When a class is defined as final it:

    • A.

      Can no longer be extended by other classes.

    • B.

      Means methods in the class are not over-loadable.

    • C.

      Cannot be defined as such, final is only applicable to object methods.

    • D.

      Is no longer iteratable.

    Correct Answer
    A. Can no longer be extended by other classes.
  • 5. 

    What is the maximum size of the VARCHAR column type?

    • A.

      255 Bytes

    • B.

      255 Characters

    • C.

      512 Bytes

    • D.

      512 Characters

    • E.

      No Limit

    Correct Answer
    B. 255 Characters
  • 6. 

    What is the output of the following code? [code] class test { public $value = 0; function test() { $this->value = 1; } function __construct() { $this->value = 2; } } $object = new test(); echo $object->value;

    • A.

      2

    • B.

      1

    • C.

      0

    • D.

      3

    • E.

      No Output, PHP will generate an error message.

    Correct Answer
    A. 2
  • 7. 

    Which of the following data types cannot be directly manipulated by the client?

    • A.

      Cookie Data

    • B.

      Session Data

    • C.

      Remote IP address

    • D.

      User Agent

    Correct Answer
    B. Session Data
  • 8. 

    Which of the following statements is correct?

    • A.

      Interfaces can extend only one interface

    • B.

      Interfaces can extend more than one interface

    • C.

      Interfaces can inherit a method from different interfaces

    • D.

      Interfaces can redeclare inherited methods

    Correct Answer
    B. Interfaces can extend more than one interface
  • 9. 

    What super-global should be used to access information about uploaded files via a POST request?

    • A.

      $_SERVER

    • B.

      $_ENV

    • C.

      $_POST

    • D.

      $_FILES

    • E.

      $_GET

    Correct Answer
    D. $_FILES
  • 10. 

    Which of the following statements about PHP is true? (Choose 3)

    • A.

      A final class can be derived.

    • B.

      A final class may be instantiated.

    • C.

      A class with a final function may be derived.

    • D.

      Static functions can be final.

    • E.

      Properties can be final.

    Correct Answer(s)
    B. A final class may be instantiated.
    C. A class with a final function may be derived.
    D. Static functions can be final.
  • 11. 

    What is the output of the following code? $first = "second"; $second = "first"; echo

    • A.

      First

    • B.

      Second

    • C.

      An empty string

    • D.

      An error

    Correct Answer
    B. Second
  • 12. 

    What is the output of the following code? <?php for ($i = 0; $i < 1.02; $i += 0.17) { $a[$i] = $i; } echo count($a); ?>

    • A.

      0

    • B.

      1

    • C.

      2

    • D.

      6

    • E.

      7

    Correct Answer
    B. 1
  • 13. 

    What is the output of the following script? <?php function fibonacci (&$x1 = 0, &$x2 = 1){   $x1 = $x2;   $x2 = $result;   return $result; } for ($i = 0; $i < 10; $i++) {    echo fibonacci() . ','; } ?>

    • A.

      An error

    • B.

      1,1,1,1,1,1,1,1,1,1,

    • C.

      1,1,2,3,5,8,13,21,34,55,

    • D.

      Nothing

    Correct Answer
    B. 1,1,1,1,1,1,1,1,1,1,
  • 14. 

    What is the difference between "print" and "echo" ?

    • A.

      There is no difference

    • B.

      Print returns length of data printed and echo does not

    • C.

      Echo returns length of the data printed and print does not

    • D.

      Print buffers the output, while echo does not

    Correct Answer
    B. Print returns length of data printed and echo does not
  • 15. 

    In the function setcookie() what does the 3rd prameter specify?

    • A.

      The name of the cookie.

    • B.

      The expiration time of the cookie.

    • C.

      The value of the cookie.

    • D.

      The IP address of the cookie's client.

    Correct Answer
    B. The expiration time of the cookie.
  • 16. 

    Given the following array: $a = array(28, 15, 77, 43); Which function will remove the value 28 from $a?

    • A.

      Array_shift()

    • B.

      Array_pop()

    • C.

      Array_push()

    • D.

      Array_unshift()

    Correct Answer
    A. Array_shift()
  • 17. 

    Where does the session extension store the session data by default?

    • A.

      SQLite Database

    • B.

      MySQL Database

    • C.

      Shared Memory

    • D.

      File system

    • E.

      Session Server

    Correct Answer
    D. File system
  • 18. 

    How can we submit form without submit button ?

    • A.

      Using XML

    • B.

      Using Javascript

    • C.

      Using Cookie

    • D.

      Using button

    Correct Answer
    B. Using Javascript
  • 19. 

    You have a variable $test that contains sub-strings divided by a dash ("-"). How can you put every sub-string into an array element easily?

    • A.

      Extract($test, "-");

    • B.

      Explode("-", $test);

    • C.

      To_array($test, "-");

    • D.

      Explode($test, "-");

    Correct Answer
    B. Explode("-", $test);
  • 20. 

    What will the $array array contain at the end of this script? <?php function modifyArray (&$array){    foreach ($array as &$value){       $value = $value + 1;    }    $value = $value + 2;  } $array = array (1, 2, 3); modifyArray($array); ?>

    • A.

      2, 3, 4

    • B.

      2, 3, 6

    • C.

      4, 5, 6

    • D.

      1, 2, 3

    Correct Answer
    B. 2, 3, 6

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jan 30, 2013
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 08, 2011
    Quiz Created by
    Ibrahimmomani
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.