0% found this document useful (0 votes)
11 views22 pages

WT Viva Questions

This document provides a comprehensive overview of HTML, CSS, JavaScript, JSON, XML, and jQuery, covering key concepts, tags, and functionalities. It includes explanations of various elements, attributes, and differences between technologies, as well as practical examples and best practices for web development. The content is structured as a series of questions and answers, making it a useful resource for learners and developers.

Uploaded by

Aditya Barve
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)
11 views22 pages

WT Viva Questions

This document provides a comprehensive overview of HTML, CSS, JavaScript, JSON, XML, and jQuery, covering key concepts, tags, and functionalities. It includes explanations of various elements, attributes, and differences between technologies, as well as practical examples and best practices for web development. The content is structured as a series of questions and answers, making it a useful resource for learners and developers.

Uploaded by

Aditya Barve
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/ 22

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.

2. What are Tags?


Tags are the building blocks of HTML. They define how content should be displayed on a webpage. Tags are
enclosed in angle brackets, like <p> or <div>.

3. Do all HTML tags have end tag?


No, not all HTML tags have end tags. Some tags are self-closing, like <img>, <br>, and <hr>.

4. What is the difference between HTML elements and tags?


A tag is part of an element. For example, <p> is a tag, but an element includes both the opening and closing tags
and the content between them, like <p>This is a paragraph</p>.

5. How to insert a copyright symbol on a browser page?


We can use the HTML entity &copy; to display the copyright symbol (©).

6. How do you keep list elements straight in an HTML file?


We use indentation to keep list elements organized and readable, even though it doesn’t affect rendering.
Proper use of <ul>, <ol>, and <li> tags is also important.

7. Does a hyperlink only apply to text?


No, hyperlinks can also be applied to images, buttons, or even other HTML elements using the <a> tag with the
href attribute.

8. What is a style sheet?


A style sheet defines how HTML elements should be displayed. CSS (Cascading Style Sheets) is used to apply
styles like color, layout, and fonts to HTML content.

9. Can you create a multi-colored text on a web page?


Yes, using CSS we can assign different colors to different parts of the text by wrapping them in tags like <span>
and styling them individually.

10. Is it possible to change the color of the bullet?


Yes, bullet color can be changed by using CSS. For example, setting color on the <li> element or using a custom
image as a bullet.

11. What is a marquee?


A marquee is an HTML tag <marquee> used to create scrolling text or images. However, it's deprecated and not
recommended in modern web development.

12. How many tags can be used to separate section of texts?


There are several: <div>, <section>, <article>, <header>, <footer>, and <aside> are commonly used to separate
and structure content.

13. How to make a picture a background image of a web page?

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.

17. Things which are in html5 and not in html

1. New Semantic Elements: These help organize and give meaning to the structure of a web page.

<header>, <footer>, <section>, <article>, <aside>, <nav>

2. New Form Input Types: HTML5 introduced smarter form fields.

• 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

4. Multimedia Tags: Before HTML5, multimedia needed plugins like Flash.

• <audio>
• <video>
• <source>
• <track>

5. Graphics:

• <canvas> – for 2D drawing using JavaScript.


• <svg> – scalable vector graphics (was supported in HTML4 via XML, but HTML5 natively integrates it).

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

7. Doctype Simplification: <!DOCTYPE HTML>


18. What are media queries?

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.

A media query is a rule that tells the browser:


“If the device matches this condition, apply these styles.”

Why use Media Queries?

• To make websites responsive (look good on all devices: phones, tablets, desktops).
• To adapt layout and content for different screen sizes or device capabilities.

@media (max-width: 768px) {


body {
background-color: lightgreen;
}
}

CSS

19. What is CSS?


CSS stands for Cascading Style Sheets. It is used to describe the presentation and layout of HTML elements on a
web page.

20. What are advantages of using CSS?

• Separation of content and design


• Reusability – one CSS file can style multiple pages
• Faster loading – cleaner HTML code
• Easier maintenance
• Responsive design support

21. What are the components of a CSS Style?


A CSS rule has 3 parts:

• Selector – targets the HTML element


• Property – what you want to change (e.g., color)
• Value – the setting (e.g., red)
Example:

p{
color: red;
}

22. What is type selector?


A type selector targets an HTML tag directly.
Example:

