COMMON INTERVIEW QUESTIONS ASKED IN TCS (TATA CONSULTANCY SERVICES) BASED ON PHP WEB DEVELOPMENT CONCEPTS ALONG WITH THE ANSWERS(PART 1)

 

 COMMON INTERVIEW QUESTIONS ASKED IN TCS (TATA CONSULTANCY SERVICES) BASED ON PHP WEB DEVELOPMENT CONCEPTS ALONG WITH THE ANSWERS(PART 1)

Q1. Explain the difference between GET and POST requests?

Ans: The difference between GET and POST requests or rather you can say the difference between GET() method and POST() method are as follows :-

GET request (GET() Method) => GET request is not at all a secure method as the GET request is an unsecure method. GET request can sent the query string.

POST request (POST() Method) => POST request is the secure method. POST request cannot sent the query string.

Q2. What is a session in PHP? How does session work? 

Ans: Session in PHP is known as a globalcarrier of data which trace the user's activity on website.

                            Session work like it sends user information to the server.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Session is more secure. Session doesnot haveany limit. For Example: Login, Logout,Multipart Form.

Q3. What is the difference between sessions and cookies? 

Ans: The difference between session andcookies are as follows:

Cookies - Cookies is a small file sent by the server to the client machine through web browser which trace how long ago the user has visited the website. Cookies is used to sent the user information to the client machine. Cookies can sent data of 0-2048 bytes. Cookies is less secure. Cookies is known as global carrier of data. Real Life Example : Remember Me.

Session - Session is also known as global carrier of data which trace the user's activity on website. Session is used to sent the user's information on server. Session is more secure. Session doesn't have any limit. For example : Login, Logout, Multipart Form.

Q4. How does PHP handle user input from forms? 

Ans: PHP handle user input from forms by displaying submitted data. Which means that once the form is submitted, PHP process and display user inputs by using $_GET or $_POST superglobal variables, depends on the form method. For example:

<form action="formaction.php"></form> 

<form action="editaction.php"></form> 

Q5. Explain the concept of SQL Injection and how to prevent it.

Ans: SQL Injection is basically known as malfunction like on web application database the attackers or spammers inject sql query to hack or for malfunction. For example:

$sql="SELECT * FROM `users` WHERE `username`='$username';

which means $sql="SELECT * FROM `users` WHERE `username`='' OR '1'='1' which states that 1=1 which both are true, which returns all users to expose sensitive data.

To prevent SQL Injection, I need to use prepare statement which helps the users to protect from hackers or spammers to expose the user's sensitive data by attacking and by providing SQL Injection. For example:

$sql="SELECT * FROM `users` WHERE `username`='$username';

$query=$conn->prepare($sql). 

Comments

Popular posts from this blog

Programmings Based On Array And String Functions To Merge The 2 Arrays, Then After Merge Convert Into String And Then Find Out The 1st And Last Word From The Reverse String

PHP WEB DEVELOPMENT INTERVIEW QUESTIONS ASKED IN APOLLO HOSPITAL ALONG WITH MY OWN CONCEPTS AND MY OWN EXPLANATION ANSWERS(PART - 1) REST OF THE QUESTIONS AND ANSWERS WILL BE PREPARED BY ME IN MY NEXT BLOG

Mini Project On Multi User CRUD Operations(Create, Read, Update & Delete) Of Donar Details Of Indian Nationals Who Donate To Ramkrishna Math, Belur Math Using PDO (PHP Data Objects) With Proper Explanation Of Each And Every Individual Line Of The Code Of connection.php Page, form.php Page, formaction.php Page, admin_display.php Page, client_display.php Page, edit.php Page, editaction.php Page And delet.php Page (Here You Will Find The Image Of Sayang Sri Ramkrishna Dev, Sayang Sri Ma Sarada Devi & Sayang Sri Swami Vivekananda) In My CRUD Operation