0% found this document useful (0 votes)
63 views5 pages

Viva Questions Web Tech

The document provides a comprehensive set of viva questions and answers covering various web development technologies including HTML, CSS, JavaScript, PHP, XML, Servlets, and JSP. Each section outlines key concepts, differences, and functionalities relevant to each technology. This resource serves as a study guide for individuals preparing for interviews or assessments in web development.

Uploaded by

rorariw821
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)
63 views5 pages

Viva Questions Web Tech

The document provides a comprehensive set of viva questions and answers covering various web development technologies including HTML, CSS, JavaScript, PHP, XML, Servlets, and JSP. Each section outlines key concepts, differences, and functionalities relevant to each technology. This resource serves as a study guide for individuals preparing for interviews or assessments in web development.

Uploaded by

rorariw821
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

Viva Questions and Answers for HTML, CSS, JavaScript, PHP, XML, Servlet, JSP

📄 HTML Viva Questions and Answers

1. What is HTML?
HTML (HyperText Markup Language) is the standard language used to create webpages. It
structures the content using elements and tags.

2. What are HTML tags and elements?


Tags are predefined keywords surrounded by angle brackets like <p> . Elements are complete
structures like <p>Hello</p> .

3. What is the difference between <div> and <span> ?


<div> is a block-level element, whereas <span> is an inline element.

4. What are semantic elements in HTML5? Give examples.


Semantic elements clearly describe their meaning. Examples: <header> , <footer> ,
<article> , <section> .

5. How is HTML different from XHTML?


HTML is flexible with syntax, while XHTML is strict and XML-based.

6. What are the different types of lists in HTML?


Ordered List ( <ol> ), Unordered List ( <ul> ), Description List ( <dl> ).

7. How do you create a hyperlink in HTML?


Using <a href="url">Link Text</a> .

8. What is the use of the alt attribute in an image tag?


It provides alternative text if the image fails to load.

9. Difference between id and class attributes?


id is unique per element; class can be reused for multiple elements.

10. What is the purpose of the <form> tag? Name different input types.
<form> is used to collect user input. Input types include: text, password, checkbox, radio, submit,
etc.

📄 CSS Viva Questions and Answers

1. What is CSS and why is it used?


CSS (Cascading Style Sheets) is used to style HTML elements like colors, layouts, and fonts.

1
2. Difference between inline, internal, and external CSS?
Inline: in the tag, Internal: in <style> , External: in .css file.

3. What is the Box Model in CSS?


The Box Model includes: content, padding, border, and margin.

4. What is specificity in CSS?


It determines which rule is applied when there are conflicts. Based on selector types.

5. Position values: relative, absolute, fixed, sticky?

6. Relative: moves relative to normal position.


7. Absolute: positioned relative to nearest positioned ancestor.
8. Fixed: relative to the viewport.

9. Sticky: toggles between relative and fixed.

10. Difference between id and class selectors?


#id targets a specific element; .class can apply to many.

11. What is z-index ?


Controls stacking order of overlapping elements.

12. How to create responsive design using CSS?


Use media queries, flexible grids, and relative units.

13. Difference between em , rem , and % ?


em : relative to parent, rem : relative to root, % : relative to container.

14. What are pseudo-classes and pseudo-elements?

15. Pseudo-classes: :hover , :focus


16. Pseudo-elements: ::before , ::after

📄 JavaScript Viva Questions and Answers

1. What is JavaScript?
A scripting language used to make web pages interactive.

2. Variables: var , let , const ?

3. var : function-scoped, can be re-declared.


4. let : block-scoped.

5. const : block-scoped, cannot be reassigned.

2
6. JavaScript data types?
String, Number, Boolean, Object, Undefined, Null, Symbol, BigInt.

7. Difference between == and === ?


== : compares value only.
=== : compares value and type.

8. What is DOM?
Document Object Model; a tree-like structure representing HTML elements.

9. Functions and declaration?


Function syntax: function name() { }

10. What is an event?


Actions like click, mouseover, etc. Handled using addEventListener() .

11. What is hoisting?


JavaScript moves declarations to the top of the scope during compilation.

12. null vs undefined ?


null : intentional absence of value. undefined : variable declared but not assigned.

13. What is an array?


A collection of items. Can be looped using for , forEach , map , etc.

📄 PHP Viva Questions and Answers

1. What is PHP?
A server-side scripting language used for web development.

2. GET vs POST?
GET sends data via URL; POST sends data securely in the body.

3. How to connect PHP to MySQL?


Using mysqli_connect() or PDO .

4. What are sessions and cookies?


Sessions store user data on the server; cookies on the client.

5. include() vs require() ?
include() gives a warning on failure; require() stops execution.

6. Handling forms in PHP?


Use $_POST or $_GET to access submitted form data.

3
7. Superglobals?
Predefined variables like $_GET , $_POST , $_SESSION , $_SERVER , etc.

8. Error handling in PHP?


Using try-catch , error_reporting() , set_error_handler() .

9. Fetch data from database?

10. Connect using mysqli_connect()


11. Query with mysqli_query()

12. Fetch rows using mysqli_fetch_assoc()

13. What is $GLOBALS , $_SERVER , $_REQUEST ?

14. $GLOBALS : access global variables anywhere.


15. $_SERVER : server/environment info.
16. $_REQUEST : combines $_GET , $_POST , and $_COOKIE .

📄 XML Viva Questions and Answers

1. What is XML?
XML (eXtensible Markup Language) stores and transports data.

2. XML vs HTML?
HTML is for display; XML is for data storage/transfer.

3. Purpose of XML?
Platform-independent way of sharing structured data.

4. Well-formed XML?
Follows correct syntax: one root element, closing tags, quoted attributes.

5. DTD vs XML Schema?


Both define structure. Schema is more powerful and supports data types.

6. Can XML be used for transport?


Yes, commonly used in web services and APIs.

7. XML element/attribute rules?


Tags must be properly nested and closed. Names must not start with numbers.

8. CDATA sections?
Used to include text with characters like < or & without parsing.

4
9. Root element?
A single top-level element enclosing all others.

10. Multiple root elements?


Not allowed. Only one root element per XML document.

🔹 Servlet Viva Questions and Answers (Minimal)

1. What is a servlet?
Java program that runs on a server and handles client requests.

2. GET vs POST in servlet?


doGet() for data retrieval, doPost() for data submission.

3. Lifecycle of servlet?
init() → service() → destroy()

4. What are doGet() and doPost() ?


Methods to handle GET and POST HTTP requests.

🔹 JSP Viva Questions and Answers (Minimal)

1. What is JSP?
Java Server Pages; allows embedding Java code in HTML for dynamic web content.

2. JSP vs Servlet?
JSP is easier to write, mainly HTML-based. Servlet is pure Java.

3. What are scriptlets?


Java code written inside <% %> in JSP.

4. What are directives?


Instructions to the JSP engine, e.g., <%@ page %> , <%@ include %> .

You might also like