h1 {
font-size: 30px;
}

23. What is universal selector?


The universal selector * applies styles to all elements on the page.
Example:
*{
margin: 0;
padding: 0;
}

24. What is Descendant Selector?


It targets elements inside other elements, even deeply nested.
Example:

div p {
color: green;
}

This styles all <p> tags inside <div>s.

25. What is class selector?


It selects elements by the value of their class attribute, using a dot (.).
Example:

.title {
font-weight: bold;
}

26. Can you make a class selector particular to an element type?


Yes.
Example:

p.title {
color: blue;
}

This only applies to <p> elements with class title.

27. What is id selector?


An ID selector targets an element by its unique id using a hash (#).
Example:

#main {
background-color: yellow;
}

28. Can you make an id selector particular to an element type?


Yes.
Example:

div#main {
padding: 20px;
}

This applies only to <div> with id="main".

29. What is a child selector?


It selects elements that are direct children of another element using > symbol.
Example:

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;
}

31. How to select all paragraph elements with a lang attribute?

p[lang] {
color: red;
}

This selects all <p> elements that have a lang attribute, regardless of its value.

32. Explain types of CSS


There are three types:

1. Inline CSS – inside HTML elements using style attribute


2. Internal CSS – within <style> tag in the HTML <head>
3. External CSS – in a separate .css file linked using <link>

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.

<link rel="stylesheet" href="style.css">

3. Inline CSS
CSS written directly inside an HTML tag using the style attribute.
Used for quick styling.

<p style="color: green;">Hello</p>

34. What is JavaScript?


JavaScript is a scripting language used to create dynamic and interactive content on web pages. It runs in the
browser and allows for features like form validation, animations, and DOM manipulation.
35. What is the difference between JavaScript and JScript?
JavaScript is the standard language developed by Netscape, while JScript is Microsoft’s proprietary version
of JavaScript for Internet Explorer. Both are similar but may differ in browser-specific features.

36. How to write a Hello World example of JavaScript?


<script>
alert("Hello, World!");
</script>
37. How to use external JavaScript file?
Save the JavaScript code in a .js file and link it using the <script> tag with src attribute:
<script src="script.js"></script>
38. Is JavaScript case sensitive language?
Yes, JavaScript is case sensitive. For example, document and Document are different.
39. What is DOM? What is the use of document object?
DOM stands for Document Object Model. It represents the structure of a web page as a tree. The document
object lets you access and manipulate elements on the page using JavaScript.
40. What is the use of window object?

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?

JavaScript has the following data types:


Primitive: String, Number, Boolean, Null, Undefined, Symbol, BigInt
Non-primitive: Object, Array, Function
44. How to create objects in JavaScript?

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:

let obj = JSON.parse('{"name":"Alice","age":25}');


52. Why must one use JSON over XML?

• JSON is simpler and easier to read/write


• It's faster to parse
• JSON is natively supported in JavaScript
• It results in less data overhead compared to XML

53. Mention what is the file extension of JSON?


The file extension for JSON files is .json
54. Mention which function is used to convert a JSON text into an object?

The function used is JSON.parse()


55. Mention what are the data types supported by JSON?
JSON supports the following data types: String, Number, Boolean, Null, Object, Array
XML:-

56. What is XML?

XML stands for eXtensible Markup Language. It is used to store and transport data in a structured, platform-
independent, and human-readable format.

57. What are the features of XML?

• Self-descriptive structure
• Platform and language independent
• Custom tags can be created
• Supports Unicode
• Easily readable by humans and machines

58. What are the differences between HTML and XML?

Feature HTML XML


Purpose Display data Store & transport data
Tags Predefined User-defined
Closing Tags Optional for some tags Mandatory
Case Sensitivity Not case sensitive Case sensitive
Structure Loosely structured Strictly structured
59. What is XML DOM Document?

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.

60. What is an attribute?

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

62. What are the basic rules while writing XML?

• One root element


• Properly nested and closed tags
• Tags are case-sensitive
• Attribute values must be in quotes
• No overlapping tags

63. What is XML Element?

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>

64. What is CDATA?

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>]]>

65. How comment can be represented in XML?

XML comments are written like this: <!-- This is a comment -->

66. What are XML Namespaces?

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.

68. What is XML Schema?

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.

70. Why do we use jQuery?

