Terms Of PHP Test Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By BrokenTrack
B
BrokenTrack
Community Contributor
Quizzes Created: 1 | Total Attempts: 1,046
Questions: 15 | Attempts: 1,046

SettingsSettingsSettings
Terms Of PHP Test Quiz - Quiz

How far goes your knowlegde in the terms of PHP?


Questions and Answers
  • 1. 

    pHP is client sided.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given statement is incorrect. PHP is a server-side scripting language, not a client-sided one. It is primarily used for generating dynamic web pages and handling server-side tasks such as interacting with databases, processing form data, and generating HTML content to be sent to the client's browser. The client-side refers to the execution of code on the user's browser, which is typically done using languages like JavaScript. Therefore, the correct answer is False.

    Rate this question:

  • 2. 

    Which data can you track with pHP only? Choose all options that apply.

    • A.

      Mac adress

    • B.

      IP adress

    • C.

      User agent

    • D.

      Refferal url

    • E.

      Screen resolution

    Correct Answer(s)
    B. IP adress
    C. User agent
    D. Refferal url
    Explanation
    With PHP, you can track the IP address of the user visiting your website. The IP address can provide information about the user's location and can be used for various purposes such as tracking user activity or implementing security measures. Additionally, PHP can also track the user agent, which refers to the web browser and operating system being used by the visitor. This information can be helpful for optimizing the website's design and functionality. Lastly, PHP can track the referral URL, which indicates the website or page from which the user originated before landing on your site. This can be useful for analyzing traffic sources and understanding user behavior. However, PHP cannot directly track the MAC address or screen resolution of the user's device.

    Rate this question:

  • 3. 

    You can execute Linux commands with php on a Linux based server.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    This statement is true because PHP is a server-side scripting language that can be used to execute commands on a Linux based server. PHP has built-in functions and libraries that allow developers to interact with the operating system and execute Linux commands. This capability is particularly useful for tasks such as file manipulation, system administration, and server management. Therefore, it is possible to execute Linux commands using PHP on a Linux based server.

    Rate this question:

  • 4. 

    (int) $i = 1; (int) $j = 2; list($i,$j) = array($j,$i); echo $i; What will be the output?

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    Correct Answer
    B. 2
    Explanation
    The code initializes two variables, $i with the value of 1 and $j with the value of 2. Then, it uses the list() function to assign the values of $j and $i to $i and $j respectively, effectively swapping their values. Finally, it echoes the value of $i, which is now 2. Therefore, the output will be 2.

    Rate this question:

  • 5. 

    class Animal { public function makeNoise() { echo 'Some kind of noise'; } } class Cat extends Animal { public function makeNoise() { echo 'Meow'; } } $cat = new Cat(); $cat->makeNoise(); What will be the output?

    • A.

      Some kind of noise

    • B.

      Meow

    • C.

      This will give an error

    Correct Answer
    B. Meow
    Explanation
    The output will be "Meow" because the makeNoise() method in the Cat class overrides the makeNoise() method in the Animal class. When the makeNoise() method is called on the $cat object, it will execute the makeNoise() method in the Cat class, which echoes "Meow".

    Rate this question:

  • 6. 

    class Animal { public final function makeNoise() { echo 'Some kind of noise'; } } class Cat extends Animal { public function makeNoise() { echo 'Meow'; } } $cat = new Cat(); $cat->makeNoise(); What will be the output?

    • A.

      Some kind of noise

    • B.

      Meow

    • C.

      This will give an error

    Correct Answer
    C. This will give an error
    Explanation
    The given code will give an error. This is because the makeNoise() function in the Animal class is declared as final, which means it cannot be overridden in the child class. However, in the Cat class, the makeNoise() function is trying to override the function in the parent class. Since it is not allowed, an error will occur.

    Rate this question:

  • 7. 

    Check the ones that are incorrect.

    • A.

      $1var;

    • B.

      $var_____;

    • C.

      $v123456789;

    • D.

      $var-iable;

    • E.

      $variäble;

    Correct Answer(s)
    A. $1var;
    D. $var-iable;
    E. $variäble;
    Explanation
    The question asks to identify the incorrect variables among the given options. The correct answer is "$1var;,$var-iable;,$variäble;". This is because variable names cannot start with a number or contain special characters like hyphens or umlauts. Therefore, "$1var;", "$var-iable;", and "$variäble;" are all invalid variable names.

    Rate this question:

  • 8. 

    $string = null; if($string === '') { echo 'It works!'; } What will be the output?

    • A.

      It works!

    • B.

      There won't be an output!

    • C.

      This will give an error.

    Correct Answer
    B. There won't be an output!
    Explanation
    The code checks if the variable $string is identical to an empty string. However, the variable $string is set to null, not an empty string. Therefore, the condition will not be true and the code inside the if statement will not be executed. As a result, there won't be any output.

    Rate this question:

  • 9. 

    class Animal { private $noise = 'Some kind of noise'; public function makeNoise() { echo self::$noise . ' ; woof woof'; } } $animal = new Animal(); $animal->makeNoise(); What will be the output?

    • A.

      Some kind of noise

    • B.

      Some kind of noise ; woof woof

    • C.

      There won't be an output

    • D.

      This will give an error

    Correct Answer
    D. This will give an error
  • 10. 

    How do you browse through an array?

    • A.

      While(array_browse($array) as $key => $value) {}

    • B.

      Foreach($array as $key => $value) {}

    • C.

      Array_browse($array as $key => $value) {}

    Correct Answer
    B. Foreach($array as $key => $value) {}
    Explanation
    The correct answer is "foreach($array as $key => $value) {}". This is because the foreach loop is specifically designed for iterating over arrays. It allows you to access each element of the array one by one, assigning the key and value of each element to variables ($key and $value in this case). This loop structure is commonly used for looping through arrays and performing operations on each element.

    Rate this question:

  • 11. 

    You can make images with php.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    PHP is a server-side scripting language that can generate dynamic content. It has built-in functions and libraries that allow developers to create and manipulate images. With PHP, you can create, edit, and manipulate images by using various functions and libraries like GD or ImageMagick. Therefore, the statement "You can make images with PHP" is true.

    Rate this question:

  • 12. 

    You can decrypt a string made by the md5() method.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The statement is false because the md5() method is a one-way hash function, which means it is designed to be irreversible. It is used for generating a unique hash value for a given input string, but it cannot be decrypted to obtain the original string. Therefore, it is not possible to decrypt a string made by the md5() method.

    Rate this question:

  • 13. 

    You can make a zip with php.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In PHP, the "zip" extension allows you to create, open, and extract files from ZIP archives. This extension provides functions to create a new ZIP file, add files to an existing ZIP file, and extract files from a ZIP file. Therefore, it is possible to make a zip with PHP, making the answer "True" correct.

    Rate this question:

  • 14. 

    What is a constructor if you are talking about object orientated programming?

    • A.

      A function within php that creates php code.

    • B.

      A pre-defined name of a function that is as first called when initializing an object of that class.

    • C.

      A method which can create classes.

    • D.

      A function that can change classes while executing.

    Correct Answer
    B. A pre-defined name of a function that is as first called when initializing an object of that class.
    Explanation
    A constructor is a pre-defined name of a function that is called first when initializing an object of a class in object-oriented programming. It is responsible for initializing the object's state and performing any necessary setup tasks.

    Rate this question:

  • 15. 

    Is the function preg_replace() or a similar one required to make ubb code?

    • A.

      Yes

    • B.

      No

    Correct Answer
    B. No
    Explanation
    No, the function preg_replace() or a similar one is not required to make UBB code. UBB code is a simple text formatting language that uses tags enclosed in square brackets to format text. It can be implemented using basic string manipulation functions like str_replace() or even with regular expressions. The preg_replace() function is commonly used for more complex pattern matching and replacement tasks, but it is not necessary for basic UBB code implementation.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Aug 01, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 24, 2011
    Quiz Created by
    BrokenTrack
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.