Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Upcoming SlideShare
Loading in...5
×
 

Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology

on

  • 4,936 views

FNT Software Solutions Pvt Ltd Placement Papers

FNT Software Solutions Pvt Ltd Placement Papers

Statistics

Views

Total Views
4,936
Views on SlideShare
4,936
Embed Views
0

Actions

Likes
0
Downloads
24
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology Document Transcript

  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview QuestionsPHP Interview Questions:1. Whats PHP?The PHP Hypertext Preprocessor is a programming language that allows web developers to createdynamic content that interacts with databases. PHP is basically used for developing web based softwareapplications.2. How can we know the number of days between two given dates using PHP?$date1 = date(Y-m-d);$date2 = 2006-07-01;$days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24);echo "Number of days since 2006-07-01: $days";3. How do you define a constant?define ("MYCONSTANT", 100);4. What is meant by urlencode and urldecode?urlencode() returns the URL encoded version of the given string. URL coding converts special charactersinto % signs followed by two hex digits.For example:urlencode("10.00%") will return "10%2E00%25". URL encoded strings are safe to be used as part ofURLs.urldecode() returns the URL decoded version of the given string.5. How To Get the Uploaded File Information in the Receiving Script?Uploaded file information is organized in $_FILES as a two-dimensional array as:$_FILES[$fieldName][name] - The Original file name on the browser system.$_FILES[$fieldName][type] - The file type determined by the browser.$_FILES[$fieldName][size] - The Number of bytes of the file content.$_FILES[$fieldName][tmp_name] - The temporary filename of the file in which the uploaded file wasstored on the server.$_FILES[$fieldName][error] - The error code associated with this file upload.
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview Questions6. What is the difference between mysql_fetch_object and mysql_fetch_array?MySQL fetch object will collect first single matching record where mysql_fetch_array will collect allmatching records from the table in an array7. How do you pass a variable by value?Just like in C++, put an ampersand in front of it, like $a = &$b.8. How can we send mail using JavaScript?No. There is no way to send emails directly using JavaScript.But you can use JavaScript to execute a client side email program send the email using the "mailto"code. Here is an example:function myfunction(form){tdata=document.myform.tbox1.value;location="mailto:mailid@domain.com?subject=...";return true;}9. What is the difference between ereg_replace() and eregi_replace()?eregi_replace() function is identical to ereg_replace() except that it ignores case distinction whenmatching alphabetic characters.10. How do I find out the number of parameters passed into function ?func_num_args() function returns the number of parameters passed in.11. Are objects passed by value or by reference?Everything is passed by value.12. What are the differences between DROP a table and TRUNCATE a table?DROP TABLE table_name - This will delete the table and its data.TRUNCATE TABLE table_name - This will delete the data of the table, but not the table definition.
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview Questions13. How do you call a constructor for a parent class?parent::constructor($value)14. How can we submit a form without a submit button?If you dont want to use the Submit button to submit a form, you can use normal hyper links to submit aform. But you need to use some JavaScript code in the URL of the link.<a href="javascript: document.myform.submit();">Submit Me</a>15. How can we extract string abc.com from a string http://info@abc.com using regular expressionof php?We can use the preg_match() function with "/.*@(.*)$/" as the regular expression pattern.For example:preg_match("/.*@(.*)$/","http://info@abc.com",$data);echo $data[1];16. What is the difference between the functions unlink and unset?unlink() is a function for file system handling. It will simply delete the file in context.unset() is a function for variable management. It will make a variable undefined.17. What is the difference between characters 047 and x47?The first one is octal 47, the second is hex 47.18. How can we create a database using PHP and mysql?We can create MySQL database with the use of mysql_create_db($databaseName) to create a database.19. How can we destroy the session, how can we unset the variable of a session?session_unregister() - Unregister a global variable from the current sessionsession_unset() - Free all session variables20. How can we know the count/number of elements of an array?a) sizeof($array) - This function is an alias of count()
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview Questionsb) count($urarray) - This function returns the number of elements in an array.Interestingly if you just pass a simple var instead of an array, count() will return 121. How many values can the SET function of MySQL take?MySQL SET function can take zero or more values, but at the maximum it can take 64 values.22. What are the other commands to know the structure of a table using MySQL commands exceptEXPLAIN command?DESCRIBE table_name;23. How can we find the number of rows in a table using MySQL?SELECT COUNT(*) FROM table_name;24. How can we find the number of rows in a result set using PHP?$result = mysql_query($any_valid_sql, $database_link);$num_rows = mysql_num_rows($result);echo "$num_rows rows found";25. What is the difference between CHAR and VARCHAR data types?CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than ncharacters to that column. For example, "Hello!" will be stored as "Hello! " in CHAR(10) column.VARCHAR is a variable length data type. VARCHAR(n) will take only the required storage for the actualnumber of characters entered to that column. For example, "Hello!" will be stored as "Hello!" inVARCHAR(10) column.26. What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?mysql_fetch_array - Fetch a result row as an associative array and a numeric array.mysql_fetch_object - Returns an object with properties that correspond to the fetched row and movesthe internal data pointer ahead. Returns an object with properties that correspond to the fetched row,or FALSE if there are no more rowsmysql_fetch_row() - Fetches one row of data from the result associated with the specified resultidentifier. The row is returned as an array. Each result column is stored in an array offset, starting atoffset 0.
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview Questions27. What is the difference between htmlentities() and htmlspecialchars()?htmlspecialchars() - Convert some special characters to HTML entities (Only the most widely used)htmlentities() - Convert ALL special characters to HTML entities28. How can we get the properties (size, type, width, height) of an image using php image functions?image size use getimagesize() functionimage width use imagesx() functionimage height use imagesy() function29. How can we increase the execution time of a php script?By the use of void set_time_limit(int seconds)30. What are the difference between abstract class and interface?Abstract class: abstract classes are the class where one or more methods are abstract but notnecessarily all method has to be abstract. Abstract methods are the methods, which are declare in itsclass but not define. The definition of those methods must be in its extending class.Interface: Interfaces are one type of class where all the methods are abstract. That means all themethods only declared but not defined. All the methods must be define by its implemented class.31. What is the maximum size of a file that can be uploaded using PHP and how can we change this?change maximum size of a file set upload_max_filesize variable in php.ini file32. Explain the ternary conditional operator in PHP?Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed,otherwise, the expression following : is executed.33. What’s the difference between include and require?It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt theexecution of the script. If the file is not found by include(), a warning will be issued, but execution willcontinue.34. How many ways can we get the value of current session id?session_id() returns the session id for the current session.35. What is the difference between $message and $$message?
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview QuestionsThey are both variables. But $message is a variable with a fixed name. $$message is a variable whosname is stored in $message. For example, if $message contains "var", $$message is the same as $var.36. How can we get the browser properties using php?<?phpecho $_SERVER[HTTP_USER_AGENT] . "nn";$browser = get_browser(null, true);print_r($browser);?>37. How can we know that a session is started or not?A session starts by session_start()function.this session_start() is always declared in header portion.it always declares first.thenwe write session_register().38. What is the use of obj_start()?Its intializing the object buffer, so that the whole page will be first parsed (instead of parsing in parts andthrown to browser gradually) and stored in output buffer so that after complete page is executed, it isthrown to the browser once at a time.39. What is the difference between Split and Explode?split()-used for JavaScript for processing the string and the explode()-used to convert the String to Array,implode()-used for convert the array to StringHere the Example<?php$x="PHP is a ServerSide Scripting Language";$c=explode(" ",$x);print_r($c);$d=implode(" ",$c);echo "
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview Questions".$d;?>Javascript Example:list($month, $day, $year) = split([/.-], $date);40. Which will execute faster on php POST or GET?Both are same while performing the action but using POST security is there.Because using GET method in the action, form field values send along with URL, so at the time ofsending password, problem will occur means password also will shown in the URL.Using of POST there is no problem.GET method has a limit of sending parameters 100 characters but POST method does not have a limit ofsending dataGET is faster than POST. Because GET fetch the data directly from the URL but POST method fetch theencrypted data from the page.41. What is the use of sprintf() function?The sprintf() function writes a formatted string to a variable.42. What Is a Session?Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a completefunctional transaction for the same visitor.43. What is the use of header() function in php?The header() function is used for redirect the page.if you want to redirect one page to another we canuse it.44. How can i get ip address?REMOTE_ADDR - the IP address of the clientREMOTE_HOST - the host address of the client45. What is htaccess?.htaccess files (or "distributed configuration files") provide a way to make configuration changes on aper-directory basis.
  • FNT Software Solutions Pvt Ltd, Bangalore PHP Interview Questions46. What is the diffrence between Notify URL and Return URL?Notify URL is used to just notify the status while processing.Return URL is used to return after processing.47. What is the difference between ucfirst and ucwords?ucfirst() to convert the first letter of every string to uppercase, and ucwords(), to convert the first letterof every word in the string to uppercase.48. What is meant by nl2br()?nl2br() inserts a HTML tag <br> before all new line characters n in a string.49. How To Read the Entire File into a Single String?<?php$file = file_get_contents("/windows/system32/drivers/etc/services");print("Size of the file: ".strlen($file)."n");?>50. What are the different functions in sorting an array?Sorting functions in PHP:asort()arsort()ksort()krsort()uksort()sort()natsort()rsort()