• To simplify JavaScript coding


• To easily manipulate DOM elements
• To handle events like clicks and mouse movements more easily
• To create animations and effects without much effort
• For easy integration with AJAX for asynchronous requests
• It ensures cross-browser compatibility.

71. How JavaScript and jQuery are different?

• 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.

72. Is jQuery a replacement of JavaScript?

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.

73. Is jQuery a W3C standard?

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).

74. What is the basic need to start with jQuery?

To start using jQuery:

• Include the jQuery library in your HTML file, either by downloading and linking it or by using a CDN
(Content Delivery Network).

Example using CDN: <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

After that, you can use jQuery in your <script> tags.


75. How many objects of a servlet is created?

Only one object of a servlet is created by the Servlet container. This single instance handles all requests
concurrently using multiple threads.

76. What is the life-cycle of a servlet?

The life-cycle of a servlet consists of the following steps:

1. Loading and instantiation


2. Initialization using init()
3. Request handling using service()
4. Destruction using destroy()

77. What are the life-cycle methods for a servlet?

• init() – called once when the servlet is first loaded


• service() – called each time a request is made
• destroy() – called before the servlet is removed from service

78. Who is responsible to create the object of servlet?

The web container (Servlet container) is responsible for creating the servlet object.

79. When servlet object is created?

The servlet object is created only once when the first request is received, or when the servlet is loaded on
startup, depending on configuration.

80. What is the difference between GET and POST method?


GET POST
Appends data in URL Sends data in body
Less secure More secure
Limited data length No size limitations
Bookmarked easily Cannot be bookmarked
Idempotent Not necessarily idempotent
81. What is the difference between PrintWriter and ServletOutputStream?

• PrintWriter is used for character data (text).


• ServletOutputStream is used for binary data (e.g., files, images).
Only one of them can be used per response.

82. What is the difference between GenericServlet and HttpServlet?

• GenericServlet is a protocol-independent abstract class.


• HttpServlet is a subclass of GenericServlet designed for handling HTTP-specific requests like GET and
POST.

83. What is Session Tracking?

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.

84. What are Cookies?


Cookies are small pieces of data sent by the server and stored on the client’s browser to maintain user-specific
state information.

85. What is the difference between Cookies and HttpSession?


Cookies HttpSession
Stored on client-side Stored on server-side
Less secure More secure
Limited data Can store complex objects
Slower to modify/access Faster and more reliable

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.

87. What are the life-cycle methods for a JSP?

1. jspInit() – called once when the JSP is initialized


2. _jspService() – called for every request
3. jspDestroy() – called when the JSP is destroyed

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

89. What are the JSP implicit objects?

JSP provides 9 implicit objects:

• request, response, out, session, application, config, pageContext, page, exception

90. What are the 3 tags used in JSP bean development?

1. <jsp:useBean>
2. <jsp:setProperty>
3. <jsp:getProperty>

91. What are the advantages of JSP over JavaScript?

• JSP runs on the server-side, JavaScript runs on client-side


• JSP can connect with databases and generate dynamic content
• More secure as code is hidden from users
• Can reuse Java code and libraries

92. What is a scriptlet in JSP and what is its syntax?

A scriptlet allows embedding Java code within HTML in a JSP file.


Syntax:

<%
// 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; %>

94. What are JSP expressions?

Used to output values directly into the HTML page.


Syntax: <%= expression %>

95. What are JSP comments?


Used to write comments in JSP which are not sent to the client.
Syntax: <%-- This is a JSP comment --%>
96. What are JSP Directives?

Directives provide global information to the JSP engine about the page.
Syntax: <%@ directive attribute="value" %>

97. What are the types of directive tags?

1. page – Defines page settings


2. include – Includes another file
3. taglib – Declares custom tag libraries

98. What are JSP actions?

JSP actions are special tags used to control behavior of the JSP engine.
Examples:

• <jsp:useBean>
• <jsp:include>
• <jsp:forward>

99. What is a page directive?

It defines global information like content type, import statements, session usage etc.
Example: <%@ page language="java" contentType="text/html" %>

100. What is JSP Scripting Element?

Scripting elements let you insert Java code into your JSP:

• Declarations (<%! %>)


• Scriptlets (<% %>)
• Expressions (<%= %>)

101. Difference between JSP and Servlet?


