0% found this document useful (0 votes)
9 views14 pages

WT Oral QB

The document is a comprehensive oral question bank on web technology, covering topics such as HTML, CSS, JavaScript, AngularJS, Servlets, XML, and JSP. It includes definitions, examples, and explanations of key concepts, along with code snippets for practical understanding. The content is organized into units, each focusing on different aspects of web development technologies.

Uploaded by

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

WT Oral QB

The document is a comprehensive oral question bank on web technology, covering topics such as HTML, CSS, JavaScript, AngularJS, Servlets, XML, and JSP. It includes definitions, examples, and explanations of key concepts, along with code snippets for practical understanding. The content is organized into units, each focusing on different aspects of web development technologies.

Uploaded by

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

WEB TECHNOLOGY

ORAL QUESTION BANK

UNIT 1
What is HTML?
-HTML, which stands for Hypertext Markup Language, is the standard language used to
create and design documents on the World Wide Web. It provides the structure and
framework for web pages by utilizing various tags and elements to define the content
and layout. HTML documents consist of text content, such as headings, paragraphs, lists,
and links, as well as multimedia elements like images, videos, and audio files. These
elements are organized within the HTML document using tags, which are enclosed in
angle brackets (\< and \>). HTML is often combined with other technologies like CSS
(Cascading Style Sheets) and JavaScript to enhance the presentation and functionality of
web pages.
What is CSS?
CSS, short for Cascading Style Sheets, is a style sheet language used to describe the
presentation of a document written in HTML or XML (including XML dialects like SVG or
XHTML). CSS defines how HTML elements are to be displayed on screen, paper, or in
other media.

What is Bootstrap?
Bootstrap is a popular open-source front-end framework used for developing
responsive and mobile-first websites and web applications. It was originally
created by developers at Twitter and is now maintained by a community of
developers and designers.

Bootstrap provides a collection of HTML, CSS, and JavaScript components

How to write internal, external, inline CSS?

internal CSS: Internal CSS is written within the <style> element in the <head> section
of an HTML document.

External CSS: External CSS is written in a separate CSS file and linked to an HTML
document using the <link> element within the <head> section.

Inline CSS: Inline CSS is applied directly to an HTML element using the style attribute.

Create simple CSS for html form, table, body element.


/* CSS for Form */
form {
width: 300px;
margin: 0 auto;
}

/* CSS for Table */


table {
border-collapse: collapse;
width: 100%;
}

table, th, td {
border: 1px solid black;
}

/* CSS for Body */


body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}

How to use external CSS?

To use external CSS, you need to create a separate CSS file with .css extension and then
link it to your HTML document using the <link> element within the <head> section.

Which CSS is better and why?

There isn't a definitive answer to which CSS approach is better as each has its
own advantages and use cases:
 Internal CSS is useful for small styles that are specific to a single HTML
document.
 External CSS is beneficial for larger projects with multiple HTML pages as it
promotes code reusability and easier maintenance.
 Inline CSS is handy for quick styling of individual elements but can make
the HTML document cluttered and harder to maintain.
Create a table in HTML

<!DOCTYPE html>
<html>
<head>
<title>HTML Table Example</title>
</head>
<body>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
<tr>
<td>Data 3</td>
<td>Data 4</td>
</tr>
</table>
</body>
</html>

4. What is CSS inheritance?


CSS inheritance is the mechanism by which certain properties of an element
are passed down to its descendants. If a descendant element doesn't have a
specific value for a property, it inherits the value of that property from its
parent element. This helps in writing cleaner and more efficient CSS by
reducing the need for redundant styling.
5. Which CSS has the highest priority?
CSS specificity determines which CSS rules take precedence when multiple
rules apply to the same element. Generally, inline styles have the highest
priority, followed by IDs, classes, and element selectors. However,
specificity can be more complex when dealing with combinators and !
important declarations.
6. Where to write internal CSS in HTML? Why?
Internal CSS is typically written within the <style> element in the <head>
section of an HTML document. Placing CSS in the <head> section separates
it from the content of the page, making it easier to maintain and manage
styles across multiple pages. Additionally, it ensures that styles are loaded
before the content, which helps in preventing layout shifts and rendering
issues.

