Tuesday, August 13, 2013

PHP MCQ with answers solved

1. What does PHP stand for?

a) Personal Home Pages
b) Private Home Page
c) Personal Hypertext Processor
d) Hypertext Pre-processor            

Ans : d


2. PHP server scripts are surrounded by delimiters, which?

a) <?php>...</?>
b)<?php…?>
c) <&>...</&>
d) <script>...</script>              

Ans : b


3. How do you write "Hello World" in PHP?
a) "Hello World";
b) echo "Hello World";
c) Document.Write("Hello World");  
    
Ans : b


4. All variables in PHP start with which symbol?

a) $
b) !
c) &      
       
Ans : a


5. What is the correct way to end a PHP statement?

a) </php>  
b) New line
c) ;    
d) .        
 
Ans : c


6. The PHP syntax is most similar to:

a) Perl and C
b) JavaScript
c) VBScript

Ans : a


7. How do you get information from a form that is submitted using the "get" method?

a) Request.Form;
b) Request.QueryString;
c) $_GET[];                  

Ans : c


8.When using the POST method, variables are displayed in the URL:

a) True
b) False                  

Ans : b


9.In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

a) True
b) False                  

Ans : a


10.Include files must have the file extension ".inc"

a) False
b) True                    

Ans : b


11.What is the correct way to include the file "time.inc" ?

a) <!--include file="time.inc"-->
b) <% include file="time.inc" %>
c) <?phpinclude_file("time.inc"); ?>
d) <?php require("time.inc"); ?>            

Ans : d


12.What is the correct way to create a function in PHP?

a) createmyFunction()
b) new_functionmyFunction()
c) functionmyFunction()
d) None of these                

Ans : c


13.What is the correct way to open the file "time.txt" as readable?

a) fopen("time.txt","r");b) open("time.txt");
c) fopen("time.txt","r+");  d) open("time.txt","read");        

Ans : a


14.PHP allows you to send emails directly from a script

a) True
b) False                    

Ans : a


15.What is the correct way to connect to a MySQL database?

a) dbopen("localhost");
b) mysql_open("localhost");
c) mysql_connect("localhost");
d) connect_mysql("localhost");              

Ans:c


16.What is the correct way to add 1 to the $count variable?

a) $count++;
b) count++;
c) $count =+1
d) ++count                  

Ans: a


17.What is a correct way to add a comment in PHP?

a) /*…*/
b) <!--…-->
c) *\..\*
d) <comment>…</comment>              

Ans : a


18.PHP can be run on Microsoft Windows IIS(Internet Information Server):

a) False
b) True                    

Ans : b


19.In PHP, the die() and exit() functions do the exact same thing.

a) False
b) True                    

Ans : b


20.Which one of these variables has an illegal name?

a) $my-Var
b) $myVar
c) $my_Var
d) None of these                

Ans : a

9 comments:

  1. tks bạn, cố gắn đăng thêm nữa cho mọi người cùng xem

    ReplyDelete
  2. "Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.php jobs in hyderabad.
    "

    ReplyDelete
  3. All the questions have been Copied from w3school

    ReplyDelete