Saturday, July 04, 2015
 IT Quizzes Category

Search Web Link
Search Software
Quizzes Main Page    IT Quizzes    PHP Quiz

PHP Quiz

There are 29 questions in this quiz. Good luck!
Passing grade is 70% = C.
1) In PHP, arrays may be sorted with which of the following functions?
       a) uksort()
       b) arsort()
       c) ksort()
       d) All of the above

2) PHP comments for a single line have the following syntax:
       a) /* comments /*
       b) #
       c) //
       d) ::
       e) A&B

3) Which of the following functions are used by PHP to find out what type a variable is?
       a) gettype()
       b) is_double()
       c) get_type()
       d) is_date()
       e) A&B

4) The three possible connection states in PHP are ________.
       a) normal
       b) aborted
       c) timeout
       d) All of the above

5) In PHP, the error control operator is ________.
       a) *
       b) %
       c) @
       d) &

6) In PHP, instructions are terminated with a _______.
       a) ;
       b) #
       c) !
       d) %>

7) What does PHP stand for?
       a) PHP: Hypertext Preprocessor
       b) Personal Home Page
       c) Private Home Page
       d) Personal Hypertext Processor

8) PHP server scripts are surrounded by delimiters, which?
       a) <?php>...</?>
       b) <?php…?>
       c) <script>...</script>
       d) <&>...</&>

9) How do you write "Hello World" in PHP
       a) "Hello World";
       b) echo "Hello World";
       c) Document.Write("Hello World");
       d) response.write("Hello World")

10) All variables in PHP start with which symbol?
       a) !
       b) $
       c) &
       d) #

11) Include files must have the file extension ".inc"
       a) True
       b) False

12) In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
       a) True
       b) False

13) What is the correct way to include the file "" ?
       a) <!--include file=""-->
       b) <?php include_file(""); ?>
       c) <?php require(""); ?>
       d) <% include file="" %>

14) What is the correct way to create a function in PHP?
       a) function myFunction()
       b) new_function myFunction()
       c) create myFunction()

15) What is the correct way to connect to a MySQL database?
       a) mysql_open("localhost");
       b) connect_mysql("localhost");
       c) dbopen("localhost");
       d) mysql_connect("localhost");

16) What is the correct way to add 1 to the $count variable?
       a) count++;
       b) $count++;
       c) ++count
       d) $count =+1

17) PHP can be run on Microsoft Windows IIS(Internet Information Server):
       a) True
       b) False

18) In PHP 5, MySQL support is enabled by default:
       a) True
       b) False

19) Which one of these variables has an illegal name?
       a) $my-Var
       b) $myVar
       c) $my_Var

20) Which of the following regular expressions will match the string
       a) no?no?no
       b) no*no*no*
       c) ..\...\...
       d) \.\..\.\..\.\.

21) A constructor is a special kind of…
       a) Class
       b) Method
       c) Object
       d) Variable

22) What can you use to replace like with hate in I like Eminem?
       a) preg_replace("like", "hate", "I like Eminem")
       b) preg_replace("/like/", "hate", "I like Eminem")
       c) preg_replace("/like/", "/hate/", "I like Eminem")
       d) preg_replace("hate", "like", "I like Eminem")

23) What library do you need in order to process images?
       a) c-client library
       b) GIF/PNG library
       c) Image Library
       d) GD library

24) What is the problem with <?=$expression ?> ?
       a) It requires short tags and this is not compatible with XML
       b) There is no problem
       c) This syntax doesn't even exist It requires a special PHP library that may not always be available

25) What does break; do?
       a) Ends execution of the current switch structure
       b) Moves on to the next iteration of the current for, foreach, while, do-while or switch structure
       c) Ends execution of the current for, foreach, while, do-while or switch structure

26) Can this PHP code be valid: $4bears = $bears->getFirst4();
       a) Yes
       b) No

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

28) Put this line php display_errors=false in a .htaccess file when you deploy the application?
       a) 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
       b) That won't hide any error 'coz it's not the correct code
       c) Good idea, increases security

29) What does this function do: <?php function my_func($variable) {return (is_numeric($variable) && $variable % 2 == 0);}?>
       a) tests whether $variable is a number and ends in 2
       b) tests whether $variable ends in 2
       c) tests whether $variable is a number and contains 2
       d) tests whether $variable is an even number

Copyright © 2000 - 2013 Ex-designz. All rights reserved. Website Developed By Dexter Zafra of
Link to us | Advertisement | Contact us | Privacy Policy | Terms of use | Accessibility