WT Oral QB
WT Oral QB
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.
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.
table, th, td {
border: 1px solid black;
}
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.
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>
Unit 2
12. What is JavaScript?
To write external JavaScript, you create a separate .js file containing your
JavaScript code.
<!DOCTYPE html>
<html>
<head>
<script src="script.js"></script>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
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.
// Function definition
function greet(name) {
// Function call
greet("John");
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)
}
You can create an array in JavaScript using square brackets [] and assigning
values to it. Here's an example:
var person = {
name: "John",
age: 30,
};
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).
+-- html
+-- head
| |
| +-- title
| |
+-- body
|
+-- h1
<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.*;
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:
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";
?>
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:
class MyClass
def say_hello
puts "Hello, Ruby!"
end
end
obj = MyClass.new
obj.say_hello
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;
}
}