20-November 2022
Training

PHP Interview Questions

..
PHP Interview Questions

PHP Interview Questions​​​​​

  1. PHP function is a piece of coda.
    1. That can be reused many time
    2. That can be used only once
    3. That can’t be used directly
    4. That can be used only at the initial level of the program
  2. PHP Functions
  1. Do not return a value                             c) delete the value
  2. Return a value                                           d) always multiply the value
  3. In PHP, we can define
  4. Conditional Function                              c) Recursive Function
  5. Function within Function                      d) All of the above
  6. The advantages of PHP functions are
  1. Code Reusability                                      c) Easy to understand
  2. Less code                                                    d) All of the above
  1. PHP Constants can be defined by
  1. Using define() function                         c) Both a and b
  2. Using const keyword                              d) None of the above   
  1. Which of the following function in PHP returns the time of sunrise of a particular day and location?
  1. date_sunrise()                                          b) date-sunrise()
  1. sunrise()                                                      d) None of the above
  1. Which PHP function converts an English text datetime into a Unix timestamp?
  1. str_to_time()                                            c) strtotime()
  2. strtodate()                                                  d) None of the above
  1. Which function is used to calculate the products of an array?
  1. array_product()                                        c) add_array_product()
  2. cal_array_product()                                d) save_array_product()
  1. What will be the output of the following program?

<?php   

$a = array(16, 5, 2); 

echo array_product($a); 

?> 

  1. 160                                                                 c) 80
  2. 1652                                                               d) 32
  1. Name of Scripting Engine in PHP?
  1.  SpiderMonkey
  2.  Zend Engine
  3.  VB Script
  4.  CS Script
  1. Which function is used for testing the type of PHP variable?
  1.  whattype()
  2.  showtype()
  3.  gettype()
  4.  settype()
  1. Variables always start with a _____ in PHP
  1.  Euro-sign
  2.  Pond-sign
  3.  Yen-sign
  4.  Dollar-sign
  1. ______ Symbol is a newline character.
  1. \n                                                   c. /n
  2. \r                                                    d. /r
  1. _______ Variable is not a predefined variable.
  1. $GET                                              c. $ASK
  2. $POST                                           d. $REQUEST  
  1. PHP is an example of _______ scripting language.
  1. Browser Side                             c. Server-Side
  2. Client Side                                   d. In-Side
  1. Which method sends input to a script via a URL?
  1. GET                                                                c. POST
  2. Both                                              d. None
  1. <?php

$x = 8;

$y = 8.0;

echo ($x === $y);

?>

  1. No output                                   c. 0
  2. 8===8                                           d. 1
  1. Which programming language does PHP resemble?
  1. JavaScript                                    c. Perl and C
  2. VBScript                                       d. All of the above
  1. Does PHP support multiple inheritances?
  1. Yes                                                 c. Single and Multiple inheritance are supported
  2. No                                                  d. single and Multi level inheritance are supported
  1. We can use multiple inheritance with the help of
  1. Using interfaces in PHP                         c. Both A and B
  2. Using traits instead of Classes            d. None of the above
  1. Correct syntax to write the php code within html is
  1. <?php echo $a;?>                                    c. <?php echo $a ?>
  2. <?php echo $a;>                                      d. <?php echo a;?
  1. Can PHP send or receive cookies?
  1. True                                                       c. PHP new version cannot but old can
  2. False                                                      d. PHP old version cant but new can
  1. The usage of strcmp() function in PHP is?
  1. To compare the strings excluding case
  2. To compare the uppercase strings
  3. To compare the lowercase strings
  4. To compare the strings including case
  1. The use of fopen() function in PHP is?
  1. To open folders in PHP
  2. To open remote server
  3. To open files in PHP
  4. None of the above
  1. The use of isset() function is ?
  1. To check whether variable is set or not
  2. To check whether the variable is free or not
  3. To check whether the variable is string or not
  4. None of the above
  1. Which of the following function is used to unset a variable in PHP?
  1. delete()                                                               c. unlink()
  2. unset()                                                 d. None of the above
  1. Which of the following function is used to sort an array in descending order?
  1. sort()                                                     c. dsort()
  2. asrot()                                                  d. rsort()
  1. Which of the following is/are the code editors in PHP?
  1. Notepad++                                         c. Adobe Dreamweaver
  2. Notepad                                              d. All of the above
  1. Which of the following is used to end a statement in PHP?
  1. . (dot)                                                   c. ! (exclamation)
  2. ; (semicolon)                                      d. / (slash)
  1. Which of the following function is used to get the ASCII value of a character in PHP?
  1. val()                                                       c. ascii()
  2. asc()                                                      d. chr()
  1. Which of the following function is used to find files in PHP?
  1. glob()                                                    c. file()
  2. fold()                                                     d. None of the above
  1. Which function is used to send mails in PHP?
  1. send_mail()                                        c. mail()
  2. mail_to()                                             d. share_mail()
  1. We can send the following thing using mail () function in PHP.
  1. Text Message                                    c. Attachment with Message
  2. HTML Message                                 d. All of the above
  1. The return type of mail function is
  1. String                                                     c. Integer
  2. Char                                                       d. Boolean
  1. $to in mail($to,$subject,$message,$header) refers to
  1. Receiver                                              c. Transmitter 
  2. Sender                                                                 d. None of the above
  1. Which form is inappropriate for specifying receiver or receivers of the mail?
  1. user@example.com
  2. user@example.com, anotheruser@example.com
  3. User <user@example.com>
  4. None of the above
  1. Which function is used to remove whitespaces and other predefined characters from both the sides of the string?
  1. trimmer();                                                   c) trim_str();
  2. trim();                                                           d) str_trim();
  1. What is the output of the program?

<?php 

define("MSG","Welcome to Inspiron Technologies",false); 

echo msg; 

?> 

  1. Welcome to Inspiron Technologies                  c) Use of undefined constant msg
  2. No Output                                                                  d) No of the above
  1. Which of the following function is used to compute the difference between two arrays in PHP?
  1. diff_array                                                                    c) arrays_diff
  2. array_diff                                                                    d) diff_arrays
  1. PHP parser is
  1. <?php           >                                                             c) <?php              ?
  2. <php             >                                                             d) <?php              ?>
  1. A cookie is used to
  1. Forget a user                                                             c) install the apps
  2. Identify a user                                                           d) brows the apps
  1. The scope of Cookie in PHP is
  1. Single Page                                                                 c) Multiple Pages
  2. Single Function                                                         d) Multiple Functions
  1. We can store only __________ in a cookie.
  1. Objects                                                                        c) Both A and B
  2. String                                                                            d) None of the above
  1. The maximum size of a cookie is
  1. 5096 bytes                                                                  c) 1096 bytes
  2. 4096 bytes                                                                  d) 1506 bytes
  1. The Initial size of the cookie is
  1. 100 bytes                                                  c) 20 bytes
  2. 50 bytes                                                    d) 70 bytes
  1. How many cookies can be created in one website or web app?
  1. 30 cookies                                                 c) 10 cookies
  2. 20 cookies                                                 d) 40 cookies
  1. By default, cookies are
  1. Temporary                                                                  c) saved in the browser only 
  2. Transitory                                                                    d) All of the above
  1. The include() function is used to
  1. Put data of one file into another file.              c) Browses data of a file.  
  2. Updates data of one file                          d) Counts data of a file.
  1. If errors occur while including a file into another file using include() function
  1. It stops the execution of the script        
  2. It does not given any warning  
  3. Produces a warning and continue to execute                          
  4. Neither error nor warning takes place.  
  1. The Require() function is used to
  1. Put data of one file into another file.              c) Browses data of a file. 
  2. Updates data of one file                          d) Counts data of a file.

Leave a comment

Your email address will not be published. Required fields are marked *