Basic PHP Quiz - 1

Basic PHP Quiz - 1

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

In PHP, arrays may be sorted with which of the following functions?

  1. uksort()
  2. arsort()
  3. ksort()
  4. All of the above
Question 2 Multiple Choice (Single Answer)

PHP comments for a single line have the following syntax:

  1. /* comments /*
  2. #
  3. //
  4. ::
  5. A&B
Question 3 Multiple Choice (Single Answer)

Which of the following functions are used by PHP to find out what type a variable is?

  1. gettype()
  2. is_double()
  3. get_type()
  4. is_date()
  5. A&B
Question 4 Multiple Choice (Single Answer)

The three possible connection states in PHP are ________.

  1. normal
  2. aborted
  3. timeout
  4. All of the above
Question 5 Multiple Choice (Single Answer)

In PHP, the error control operator is ________.

  1. *
  2. %
  3. @
  4. &
Question 6 Multiple Choice (Single Answer)

In PHP, instructions are terminated with a _______.

  1. ;
  2. #
  3. !
  4. %>
Question 7 Multiple Choice (Single Answer)

What does PHP stand for?

  1. PHP: Hypertext Preprocessor
  2. Personal Home Page
  3. Private Home Page
  4. Personal Hypertext Processor
Question 8 Multiple Choice (Single Answer)

PHP server scripts are surrounded by delimiters, which?

  1. <?php>...</?>
  2. <?php…?>
  3. <script>...</script>
  4. <&>...</&>
Question 9 Multiple Choice (Single Answer)

How do you write "Hello World" in PHP

  1. "Hello World";
  2. echo "Hello World";
  3. Document.Write("Hello World");
  4. response.write("Hello World")
Question 10 Multiple Choice (Single Answer)

All variables in PHP start with which symbol?

  1. !
  2. $
  3. &
  4. #
Question 11 Multiple Choice (Single Answer)

A constructor is a special kind of…

  1. Class
  2. Method
  3. Object
  4. Variable
Question 12 Multiple Choice (Single Answer)

What can you use to replace like with hate in I like Eminem?

  1. preg_replace("like", "hate", "I like Eminem")
  2. preg_replace("/like/", "hate", "I like Eminem")
  3. preg_replace("/like/", "/hate/", "I like Eminem")
  4. preg_replace("hate", "like", "I like Eminem")
Question 13 Multiple Choice (Single Answer)

What library do you need in order to process images?

  1. c-client library
  2. GIF/PNG library
  3. Image Library
  4. GD library
Question 14 Multiple Choice (Single Answer)

What is the problem with <?=$expression ?> ?

  1. It requires short tags and this is not compatible with XML
  2. There is no problem
  3. This syntax doesn't even exist It requires a special PHP library that may not always be available
Question 15 Multiple Choice (Single Answer)

What does break; do?

  1. Ends execution of the current switch structure
  2. Moves on to the next iteration of the current for, foreach, while, do-while or switch structure
  3. Ends execution of the current for, foreach, while, do-while or switch structure
Question 16 Multiple Choice (Single Answer)

Can this PHP code be valid: $4bears = $bears->getFirst4();

  1. Yes
  2. No
Question 17 Multiple Choice (Single Answer)

Assuming all the variables a, b, c have already been defined, could this be a variable name: ${$a}[$b][$c] ?

  1. Yes
  2. No
Question 18 Multiple Choice (Single Answer)

Put this line php display_errors=false in a .htaccess file when you deploy the application?

  1. That won't hide any error 'coz you can't use .htaccess to control the PHP engine Bad idea, I want to see when errors occur
  2. That won't hide any error 'coz it's not the correct code
  3. Good idea, increases security
Question 19 Multiple Choice (Single Answer)

What does this function do:

<?php 
function my_func($variable) {
    return (is_numeric($variable) && $variable % 2 == 0);
}
?>
  1. tests whether $variable is a number and ends in 2
  2. tests whether $variable ends in 2
  3. tests whether $variable is a number and contains 2
  4. tests whether $variable is an even number