JSP Servlet
More for presentation More for business logic
Easier to write (HTML + Java) Pure Java code
Automatically compiled to servlet Manually written
Separation of concerns Logic and view often together

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.

103. What does the initials of PHP stand for?

PHP originally stood for Personal Home Page, but it now stands for PHP: Hypertext Preprocessor (a
recursive acronym).

104. Which programming language does PHP resemble?

PHP resembles C and Perl in terms of syntax and structure.

105. Differences between GET and POST methods?

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

106. How to declare an array in PHP?


$colors = array("red", "green", "blue");

107. What is the use of in_array() function in PHP?


in_array() checks if a value exists in an array.
Example:
if (in_array("red", $colors)) {
echo "Color found!";
}
108. What is the use of count() function in PHP?

count() returns the number of elements in an array.


Example: echo count($colors); // Output: 3

109. What's the difference between include and require?

• 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.

110. What is the difference between Session and Cookie?


Cookie Session
Stored on client-side Stored on server-side
Less secure More secure
Slower to access Faster and safer
Persistent even after browser close Temporary (unless configured)
111. How to set cookies in PHP?
setcookie("username", "JohnDoe", time() + 3600); // 1 hour
112. How to retrieve a cookie value?
echo $_COOKIE["username"];
113. How to create a session? How to set a value in session? How to remove data from a session?
session_start(); // Start session
$_SESSION["user"] = "John"; // Set session value
unset($_SESSION["user"]); // Remove specific session data
session_destroy(); // Destroy entire session
114. What types of loops exist in PHP?

• for loop
• while loop
• do...while loop
• foreach loop

115. What is the difference between PHP and JavaScript?


PHP JavaScript
Server-side scripting Client-side scripting
Runs on web server Runs in browser
Access to databases Limited access to system
Used for backend Used for frontend interactivity
116. What is PHP MySQLi and PHP PDO difference with example?

• MySQLi: Procedural or object-oriented, only for MySQL


• PDO: Object-oriented, supports multiple databases
Example (PDO): $pdo = new PDO("mysql:host=localhost;dbname=test", "user", "pass");

117. What is PHP Superglobals?

Superglobals are built-in variables in PHP that are accessible anywhere. Examples include:

• $_GET
• $_POST
• $_SESSION
• $_COOKIE
• $_FILES
• $_SERVER
• $_ENV
• $_REQUEST
• $GLOBALS

AJAX:-

118. What is AJAX?


AJAX (Asynchronous JavaScript and XML) is a technique to send and receive data from a server asynchronously
without refreshing the web page.

119. What are the advantages of AJAX?

• Faster response time


• Reduces server traffic
• Improves user experience

120. What are the disadvantages of AJAX?

• Complex debugging
• SEO issues
• JavaScript dependency

121. What are the real web applications of AJAX currently running?
Gmail, Google Maps, Facebook, Twitter.

122. What are the security issues with AJAX?

• Cross-site scripting (XSS)


• Cross-site request forgery (CSRF)
• Data exposure

123. What is the difference between synchronous and asynchronous requests?


Synchronous blocks user interaction until response is received, asynchronous does not.

124. What are the technologies used by AJAX?

• JavaScript
• XML/JSON
• DOM
• XMLHttpRequest

125. What does XMLHttpRequest?


It is an API used to transfer data between client and server without refreshing the page.

126. What are the properties of XMLHttpRequest?

• readyState
• status
• responseText
• responseXML

127. What are the important methods of XMLHttpRequest?

• open()
• send()
• setRequestHeader()

128. What are the different ready states of a request in AJAX?


0: Unsent, 1: Opened, 2: Headers received, 3: Loading, 4: Done.

129. What are the common AJAX frameworks?

• jQuery AJAX
• Axios
• Angular HTTP
• React Query

130. What is the difference between JavaScript and AJAX?


JavaScript is a programming language; AJAX is a technique using JavaScript.

AngularJS:-

131. What is AngularJS?


A JavaScript framework for building dynamic, single-page applications.

132. What are the advantages of AngularJS?


• Two-way data binding
• Dependency injection
• Reusable components

133. What are the disadvantages of AngularJS?

• Performance issues with complex pages


• Steep learning curve

134. What IDEs are used for AngularJS development?


Visual Studio Code, WebStorm, Sublime Text.

135. What are the features of AngularJS?

• MVC architecture
• Directives
• Data binding
• Dependency Injection

136. What are directives in AngularJS?


Custom HTML attributes to extend HTML functionality.

137. What are services in AngularJS?


Singleton objects used for sharing code and logic across the app.

138. What is scope in AngularJS?


An object that binds the controller and the view.

139. What is a template in AngularJS?


HTML with AngularJS-specific elements and attributes.

140. What are expressions in AngularJS?


They bind data to HTML, like {{ expression }}.

141. What is the use of filter in AngularJS?


It formats the data displayed to the user.

142. What is MVC?


Model-View-Controller: separates application into three interconnected components.

143. Explain AngularJS Events.


AngularJS has directives like ng-click, ng-change to handle DOM events.

Node.js

144. What is Node.js?


Node.js is a runtime environment that allows executing JavaScript code on the server side.

145. How does Node.js work?


It uses an event-driven, non-blocking I/O model and runs on a single thread with asynchronous event handling.

146. What do you mean by the term I/O?


I/O stands for Input/Output operations, like reading files, network requests, or database access.
147. What is Sturt?
(Seems like a typo. Possibly you meant "Struct" — Node.js doesn't have a "Sturt". If Struct: it's a way to organize
data in languages like C; not directly relevant in Node.js.)

148. What does event-driven programming mean?


Execution flow is determined by events (like user clicks, API calls, messages).

149. Where can we use Node.js?

• Web servers
• APIs
• Real-time applications (chat, gaming)
• Streaming services

150. What is the advantage of using Node.js?

• High scalability
• Fast execution
• Non-blocking I/O

151. What are the two types of API functions in Node.js?

• Asynchronous (non-blocking)
• Synchronous (blocking)

152. What is a control flow function?


It manages the execution order of asynchronous functions.

153. Why is Node.js single threaded?


To avoid overhead of thread context switching and to handle more concurrent requests efficiently using
asynchronous I/O.

154. What are the pros and cons of Node.js?


Pros: Fast, scalable, great for real-time apps.
Cons: Not ideal for CPU-heavy tasks, callback hell.

155. What is the difference between Node.js and AJAX?


AJAX runs in the browser to interact with server, Node.js runs server-side to build backend apps.

156. What are the challenges with Node.js?

• Handling CPU-intensive tasks


• Callback hell (solved by Promises/Async-Await)

157. Mention the framework most commonly used in Node.js?


Express.js.

Web Services:-

158. What is a Web Service?


Software that allows communication between different devices over the web using standard protocols like
HTTP.

159. What are the advantages of Web Services?

• Interoperability
• Reusability
• Platform-independent

160. What are different types of Web Services?

• SOAP Web Services


• RESTful Web Services

161. What is SOAP?


Simple Object Access Protocol; a protocol for exchanging structured information using XML.

162. What are advantages of SOAP Web Services?

• Strong standards
• High security
• Reliable messaging

163. What are disadvantages of SOAP Web Services?

• Slow due to XML overhead


• Complex to implement

164. What is REST Web Services?


REST stands for Representational State Transfer; it's an architectural style that uses HTTP methods (GET,
POST, PUT, DELETE).

165. What are advantages and disadvantages of REST web services?


Advantages: Lightweight, faster, uses JSON.
Disadvantages: Less security compared to SOAP.

166. Which factors to be considered for website planning? Why is it important?


Factors: Target audience, content, SEO, technology, layout.
Importance: Ensures effective communication, usability, and business goals alignment.

EJB:-

167. What is EJB?


EJB (Enterprise Java Beans) is a server-side software component that encapsulates business logic of an
application.

168. What are the types of Enterprise Beans or EJB?

• Session Bean
• Entity Bean
• Message-Driven Bean

169. What is Session Bean?


A session bean is used to perform tasks for a client, like business logic.

170. What is Stateless Session Bean?


A session bean that does not maintain any client state between method calls.

171. What is Stateful Session Bean?


A session bean that maintains client-specific information across multiple method calls.
172. What is Singleton Session Bean?
A session bean that is instantiated once per application and shared across clients.

173. What is Entity Bean?


(Older concept) Used to represent persistent data stored in a database.

174. What is Message Driven Bean?