Unit 2
12. What is JavaScript?

JavaScript is a high-level, interpreted programming language primarily used for


creating dynamic and interactive web pages. It allows developers to add behavior,
interactivity, and functionality to web pages. JavaScript can be used to manipulate
the content of a webpage, respond to user actions, validate input, interact with
APIs, create animations, and much more.

13. How to write external JavaScript and refer in HTML file?

To write external JavaScript, you create a separate .js file containing your
JavaScript code.

<!DOCTYPE html>

<html>

<head>

<title>External JavaScript Example</title>

<script src="script.js"></script>

</head>

<body>

<h1>Hello, world!</h1>

</body>
</html>

In this example, script.js is the external JavaScript file.

14. Is it compulsory to write internal JavaScript in the head


element (tag)?

No, it's not compulsory to write internal JavaScript in the head element. While it's
a common practice to include JavaScript in the head element, you can also include
it at the end of the body element or even inline within HTML elements.

15. Any example of a function in JavaScript?

// Function definition

function greet(name) {

console.log("Hello, " + name + "!");

// Function call

greet("John");

16. Certainly, here's a simple example of a function in JavaScript:

16. Write JavaScript for displaying the Fibonacci series till 100.
function fibonacci(n) {
var fib = [0, 1];
for (var i = 2; i <= n; i++) {
fib[i] = fib[i - 1] + fib[i - 2];
if (fib[i] > 100) {
break;
}
}
return fib.slice(0, -1); // Remove the last element (greater than 100)
}

console.log(fibonacci(20)); // Display Fibonacci series till 100

17. How to create an array in JavaScript?

You can create an array in JavaScript using square brackets [] and assigning
values to it. Here's an example:

var fruits = ["Apple", "Banana", "Orange"];


18. Explain Object in JavaScript with an example.

In JavaScript, an object is a collection of key-value pairs, where each key is a


string (or Symbol) and each value can be of any data type (including objects and
functions). Here's an example:

var person = {

name: "John",

age: 30,

city: "New York"

};

console.log(person.name); // Output: John

19. What is DOM? Draw a tree structure considering a suitable


example.

The Document Object Model (DOM) is a programming interface for HTML and XML
documents. It represents the structure of a document as a tree of objects, where
each object corresponds to a different part of the document (e.g., elements,
attributes, text nodes).

Here's a simplified tree structure representing a simple HTML document:


Document

+-- html

+-- head

| |

| +-- title

| |

| +-- Text: Example Page

+-- body
|

+-- h1

+-- Text: Hello, World! !

20. Mention any 3 DOM methods.

Three commonly used DOM methods are:

1. document.getElementById() : Retrieves an element by its ID.


2. document.querySelector() : Retrieves the first element that matches a
specified CSS selector.
3. element.appendChild() : Appends a node as the last child of a specified
parent node.
4. What is AngularJS?

AngularJS is a JavaScript-based open-source front-end web framework developed


and maintained by Google. It's used for building dynamic single-page web
applications (SPAs) by extending HTML with additional attributes and directives,
and by providing data binding, dependency injection, and other powerful features
to simplify development.

22. Mention any 4 AngularJS directives.

Four commonly used AngularJS directives are:

1. ng-model: Binds an HTML element's value to a property in the AngularJS


model.
2. ng-click: Specifies an expression to evaluate when an element is clicked.
3. ng-repeat: Iterates over a collection and creates a copy of a template for
each item.
4. ng-show/ng-hide: Conditionally shows or hides an element based on an
expression.
5. What is an AngularJS Controller? Simple example.
An AngularJS controller is a JavaScript function that defines the behavior of a
part of an AngularJS application. It's used to initialize the scope and add
behavior to the scope. Here's a simple example:
<!DOCTYPE html>
<html>
<head>
<title>AngularJS Controller Example</title>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"><
/script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<h1>{{ greeting }}</h1>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.greeting = 'Hello, World!';
});
</script>

