• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PHP Interview Questions Answers

Question - 21 : - What is the purpose of the following files having extensions: frm, myd, and myi? What these files contain?

Answer - 21 : - In MySQL, the default table type is MyISAM. Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. The '.frm' file stores the table definition. The data file has a '.MYD' (MYData) extension. The index file has a '.MYI' (MYIndex) extension, If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b? 100, it’s a reference to existing variable.

Question - 22 : - Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.\nHow are you?\nThanks for visiting techpreparation’; print $str; ?>

Answer - 22 : - Because inside the single quotes the \n character is not interpreted as newline, just as a sequence of two characters - \ and n.

Question - 23 : - How can we submit a form without a submit button?

Answer - 23 : - If you don't want to use the Submit button to submit a form, you can use normal hyper links to submit a form. But you need to use some JavaScript code in the URL of the link. For example: <a href="javascript: document.myform.submit();">Submit Me</a>

Question - 24 : - How can we know the number of days between two given dates using MySQL?

Answer - 24 : - Use DATEDIFF() SELECT DATEDIFF(NOW(),'2006-07-01');  

Question - 25 : - Check if a variable is an integer in JAVASCRIPT ?

Answer - 25 : - var myValue =9.8; if(parseInt(myValue)== myValue) alert('Integer'); else alert('Not an integer'); Tools used for drawing ER diagrams. Case Studio Smart Draw

Question - 26 : - What are the differences between require and include, include_once?

Answer - 26 : - 1) - require_once() and include_once() are both the functions to include and evaluate the specified file only once. If the specified file is included previous to the present call occurrence, it will not be done again. But require() and include() will do it as many times they are asked to do. 2) - The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. The major difference between include() and require() is that in failure include() produces a warning message whereas require() produces a fatal errors. 3) - All three are used to an include file into the current page. If the file is not present, require(), calls a fatal error, while in include() does not. The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. It des not call a fatal error if file not exists. require_once() does the same as include_once(), but it calls a fatal error if file not exists. 4)  - File will not be included more than once. If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once(). This will prevent problems with function redefinitions, variable value reassignments, etc.

Question - 27 : - How can I load data from a text file into a table?

Answer - 27 : - The MySQL provides a LOAD DATA INFILE command. You can load data from a file. Great tool but you need to make sure that: a) Data must be delimited b) Data fields must match table columns correctly

Question - 28 : - What are the functions for IMAP?

Answer - 28 : - imap_body - Read the message body imap_check - Check current mailbox imap_delete - Mark a message for deletion from current mailbox imap_mail - Send an email message

Question - 29 : - What is the difference between GROUP BY and ORDER BY in SQL?

Answer - 29 : - To sort a result, use an ORDER BY clause. The most general way to satisfy a GROUP BY clause is to scan the whole table and create a new temporary table where all rows from each group are consecutive, and then use this temporary table to discover groups and apply aggregate functions (if any). ORDER BY [col1],[col2],...[coln]; Tells DBMS according to what columns it should sort the result. If two rows will have the same value in col1 it will try to sort them according to col2 and so on. GROUP BY [col1],[col2],...[coln]; Tells DBMS to group (aggregate) results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average.

Question - 30 : - How can we know that a session is started or not?

Answer - 30 : - A session starts by session_start() function. This session_start() is always declared in header portion. it always declares first. then we write session_register().

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners