Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Extensive response Questions of Unit 3

Rating
-
Sold
-
Pages
0
Uploaded on
28-10-2024
Written in
2024/2025

FBISE NBF based on new curriculum of computer sc

Institution
Freshman / 9th Grade
Course
Computer Science

Content preview

Ms. Amna Altaf Unit:3 Programming Fundamentals Computer Sc

Unit: 3 Programming Fundamentals

Q1. What is document object model? Explain with the help of an example?

The Document Object Model (DOM) is a programming interface for web documents. It represents the structure of a web
page in a hierarchical tree format, where each element, attribute, and piece of text is a node in this tree. The DOM
allows programming languages like JavaScript to interact with and manipulate the content and structure of web pages
dynamically.

Basic Structure of the DOM:

i. Document: The root node representing the entire document.
ii. Elements: Nodes representing HTML tags, such as <div>, <p>, <a>, etc.
iii. Attributes: Nodes representing attributes of HTML elements, such as class, id, and href.
iv. Text: Nodes representing the text content inside elements.

Example: Consider the following HTML snippet:

<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a paragraph.</p>
<a href="https://www.example.com">Click here</a>
</body>
</html>

In this example, the DOM structure would look like this:

Document
└── html
├── head
│ └── title
│ └── "My Web Page"
└── body
├── h1
│ └── "Welcome to My Web Page"
├── p
│ └── "This is a paragraph."
└── a
├── "Click here"
└── href="https://www.example.com"
Q2. Write the code to differentiate between different types of headings in HTML.

The <h1> to <h6> tags are used to define HTML headings. <h1> defines the most important heading. <h6> defines the
least important heading. Note: Only use one <h1> per page - this should represent the main heading/subject for the
whole page.

, Ms. Amna Altaf Unit:3 Programming Fundamentals Computer Sc

The main keyword of the whole content of a webpage should be display by h1 heading tag.
• <h1>Heading no. 1</h1>
• <h2>Heading no. 2</h2>
• <h3>Heading no. 3</h3>
• <h4>Heading no. 4</h4>
• <h5>Heading no. 5</h5>
• <h6>Heading no. 6</h6>




Q3. Elaborate steps & provide code to load a background image in web page.
1. Open the HTML file in text editor.
2. Within the starting <body> tag in your Html file, type <Body background=” “>
3. Give the path of the image we want to add. (Example, <Body background=”C:\Users\APS \Downloads\APS&(GC).jpg “>
4. Save the Html file in the text editor and run the file.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
{
background-image: url('any_image.jpg');
}
</style>
</head>
<body>
<p>You can specify background images <br> for any visible HTML element.<br>
</body>
</html>
Q4. With the help of sample code, highlight different methods to incorporate CSS code in a HTML page.
Ans. Following are the different methods to incorporate CSS code in a HTML page.

• Inline - by using the style attribute inside HTML elements
• Internal - by using a <style> element in the <head> section

Written for

Institution
Freshman / 9th grade
Course
Computer Science
School year
1

Document information

Uploaded on
October 28, 2024
Number of pages
Unknown
Written in
2024/2025
Type
Class notes
Professor(s)
Amna altaf
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
amnaaltaf

Get to know the seller

Seller avatar
amnaaltaf Army Public School
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
7
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions