WT Viva Questions
WT Viva Questions
HTML
1. What is HTML?
HTML stands for HyperText Markup Language. It is the standard language used to create and design the
structure of web pages.
body {
background-image: url("image.jpg");
}
14. What is the use of iframe tag?
The <iframe> tag is used to embed another HTML page within the current page. It can be used to embed videos,
maps, or other web content.
15. What are the different new form element types in HTML 5?
HTML5 introduced new input types like email, url, tel, date, number, range, color, and more to improve form
functionality.
16. Is there any need to change the web browsers to support HTML5?
Most modern browsers already support HTML5, so no major changes are required. However, outdated
browsers may not fully support all features.
1. New Semantic Elements: These help organize and give meaning to the structure of a web page.
• type="email"
• type="url"
• type="tel"
• type="number"
• type="range"
• type="date", datetime-local, month, week, time
• type="color"
• type="search"
3. New Form Attributes: These make form validation and interaction better.
• placeholder
• required
• autocomplete
• pattern
• min, max, step
• <audio>
• <video>
• <source>
• <track>
5. Graphics:
6. New APIs (used via JavaScript): These are not "tags" but are part of HTML5.
• Geolocation API
• Drag-and-Drop API
• Web Storage (localStorage and sessionStorage)
• History API
Media queries are a feature of CSS (Cascading Style Sheets) that allow you to apply different styles to a web
page depending on the device’s characteristics — such as screen size, resolution, orientation, and more.
• To make websites responsive (look good on all devices: phones, tablets, desktops).
• To adapt layout and content for different screen sizes or device capabilities.
CSS
p{
color: red;
}
h1 {
font-size: 30px;
}
div p {
color: green;
}
.title {
font-weight: bold;
}
p.title {
color: blue;
}
#main {
background-color: yellow;
}
div#main {
padding: 20px;
}
ul > li {
list-style: square;
}
30. What is an attribute selector?
It selects elements based on the presence or value of attributes.
Example:
input[type="text"] {
border: 1px solid black;
}
p[lang] {
color: red;
}
This selects all <p> elements that have a lang attribute, regardless of its value.
33. Explain:
1. Internal CSS
CSS written inside <style> tag in the <head> section of the HTML file.
Useful for single-page styling.
<style>
h1 { color: red; }
</style>
2. External CSS
CSS is written in a separate .css file and linked using <link>.
Great for large or multiple pages.
3. Inline CSS
CSS written directly inside an HTML tag using the style attribute.
Used for quick styling.
The window object is the global object for the browser. It represents the browser window and provides
methods like alert(), setTimeout(), and open().
41. How to write comment in JavaScript?
Single-line comment: // This is a comment
Multi-line comment: /* This is
a multi-line comment */
42. How to create function in JavaScript?
function greet() {
alert("Hello!");
}
43. What are the JavaScript data types?
let person = {
name: "John",
age: 30
};
45. How to create array in JavaScript?
let fruits = ["Apple", "Banana", "Mango"];
46. Difference between Client-side JavaScript and Server-side JavaScript?
Client-side JavaScript runs in the browser, used for UI interaction and DOM manipulation.
Server-side JavaScript runs on the server (e.g., Node.js) and handles backend logic like database interaction.
47. In which location cookies are stored on the hard disk?
Cookies are stored by the browser in a specific location on the user's system, managed internally per
browser and OS. The exact path varies (e.g., Chrome stores them in a local SQLite database).
48. What is the difference between Internal & External JavaScript?
Internal JavaScript is written inside the HTML file within <script> tags.
External JavaScript is stored in a separate .js file and linked using the src attribute in a <script> tag.
JSON:-
49. What is JSON?
JSON stands for JavaScript Object Notation. It is a lightweight data format used for storing and exchanging
data between a server and a web application.
50. Explain what are JSON objects?
A JSON object is a collection of key-value pairs. The keys are strings, and the values can be strings, numbers,
booleans, arrays, other objects, or null.
Example:
{
"name": "Alice",
"age": 25
}
51. Explain how to transform JSON text to a JavaScript object?
You use the built-in function JSON.parse().
Example:
XML stands for eXtensible Markup Language. It is used to store and transport data in a structured, platform-
independent, and human-readable format.
• Self-descriptive structure
• Platform and language independent
• Custom tags can be created
• Supports Unicode
• Easily readable by humans and machines
XML DOM (Document Object Model) represents the entire structure of an XML document as a tree of objects.
It allows programs to read, modify, delete, or add elements to the XML file.
An attribute provides additional information about an XML element, usually in name-value pairs.
Example: <book genre="fiction">Harry Potter</book>
61. What are the advantages of XML Schema over DOM Document?
• XML Schema defines the structure, data types, and constraints for XML documents
• Stronger validation of data
• Written in XML syntax itself
• Supports data types and namespaces, unlike DTD
An XML element is a fundamental part of XML and represents a piece of data enclosed by a start tag and an end
tag.
Example: <name>John</name>
CDATA stands for Character Data. It tells the parser to treat the content inside it as text only, not as markup.
Example: <![CDATA[<greeting>Hello</greeting>]]>
XML comments are written like this: <!-- This is a comment -->
Namespaces prevent naming conflicts in XML when combining elements from different vocabularies. Defined
using xmlns.
Example:
<book xmlns:fiction="http://example.com/fiction">
<fiction:title>Harry Potter</fiction:title>
</book>
67. What is XSL?
XSL stands for eXtensible Stylesheet Language. It is used for transforming and presenting XML documents,
usually into HTML or other formats using XSLT.
An XML Schema defines the structure and rules for an XML document, including element names, data types,
and relationships. It’s more powerful and flexible than a DTD.
jQuery:-
69. What is jQuery?
jQuery is a fast, small, and feature-rich JavaScript library that simplifies things like HTML document
traversal, event handling, animation, and Ajax. It provides an easy-to-use API that works across different
browsers.
• JavaScript is the core programming language used to build dynamic web pages.
• jQuery is a JavaScript library that simplifies JavaScript code for common tasks, making it shorter and
easier to write.
No, jQuery is not a replacement for JavaScript. It is a library that simplifies JavaScript code. You still need to
understand JavaScript fundamentals to use jQuery effectively.
No, jQuery is not a W3C standard. It is a third-party JavaScript library developed by a community of
developers and not governed by the W3C (World Wide Web Consortium).
• Include the jQuery library in your HTML file, either by downloading and linking it or by using a CDN
(Content Delivery Network).
Only one object of a servlet is created by the Servlet container. This single instance handles all requests
concurrently using multiple threads.
The web container (Servlet container) is responsible for creating the servlet object.
The servlet object is created only once when the first request is received, or when the servlet is loaded on
startup, depending on configuration.
Session Tracking is a technique used to maintain state or identify a user across multiple requests. Techniques
include cookies, URL rewriting, hidden fields, and HttpSession.
JSP:-
86. What is JSP?
JSP stands for JavaServer Pages. It is a server-side technology that allows the creation of dynamic, platform-
independent web content using Java and HTML.
88. What is the difference between hide comment and output comment?
• Hide Comment (<%-- comment --%>): Not visible in client’s view source
• Output Comment (<!-- comment -->): Visible in the HTML source sent to the browser
1. <jsp:useBean>
2. <jsp:setProperty>
3. <jsp:getProperty>
<%
// Java code here
%>
93. What are JSP declarations?
Used to declare variables and methods that are used later in the JSP file.
Syntax: <%! int count = 0; %>
Directives provide global information to the JSP engine about the page.
Syntax: <%@ directive attribute="value" %>
JSP actions are special tags used to control behavior of the JSP engine.
Examples:
• <jsp:useBean>
• <jsp:include>
• <jsp:forward>
It defines global information like content type, import statements, session usage etc.
Example: <%@ page language="java" contentType="text/html" %>
Scripting elements let you insert Java code into your JSP:
PHP
102. What is PHP?
PHP stands for Hypertext Preprocessor. It is a server-side scripting language designed for web
development and can also be used as a general-purpose programming language.
PHP originally stood for Personal Home Page, but it now stands for PHP: Hypertext Preprocessor (a
recursive acronym).
GET POST
Sends data via URL Sends data in HTTP body
Limited data length No limit on data size
Less secure More secure
Can be bookmarked Cannot be bookmarked
Visible data in URL Hidden data
• include gives a warning if the file is not found but continues execution.
• require gives a fatal error and halts execution if the file is not found.
• for loop
• while loop
• do...while loop
• foreach loop
Superglobals are built-in variables in PHP that are accessible anywhere. Examples include:
• $_GET
• $_POST
• $_SESSION
• $_COOKIE
• $_FILES
• $_SERVER
• $_ENV
• $_REQUEST
• $GLOBALS
AJAX:-
• Complex debugging
• SEO issues
• JavaScript dependency
121. What are the real web applications of AJAX currently running?
Gmail, Google Maps, Facebook, Twitter.
• JavaScript
• XML/JSON
• DOM
• XMLHttpRequest
• readyState
• status
• responseText
• responseXML
• open()
• send()
• setRequestHeader()
• jQuery AJAX
• Axios
• Angular HTTP
• React Query
AngularJS:-
• MVC architecture
• Directives
• Data binding
• Dependency Injection
Node.js
• Web servers
• APIs
• Real-time applications (chat, gaming)
• Streaming services
• High scalability
• Fast execution
• Non-blocking I/O
• Asynchronous (non-blocking)
• Synchronous (blocking)
Web Services:-
• Interoperability
• Reusability
• Platform-independent
• Strong standards
• High security
• Reliable messaging
EJB:-
• Session Bean
• Entity Bean
• Message-Driven Bean
1. Instantiation
2. Dependency Injection
3. Callbacks (like PostConstruct)
4. Business Methods Execution
5. Destruction
• Simplified development
• Transaction management
• Security
• Scalability
Spring:-
• Lightweight
• Loose coupling (through Dependency Injection)
• Easy integration with other frameworks
• Declarative transaction management
• Core
• AOP (Aspect-Oriented Programming)
• Data Access (JDBC, ORM)
• Web MVC
• Security
• Boot (for rapid development)
Bootstrap:-
Struts:-
• MVC Architecture
• Tag Libraries
• Validation Framework
• Internationalization support
• User submits form → Controller (ActionServlet) receives request → Model (business logic) → View (JSP)
response.
• Create project
• Configure struts.xml
• Create Action classes
• Create JSPs
• Deploy and run on server
Ruby on Rails
• Object-Oriented
• Dynamic Typing
• Garbage Collection
• Exception Handling
• Mixins instead of multiple inheritance
Example:
196. Explain with example, keyboard input and screen output functions in Ruby.
Example:
def greet(name)
"Hello, #{name}!"
end
puts greet("Ruby")
Example: