Web Technology Viva
Web Technology Viva
HTML (Hypertext Markup Language) is the standard markup language used to create web pages.
It describes the structure of web pages using a system of tags or elements such as <html>,
<head>, <body>, <title>, etc. HTML defines the content and structure, but it doesn't handle the
design or interactivity.
<head>: Contains meta-information about the HTML document, such as the title of the
document, links to stylesheets, and other meta tags like <meta>, <link>, and <script>. It
does not display content on the web page itself.
<body>: Contains the main content of the HTML document, such as text, images, links,
tables, and other elements that are visible to users.
The total width and height of an element are calculated by adding the content, padding, border,
and margin.
JavaScript is a dynamic, weakly typed language used mainly for web development
(client-side scripting).
Java is a compiled, object-oriented programming language used for building
applications, desktop software, and web services (server-side).
6. What are functions in JavaScript?A function in JavaScript is a block of code designed to
perform a particular task. Functions are reusable and can be called with arguments to return a
result. A basic function is defined using the function keyword:
javascript
function greet(name) {
return "Hello, " + name;
}
GET: Sends data to the server in the URL and is used to retrieve data. It is less secure as
the data is visible in the URL and has a size limitation.
POST: Sends data to the server in the body of the request. It is used to send data (e.g.,
form submissions) and is more secure as the data is not exposed in the URL.
html
<link rel="stylesheet" href="styles.css">
12. What is the difference between inline and block-level elements in HTML?
Inline Elements: These elements only take up as much width as necessary and do not
start on a new line. Examples: <span>, <a>, <strong>.
Block-level Elements: These elements take up the full width available and always start
on a new line. Examples: <div>, <p>, <h1>.
Static: Default positioning, elements are placed in the normal document flow.
Relative: Positioned relative to its normal position in the document flow.
Absolute: Positioned relative to the nearest positioned ancestor (or the document body if
no ancestor is positioned).
Fixed: Positioned relative to the viewport, staying in the same place even when scrolling.
Sticky: Behaves like relative positioning until a certain point in the page, after which it
becomes fixed
14. What is the purpose of the <meta> tag in HTML?The <meta> tag provides metadata
about the HTML document, such as character set, author, description, and keywords. This
information is used by browsers and search engines. For example, a meta tag for setting the
character encoding:
html
<meta charset="UTF-8">
html
<script src="script.js"></script>
18. What is Bootstrap?
Bootstrap is a popular front-end framework for developing responsive and mobile-first websites.
It provides ready-to-use components like navigation bars, forms, buttons, and grids, along with
CSS and JavaScript-based tools for easier web development.
HTML (HyperText Markup Language) is less strict about syntax and allows for
flexibility with certain rules.
Inline CSS: Written directly within an HTML tag using the style attribute.
Internal CSS: Written within the <style> tag inside the <head> section of an HTML
document.
External CSS: Written in a separate .css file, which is linked to the HTML document
using the <link> tag..
Primitive data types: Number, String, Boolean, Null, Undefined, Symbol (ES6)
A web server is responsible for hosting and delivering web pages to users' browsers.
When a user sends an HTTP request to the server, it processes the request, retrieves the
requested content (such as an HTML page), and sends it back to the client.
HTTPS: A secure version of HTTP, where the data is encrypted using SSL/TLS to ensure
privacy and prevent tampering.
jQuery is a fast, small, and feature-rich JavaScript library. It simplifies tasks like HTML
document traversal and manipulation, event handling, and animation by providing easy-
to-use methods that work across different web browsers.
<div>: A block-level element used to group larger sections of content. It creates a new
line before and after the element.
<span>: An inline element used to group smaller portions of content without creating a
line break.
Front-end developer: Focuses on the visual and interactive aspects of a website (HTML,
CSS, JavaScript).
Back-end developer: Works on the server side, handling database interactions, server
logic, and API creation (using languages like Node.js, Python, PHP).
echo: It is a language construct used to output data to the screen. It can take multiple
parameters and does not return a value.
print: It is also a language construct used for outputting data but returns 1, meaning it
can be used in expressions.
php
echo "Hello, world!"; // Can output multiple values
print "Hello, world!"; // Outputs one value and returns 1
An associative array in PHP is an array where each element is identified by a key rather than an
index. The keys can be strings or numbers.
Example:
php
$person = array("name" => "John", "age" => 25, "city" => "New York");
echo $person["name"]; // Outputs: John
36. What are the advantages of using PHP over other programming languages for web
development?
PHP allows custom error handling using the set_error_handler() function to handle specific
errors.
PHP code can be included in an HTML file by embedding it within PHP tags <?php ?>.
The server processes the PHP code and returns the output as HTML.
Example:
php
<html>
<body>
<h1><?php echo "Welcome to PHP!"; ?></h1>
</body>
</html>
39. What do you mean by JSON
JSON stands for JavaScript Object Notation. It is a lightweight data-interchange format that is
easy for humans to read and write, and easy for machines to parse and generate. It is commonly
used for transmitting data between a server and a web application, or between systems.
json
["apple", "banana", "cherry"]
json
{
"name": "John",
"age": 30,
"city": "New York"
}
JSON is widely used in APIs and web services to exchange data because of its simplicity and
ease of integration with various programming languages.