</body>
</html>
In this example, myCtrl is an AngularJS controller that sets the value of
greeting in the scope, which is then displayed in the HTML using AngularJS
expression {{ greeting }}.

UNIT 3
24. What is Servlet? Simple Hello World Program.
 Servlet is a Java-based server-side technology used for creating dynamic
web applications. It extends the capabilities of a web server by generating
dynamic content.
 Here's a simple "Hello World" Servlet program:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class HelloWorldServlet extends HttpServlet {


public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello, World!");
}
}
25. What is doGet() and doPost()?
 doGet() and doPost() are methods in the HttpServlet class used to handle
HTTP GET and POST requests, respectively, in a Servlet.
 doGet() is called when a client sends an HTTP GET request to the Servlet.
 doPost() is called when a client sends an HTTP POST request to the Servlet.
26. Explain the lifecycle of Servlet.
 The Servlet lifecycle consists of several phases: initialization, service, and
destruction.
 During initialization, the Servlet container loads and initializes the Servlet.
 During the service phase, the Servlet handles client requests by executing
the service() method.
 During destruction, the Servlet container removes the Servlet instance from
memory.
27. Which lifecycle methods are optional to write in a servlet
program?
 All lifecycle methods in a Servlet ( init(), service(), and destroy()) are
optional to implement. However, most Servlets will override at least the
service() method to handle requests.
28. Who manages the lifecycle of Servlet?
 The Servlet container, such as Apache Tomcat or Jetty, manages the
lifecycle of Servlets. It loads, initializes, and destroys Servlet instances as
needed.
29. Simple Database Code in Servlet.
 Here's a simple example of database access in a Servlet using JDBC:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

public class DatabaseServlet extends HttpServlet {


public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase",
"username", "password");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM mytable");
while (rs.next()) {
out.println(rs.getString("column1") + " " +
rs.getString("column2"));
}
con.close();
} catch (Exception e) {
out.println("Error: " + e.getMessage());
}
}
}
30. Which packages are required for a Servlet Program?
 The javax.servlet and javax.servlet.http packages are required for writing
Servlet programs.
31. What is XML? Simple Example.
 XML (Extensible Markup Language) is a markup language that defines rules
for encoding documents in a format that is both human-readable and
machine-readable.
 Here's a simple example of an XML document:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>John</to>
<from>Jane</from>
<heading>Reminder</heading>
<body>Don't forget the meeting tomorrow.</body>
</note>
32. What is DTD, Schema? Write Simple DTD and Schema for any
XML.
 DTD (Document Type Definition) and XML Schema are both used to define
the structure and rules of XML documents.
 Here's a simple DTD for the above XML example:
<!DOCTYPE note [
<!ELEMENT note (to, from, heading, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
33. Which one is better DTD or Schema?
 XML Schema is generally considered more powerful and flexible than DTD. It
supports data types, namespaces, and more complex structures.
34. How to display XML data in an HTML Table?
 You can use JavaScript or server-side scripting (like Servlets) to parse the
XML data and generate HTML table elements dynamically.
35. How to call a servlet from HTML?
 You can call a servlet from HTML by creating a form with the action attribute
set to the servlet's URL.
36. Compare XML and HTML.
 XML (Extensible Markup Language) is used for storing and transporting data,
while HTML (Hypertext Markup Language) is used for creating structured
documents and web pages.
 XML tags are user-defined, while HTML tags are predefined.
 XML is more flexible and extensible, while HTML is more rigid and focused
on presentation.

UNIT 4
36. What is JSP? Simple example Hello World.
 JSP (JavaServer Pages) is a technology used to create dynamic web pages by embedding Java
code within HTML or XML markup.
 Here's a simple "Hello World" example in JSP:

37. JSP Lifecycle Methods?


 The JSP lifecycle consists of three main phases: translation, compilation, and execution.
 The translation phase translates JSP code into a servlet.
 The compilation phase compiles the servlet into Java bytecode.
 The execution phase executes the servlet's service() method, which handles client requests.
38. Who manages the lifecycle of JSP?
 The lifecycle of JSP is managed by the web container, application server, or servlet container,
such as Apache Tomcat.
39. Compare JSP and Servlet.
 Servlet is a Java class used to extend the capabilities of a web server, whereas JSP is a
technology used to create dynamic web pages by embedding Java code within HTML or XML
markup.
 Servlets are more suitable for handling business logic and processing requests, while JSP is
more suitable for creating the presentation layer of web applications.
40. Mention any 4 JSP tags.
 Four common JSP tags are:
1. <%-- ... --%>: Comment tag for adding comments in JSP.
2. <%! ... %>: Declaration tag for declaring variables and methods in JSP.
3. <%= ... %> : Expression tag for evaluating and displaying expressions in JSP.
4. <% ... %>: Scriptlet tag for embedding Java code blocks in JSP.
41. JSP database code.
 JSP can interact with databases using Java Database Connectivity (JDBC). Here's a simple
example
<%@ page import="java.sql.*" %>
<%
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase",
"username", "password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM mytable");
while (rs.next()) {
out.println(rs.getString("column1") + " " + rs.getString("column2"));
}
conn.close();
%>
42. What is MVC?
 MVC (Model-View-Controller) is a software architectural pattern used for developing web
applications. It separates an application into three interconnected components: the model, view,
and controller.
43. What is a Web Service? Give examples.
 A web service is a software system designed to support interoperable machine-to-machine
communication over a network. Examples include SOAP (Simple Object Access Protocol) and
RESTful web services.
44. Compare SOAP and RESTful Web Services.
 SOAP is a protocol for exchanging structured information in the implementation of web
services, while REST (Representational State Transfer) is an architectural style for designing
networked applications.
 SOAP is more rigid and requires XML-based messages, while REST is more flexible and can
use various formats like XML, JSON, or plain text.
 SOAP typically uses HTTP POST for all requests, while RESTful web services use HTTP
methods like GET, POST, PUT, DELETE for different operations.
45. What is WSDL?
 WSDL (Web Services Description Language) is an XML-based language used to describe the
functionality of a web service, including the available operations, input and output parameters,
and data types.
46. What is Struts? Simple Hello World Program.
 Struts is an open-source framework used to develop Java web applications based on the MVC
design pattern.
 Here's a simple "Hello World" example in Struts:
public class HelloWorldAction extends ActionSupport {
public String execute() throws Exception {
setMessage("Hello, World!");
return SUCCESS;
}
}
47. Explain action and interceptors in Struts.
 In Struts, an action is a Java class that handles a user's request and returns a response.
 Interceptors are components that are invoked before and after an action is executed, allowing
for cross-cutting concerns such as logging, validation, or authentication to be applied uniformly
across multiple actions.

UNIT 5
48. What is PHP? Hello World Program.
 PHP (Hypertext Preprocessor) is a server-side scripting language used for creating dynamic web
pages and web applications.
 Here's a simple "Hello World" program in PHP:
<?php
echo "Hello, World!";
?>
49. Internal and external PHP.
 Internal PHP is embedded directly within HTML code using PHP tags ( <?php ?> ), while
external PHP is written in separate .php files and included in HTML using <script> tags
with the src attribute.
50. Display the first 10 numbers of the Fibonacci Series.
<?php
$n = 10;
$first = 0;
$second = 1;
echo $first . " " . $second . " ";
for($i = 2; $i < $n; $i++) {
$next = $first + $second;
echo $next . " ";
$first = $second;
$second = $next;
}
?>
51. Where to write internal PHP in an HTML file?
 Internal PHP can be written anywhere within an HTML file, including the head or body
sections. It depends on where you want to include dynamic content.
52. How to take input from the user in PHP?
 You can take input from the user in PHP using the $_POST or $_GET superglobals, or through
forms and input fields in HTML.
53. Explain Functions and Arrays in PHP with examples.
 Functions in PHP are blocks of reusable code that perform a specific task. Arrays in PHP are
variables that can hold multiple values.
 Example of a function:
function greet($name) {
echo "Hello, $name!";
}
greet("John");
54. Are PHP keywords case-sensitive?
 No, PHP keywords are not case-sensitive.
55. Addition of two numbers using PHP.

<?php
$num1 = 5;
$num2 = 10;
$sum = $num1 + $num2;
echo "Sum: " . $sum;
?>
56. Database connectivity code in PHP.
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

57. What is WAP and WML?


 WAP (Wireless Application Protocol) is a technical standard for accessing information over a
mobile wireless network.
 WML (Wireless Markup Language) is a markup language used to create content for WAP-
enabled devices.
58. What is ASP.NET?
 ASP.NET is a web application framework developed by Microsoft for building dynamic web
sites, web applications, and web services.
59. What is the .NET framework?
 The .NET framework is a software framework developed by Microsoft that provides a
comprehensive programming model for building Windows-based applications.
60. Which programming languages are used for writing ASP.NET web sites?
 ASP.NET supports multiple programming languages, including C#, Visual Basic .NET, and F#.
61. What is C#?
 C# (pronounced "C sharp") is a modern, object-oriented programming language developed by
Microsoft as part of the .NET framework.
62. What is RAZOR? Syntax?
 RAZOR is a markup syntax used to create dynamic web pages in ASP.NET.
 Example syntax:
<p>Hello, @Model.Name!</p>

63. What is Node.js?


 Node.js is an open-source, cross-platform JavaScript runtime environment that allows
developers to build scalable network applications. It uses an event-driven, non-blocking I/O
model.

UNIT 6
64. What is Ruby? Simple Hello World Program.
 Ruby is a dynamic, object-oriented programming language known for its simplicity and
productivity.
 Here's a simple "Hello World" program in Ruby:

puts "Hello, World!"

65. Input Output Statements with example.


 Ruby's puts method is used for outputting text, and gets method is used for getting input from
the user.
 Example
 puts "Enter your name:"
 name = gets.chomp
 puts "Hello, #{name}!"

66. How to create an array in Ruby?


 You can create an array in Ruby using square brackets [].
 Example:

fruits = ["Apple", "Banana", "Orange"]

67. How to create an object in Ruby?


 You can create an object in Ruby using the new method.
 Example:

class MyClass
def say_hello
puts "Hello, Ruby!"
end
end

obj = MyClass.new
obj.say_hello

68. What is Rails?


 Rails, or Ruby on Rails, is a web application framework written in Ruby. It follows the Model-
View-Controller (MVC) architectural pattern and provides default structures for a database, a
web service, and web pages.
69. What is EJB? Simple Hello World Program.
 EJB (Enterprise JavaBeans) is a server-side component architecture for building scalable,
distributed, transactional, and secure enterprise applications in Java.
 Here's a simple "Hello World" program in EJB:

import javax.ejb.*;

@Stateless
public class HelloWorldBean {
public String sayHello() {
return "Hello, World!";
}
}
70. Why is an interface used in an EJB program?
 Interfaces in EJB define the contract that the implementing classes must adhere to. They
provide a way to specify the methods that a bean must implement without specifying how they
are implemented.
71. Types of EJB? Which one is more useful?
 There are three types of EJB: Session Beans, Entity Beans, and Message-Driven Beans.
 Session Beans are the most commonly used type and are considered more useful due to their
flexibility and ability to encapsulate business logic.
72. Which Application Server is used for EJB?
 Application servers like JBoss, WebLogic, and WebSphere are commonly used for deploying
and running EJB applications.
73. Addition of two numbers program in EJB.
 Here's a simple example of adding two numbers in an EJB:

import javax.ejb.*;

@Stateless
public class AddNumbersBean {
public int add(int num1, int num2) {
return num1 + num2;
}
}

You might also like