0% found this document useful (0 votes)
54 views

Web Development using PHP Viva question

Web development using PHP viva questions and answers

Uploaded by

Saidd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Web Development using PHP Viva question

Web development using PHP viva questions and answers

Uploaded by

Saidd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Here are the top 30 important viva questions on Web Development using PHP with concise

answers:

Basic PHP Questions:

1. What is PHP?

PHP (Hypertext Preprocessor) is a server-side scripting language for web development.

2. How does PHP differ from other scripting languages?

It runs on the server, supports embedding within HTML, and is open-source.

3. What are PHP variables?

Variables store data and start with a $ symbol (e.g., $name).

4. What are superglobals in PHP?

Predefined variables like $_GET, $_POST, $_SESSION, and $_COOKIE.

5. Explain PHP data types.

Common types include string, integer, float, boolean, array, object, and NULL.

6. What is the use of echo and print?

Both output data; echo is faster and can take multiple arguments.

7. What are PHP sessions?

Sessions maintain user data across multiple pages.

8. What are PHP cookies?


Cookies store data on the client side for persistent state management.

9. What is the difference between include() and require()?

require() stops execution on error; include() gives a warning and continues.

10. What is the purpose of isset() and empty()?

isset() checks if a variable is set; empty() checks if it's empty.

Advanced PHP Concepts:

11. What are PHP arrays?

Data structures to store multiple values (indexed, associative, or multidimensional).

12. How is error handling done in PHP?

Using try-catch blocks, error_reporting(), and custom error handlers.

13. What is PDO in PHP?

PHP Data Objects provide a database access abstraction layer.

14. How can you prevent SQL injection?

Use prepared statements and parameterized queries.

15. What is the difference between GET and POST methods?

GET appends data to the URL; POST sends data in the request body (more secure).
16. What is the purpose of header() in PHP?

It sends raw HTTP headers to the browser.

17. How does file handling work in PHP?

Functions like fopen(), fread(), fwrite(), and fclose() are used.

18. What is the difference between == and === in PHP?

== compares values; === compares both value and type.

19. What are traits in PHP?

Traits allow reusing methods across multiple classes without inheritance.

20. What are magic methods in PHP?

Special methods like __construct(), __destruct(), __get(), etc., for specific behaviors.

Web Integration Questions:

21. How do you send emails in PHP?

Using mail() or libraries like PHPMailer.

22. How do you handle form validation in PHP?

Validate using PHP filters (filter_var()) and sanitization functions.

23. What are PHP frameworks?


Examples include Laravel, CodeIgniter, and Symfony for faster development.

24. What is AJAX in PHP?

Asynchronous JavaScript and XML allows updating parts of a page without reloading.

25. What is cURL in PHP?

A library for making HTTP requests.

26. What is the role of JSON in PHP?

JSON (JavaScript Object Notation) is used to exchange data; PHP functions like
json_encode() and json_decode() handle it.

27. How do you handle file uploads in PHP?

Using $_FILES superglobal with methods like move_uploaded_file().

28. How do sessions differ from cookies?

Sessions store data on the server, cookies on the client.

29. How do you implement pagination in PHP?

Divide data into chunks and use SQL LIMIT and OFFSET queries.

30. What is the significance of htaccess in PHP?

.htaccess controls server configurations like URL rewriting and restricting access.
These questions and answers should help during an MCA viva on PHP-based web
development.

You might also like