B) Define:-1) Tag 2) Tag 3) Tag

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Q.1 Q.

2
a) what is WWW ? a) explain event handling in JAVASCRIPT ?
World Wide Web, which is also known as a Web, is a collection of websites or web pages stored in web When an event, consider pressing a keyboard key or clicking an element, occurs on a DOM or an HTML
servers and connected to local computers through the internet. These websites contain text pages, element, we can call the specific functions based on these events. Now, how does the HTML element
digital images, audios, videos, etc. Users can access the content of these sites from any part of the know when to call the mentioned JavaScript code or JavaScript function? This is taken care of by the
world over the internet using their devices such as computers, laptops, cell phones, etc. event handlers. The properties of DOM or HTML elements are called event handlers to control how an
b) define HTML ? element should respond to a given event.
HTML, or Hypertext Markup Language, is a markup language for the web that defines the structure of Examples:- 1) An HTML web page has finished loading 2)An HTML input field was changed 3) An
web pages. It is one of the most basic building blocks of every website, so it's crucial to learn if you HTML button was clicked
want to have a career in web development. B) explain array in JAVASCRIPT.
c) what is stylesheet ? In JavaScript, an array is one of the most commonly used data types. It stores multiple values and
Cascading Style Sheets (CSS) provide easy and effective alternatives to specify various attributes for the elements in one variable. These values can be of any data type — meaning you can store a string,
HTML tags. Using CSS, you can specify a number of style properties for a given HTML element. Each number, boolean, and other data types in one variable. There are two standard ways to declare an
property has a name and a value, separated by a colon (:). Each property declaration is separated by a array in JavaScript. These are either via the array constructor or the literal notation. JavaScript array is
semi-colon (;). a single variable that is used to store different elements. It is often used when we want to store a list of
d) write any two HTTP request methods ? elements and access them by a single variable. Unlike most languages where the array is a reference to
1) GET 2) HEAD 3) POST 4) PUT 5) DELETE 6) CONNECT 7) OPTIONS the multiple variables, in JavaScript, an array is a single variable that stores multiple elements.
6) Establishes a tunnel to the server identified by a given URI. C) explain physical and logical HTML.
7) Describes the communication options for the target resource. Physical tags:- are used to indicate that how specific characters are to be formatted or indicated using
H) write any two attributes of <list> tag. HTML tags. Any physical style tag may contain any item allowed in text, including conventional text,
1) <BODY> 2) <FONT> images, line breaks, etc. Physical tags can only be used for styling purposes for specific elements.
1)<BODY> :- bg color, text are the two attributes of body tag. Although each physical tag has a defined style, you can override that style by defining your own look
2) <FONT> :_- color, face, Size are the two attributes of body tag. for each tag.
I) explain any two dialog boxes used in javascript. Logical Tags: Logical tags are used to tell the browser what kind of text is written inside the tags.
There are three types of dialog boxes supported in JavaScript that are alert, confirm, and prompt. Logical tags are also known as Structural tags because they specify the structure of the document.
These dialog boxes can be used to perform specific tasks such as raise an alert, to get confirmation of Logical tags are used to indicate to the visually impaired person that there is something more
an event or an input, and to get input from the user. important in the text or to emphasize the text ie, logical tags can be used for styling purposes as well
as to give special importance to text content.

Q.4 e) write a javascript code to accept a number from user and display its factorial.
A) explain control structure in javascript. // Prompt the user to enter a number
Control structure actually controls the flow of execution of a program. Following are the several control var number = parseInt(prompt("Enter a number:"));
structure supported by javascript. // Validate the input
1) if … else 2) switch case 3) do while loop 4) while loop 5) for loop if (isNaN(number)) {
1) if_else:- The if statement is the fundamental control statement that allows JavaScript to make console.log("Invalid input. Please enter a valid number.");
decisions and execute statements conditionally. } else { // Calculate the factorial
Syntax:- if (expression){ var factorial = 1;
Statement(s) to be executed if expression is true } for (var i = 2; i <= number; i++) {
2) switch case:- The basic syntax of the switch statement is to give an expression to evaluate and factorial *= i;
several different statements to execute based on the value of the expression. The interpreter checks } // Display the factorial
each case against the value of the expression until a match is found. If nothing matches, a default console.log("The factorial of " + number + " is: " + factorial); }
condition will be used.
3) do while loop:- The do...while loop is similar to the while loop except that the condition check Q.5 C) explain HTML structure:- Html used predefined tags and attributes to tell the browser how to
happens at the end of the loop. This means that the loop will always be executed at least once, even if display content, means in which format, style, font size, and images to display. Html is a case
the condition is false. insensitive language. Case insensitive means there is no difference in upper case and lower case (
4) while loop:- The purpose of a while loop is to execute a statement or code block repeatedly as long capital and small letters) both treated as the same, for r example ‘D’ and ‘d’ both are the same here.
as expression is true. Once expression becomes false, the loop will be exited. There are generally two types of tags in HTML:
--B) explain any 4 operators used in javascript with example. 1. Paired Tags: These tags come in pairs. That is they have both opening(< >) and closing(</ >) tags.
1. Assignment Operators 2. Arithmetic Operators 3. Comparison Operators 4. Logical Operators 2. Empty Tags: These tags do not require to be closed.
5. Bitwise Operators 6. String Operators
1. Assignment operator:- An assignment operator assigns a value to its left operand based on the
value of its right operand. The simple assignment operator is equal ( = ), which assigns the value of its
right operand to its left operand.
2. Arithmatic operator:- JavaScript Arithmetic Operators are the operators that operate upon the
numerical values and return a numerical value. Any kind arithmetic operations performance required
these operators.
3. Comparison operator:- A comparison operator compares its operands and returns a logical value
based on whether the comparison is true. The operands can be numerical, string, logical, or object
values. Strings are compared based on standard lexicographical ordering, using Unicode values.
4. Logical operator:- logical operator is mostly used to make decisions based on conditions specified
for the statements. It can also be used to manipulate a boolean or set termination conditions for loops.

B) Define:- 1) <br> tag 2) <td> tag 3) <width> tag


1) <br> tag:- The <br> tag inserts a single line break. The <br> tag is useful for writing addresses or
poems. The <br> tag is an empty tag which means that it has no end tag. The browser does not
recognize new lines and paragraph formatting in the text. If you want to start a new line, you need to
insert a line break with the help of the <br>. The <br> tag inserts a single carriage return or breaks in
the document.
2) <td> tag:- HTML <td> tag is used to specify the cells of an HTML table which contain data of the
table. The <td> tag must be the child element of <tr> (table row) tag. Each table row can contain
multiple <td> data elements.
The grouped <td> elements of a <tr> tag renders as a single row in the table. The content of the <td>
elements is regular and left-aligned in the table by default.
3) <width> tag:- The width attribute on an element sets the width of the element.
The width is specified in pixels -- without the ‘px‘ unit.
Elements that accept this attribute include <img>, <input>, <canvas>, <video>, <embed>, <iframe>,
and <object>.
Syntax:- <tagname width= “pixals”>
C) Explain types of Images:- 1) Binary Images:- It is the simplest type of image. It takes only two values
i.e, Black and White or 0 and 1. The binary image consists of a 1-bit image and it takes only 1 binary
digit to represent a pixel. Binary images are mostly used for general shape or outline.
2) Grey-scale Images:- Grayscale images are monochrome images, Means they have only one color.
Grayscale images do not contain any information about color. Each pixel determines available different
grey levels. A normal grayscale image contains 8 bits/pixel data, which has 256 different grey levels.
3) Colour Images:- Colour images are three band monochrome images in which, each band contains a
different color and the actual information is stored in the digital image. The color images contain gray
level information in each spectral band. The images are represented as red, green and blue (RGB
images).

You might also like