Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

1) Explain any five PHP Comparison Operators.

Answer:- Comparison Operators


The PHP comparison operators are used to compare two values (number or string).

It returns a boolean value either TRUE or FALSE.

Operator Name Example Explanation

== Equal $a == $b Return TRUE if $a is equal to $b

=== Identical $a === Return TRUE if $a is equal to $b, and they are of same
$b data type

!== Not $a !== $b Return TRUE if $a is not equal to $b, and they are not of
identical same data type

!= Not equal $a != $b Return TRUE if $a is not equal to $b

<> Not equal $a <> $b Return TRUE if $a is not equal to $b

< Less than $a < $b Return TRUE if $a is less than $b

> Greater $a > $b Return TRUE if $a is greater than $b


than

2)What is the use of the following CSS selectors ?Explain with examples-

a)class b)#id

Answer:- a) CSS Class Selector :- The class selector selects HTML elements with a
specific class attribute.

To select elements with a specific class, write a period (.) character, followed by
the class name.

Example:-

<!DOCTYPE html>

<html>

<head>

<style>
.center {

text-align: center;

color: red;

</style>

</head>

<body>

<h1 class="center">Red and center-aligned heading</h1>

<p class="center">Red and center-aligned paragraph.</p>

</body>

</html>

Output:- Red and center-aligned heading


Red and center-aligned paragraph.

b) CSS Id Selector:- The id selector uses the id attribute of an HTML element to


select a specific element.

The id of an element is unique within a page, so the id selector is used to select


one unique element!

To select an element with a specific id, write a hash (#) character, followed by
the id of the element.

Example
<!DOCTYPE html>

<html>

<head>

<style>

#para1 {
text-align: center;

color: red;

</style>

</head>

<body>

<p id="para1">Hello World!</p>

<p>This paragraph is not affected by the style.</p>

</body>

</html

OUTPUT:- Hello World

This paragraph is not affected by the style.

3)What is the purpose of audio and video tags in html? Give example.

Answer:- Audio Tag:- HTML audio tag is used to define sounds such as music and other
audio clips. Currently there are three supported file format for HTML audio tag.

1. mp3
2. wav
3. ogg

Example: <!DOCTYPE>

<html>

<body>

<audio controls>

<source src="koyal.mp3" type="audio/mpeg">


Your browser does not support the html audio tag.

</audio>

</body>

</html>

Video Tag:- The <video> tag is used to embed video content in a


document, such as a movie clip or other video streams.

The text between the <video> and </video> tags will only be displayed in
browsers that do not support the <video> element.

There are three supported video formats in HTML: MP4, WebM, and OGG.

<!DOCTYPE html>

<html>

<body>

Example:-

<h1>The video element</h1>

<video width="320" height="240" controls>

<source src="movie.mp4" type="video/mp4">

<source src="movie.ogg" type="video/ogg">

Your browser does not support the video tag.

</video>

</body>

</html>

4) Explain JavaScript Windows Object Method.

Answer:- Windows Object Method


The important methods of window object are as follows:

Method Description

alert() displays the alert box containing message with ok button.

confirm() displays the confirm dialog box containing message with ok and cancel button.

prompt() displays a dialog box to get input from the user.

open() opens the new window.

close() closes the current window.

5)Explain events in jQuery .

a)click()event b)ready()event c)hide() event

Answer:- a)click()event:- When you click on an element, the click event occurs and
once the click event occurs it execute the click () method or attaches a function to run.

It is generally used together with other events of jQuery.

Syntax:

$(selector).click()

b) ready()event:- The ready() function in jQuery executes the code only when the DOM
(Document object model) is fully loaded. It is an inbuilt function in jQuery.

Syntax:- $(document).ready(function)

c)hide()event:- The jQuery hide() method is used to hide the selected elements.

Syntax:

$(selector).hide();

You might also like