A bean that acts as a listener for messaging services like JMS (Java Messaging Service).

175. Explain Lifecycle of EJB.

1. Instantiation
2. Dependency Injection
3. Callbacks (like PostConstruct)
4. Business Methods Execution
5. Destruction

176. When to use Enterprise Bean?


When you need distributed, transactional, secure, scalable, and persistent business logic.

177. What are the benefits of Enterprise Beans?

• Simplified development
• Transaction management
• Security
• Scalability

Spring:-

178. What is Spring?


Spring is a lightweight, open-source framework used for building Java applications easily, especially for
dependency injection and aspect-oriented programming.

179. What are the advantages of Spring Framework?

• Lightweight
• Loose coupling (through Dependency Injection)
• Easy integration with other frameworks
• Declarative transaction management

180. What are the modules of Spring Framework?

• Core
• AOP (Aspect-Oriented Programming)
• Data Access (JDBC, ORM)
• Web MVC
• Security
• Boot (for rapid development)

Bootstrap:-

181. Explain what is Bootstrap?


Bootstrap is a popular front-end framework for building responsive and mobile-first websites.

182. Explain why to choose Bootstrap for building websites?


• Easy to use
• Responsive grid system
• Pre-styled components (buttons, forms, navbars)

183. What are the key components of Bootstrap?

• Scaffolding (Grid system)


• CSS Components (like buttons, alerts)
• JavaScript Plugins (modals, carousels)

Struts:-

184. What is Struts?


Struts is an open-source MVC framework for building Java EE web applications.

185. Explain features of Struts.

• MVC Architecture
• Tag Libraries
• Validation Framework
• Internationalization support

186. Explain working of Struts.

• User submits form → Controller (ActionServlet) receives request → Model (business logic) → View (JSP)
response.

187. Explain Struts tags.


Special tags provided by Struts like <html:form>, <html:text>, <bean:write> to make JSP development easier.

188. Explain Struts 2 Action class.


An Action class processes the user’s request and returns a result (like success, error) to the framework.

189. Explain Struts 2 interceptors.


Interceptors perform operations before and after an action is executed (like validation, file upload, etc.)

190. What are the Steps to create Struts 2 web application?

• Create project
• Configure struts.xml
• Create Action classes
• Create JSPs
• Deploy and run on server

Ruby on Rails

191. List the features of Ruby?

• Object-Oriented
• Dynamic Typing
• Garbage Collection
• Exception Handling
• Mixins instead of multiple inheritance

192. Explain pattern matching operations in Ruby.


Ruby uses the =~ operator and Regex (Regular Expressions) for pattern matching:
"hello" =~ /lo/ # returns the index where pattern is found

193. Explain built-in methods for arrays and lists.

• .push or << → Add element


• .pop → Remove last element
• .shift → Remove first element
• .unshift → Add element at beginning
• .sort, .reverse, .map, .each for traversing

194. List the Uses of Ruby?

• Web development (Rails)


• Data processing
• Automation scripts
• Prototyping
• APIs development

195. Explain built-in string operations in Ruby.

• .length, .upcase, .downcase


• .gsub for replacing
• .split, .strip, .concat

Example:

str = "Hello World"


str.downcase # => "hello world"

196. Explain with example, keyboard input and screen output functions in Ruby.

• gets → Get user input


• puts → Display output

Example:

puts "Enter your name:"


name = gets.chomp
puts "Hello, #{name}!"

197. How a method is created in Ruby? Explain with example.


Methods are defined using def keyword:

def greet(name)
"Hello, #{name}!"
end

puts greet("Ruby")

198. How a Rails application is constructed?

• Use rails new app_name command


• Folder structure created: app/, config/, db/, public/, test/

199. Explain form handling with Rails.

• Use form helpers like form_for or form_with to create forms


• Parameters are captured using params in controller

Example:

<%= form_with(url: "/posts") do |form| %>


<%= form.text_field :title %>
<%= form.submit %>
<% end %>

200. Explain directory structure for the Rails Application.

• app/ → MVC files (models, views, controllers)


• config/ → Routing, database config
• db/ → Migrations
• public/ → Static files
• test/ → Unit tests

201. How Rails reacts to a request for a static document?


If a static file matching the URL is found under the /public directory, Rails directly serves it, skipping routing
and controller processing.

You might also like