0% found this document useful (0 votes)
30 views

HTML Cheat Bca

The document provides a comprehensive guide on web and programming basics, covering topics such as the Internet, web browsers, HTTP, URLs, and HTML structure. It explains key concepts like DNS, web caching, and different types of websites, along with HTML tags and CSS rules. Additionally, it discusses JavaScript basics and its integration with HTML, emphasizing the importance of modern web design practices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

HTML Cheat Bca

The document provides a comprehensive guide on web and programming basics, covering topics such as the Internet, web browsers, HTTP, URLs, and HTML structure. It explains key concepts like DNS, web caching, and different types of websites, along with HTML tags and CSS rules. Additionally, it discusses JavaScript basics and its integration with HTML, emphasizing the importance of modern web design practices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Web and Programming Basics Guide • WWW stands for World Wide Web.

1. Define Internet. • It’s a system of interlinked hypertext documents


accessed via the Internet.
• The Internet is a global network of networks
connecting millions of computers and devices. • Uses HTTP and web browsers to view web pages.
(Note: The Internet is the network; the Web is the
• It uses standard communication protocols
content on it.)
(TCP/IP) to share information.
8. What is DNS?
• It allows people worldwide to access websites,
send emails, and use online services. • DNS stands for Domain Name System.

2. What is a search engine? • It translates human-readable domain names (like


example.com) into IP addresses (like
• A search engine is an online tool that finds
93.184.216.34).
information on the web by keywords.
• Acts like an Internet “phonebook” so we use
• It crawls and indexes web pages and ranks results
names instead of numeric addresses.
by relevance.
9. Name any two types of websites.
• Examples include Google, Bing, and
DuckDuckGo – users enter a query and get a list • Static Website: Content is fixed in HTML/CSS.
of links. (Example: a portfolio site where pages don’t
change unless edited.)
3. What is a web browser?
• Dynamic Website: Content is generated on-the-
• A web browser is a software application to
fly by code (PHP, JavaScript, etc.). (Example: e-
access and view web pages.
commerce site, social media.)
• Examples: Chrome, Firefox, Safari, Edge.
10. What is web publishing?
• It requests pages (via HTTP/HTTPS), and renders
• Web publishing is making web content publicly
HTML, CSS, and JavaScript into a visual webpage.
accessible on the Internet.
4. What is HTTP?
• Involves creating HTML/CSS files and uploading
• HTTP stands for HyperText Transfer Protocol. them to a web server.

• It is the protocol used to transfer web pages • Can use tools or CMS (like WordPress) to publish
between servers and clients (browsers). text, images, and other media online.

• Example: When you type http://example.com, the 11. Define HTML.


browser uses HTTP to retrieve the page.
• HTML stands for HyperText Markup Language.
5. What is a URL?
• It is the standard language for creating and
• URL stands for Uniform Resource Locator. structuring web pages.

• It is the address of a resource on the Internet. • Uses tags (like <h1>, <p>, <a>) to define elements
Example: https://www.example.com/index.html. (headings, paragraphs, links).

• Structure: protocol://domain/path (e.g., https:// is 12. What is the use of the <title> tag?
protocol, example.com is domain, /index.html is
• The <title> tag defines the title of the HTML
path).
document.
6. Define web caching.
• It appears in the browser’s title bar or tab.
• Web caching stores copies of web resources
• Important for SEO: search engines use it as the
(pages, images) to speed up access.
page title.
• Browsers and servers save files so repeated
13. Write the structure of a basic HTML document.
requests load faster and use less bandwidth.
A basic HTML document includes a doctype, <html>,
• If a page hasn't changed, the cache can serve the
<head>, and <body> tags:
stored copy instead of downloading again.
<!DOCTYPE html>
7. What is WWW?
<html>
<head> • Examples include:

<title>Page Title</title> o <br> (line break)

</head> o <hr> (horizontal line)

<body> o <img> (image)

<!-- Content goes here --> o <input> (form input)

<h1>Hello, World!</h1> o <meta> (metadata)

<p>This is a paragraph.</p> • These tags perform an action or insert an element


without surrounding content.
</body>
18. What is the use of <marquee> tag?
</html>
• The <marquee> tag was used to create scrolling
14. What is text formatting?
text or images.
• Text formatting in HTML uses tags to style text.
• It is deprecated in HTML5 (not recommended for
• Examples: use).

o <b> or <strong> for bold text. • Example (obsolete): <marquee>Scrolling


text</marquee>.
o <i> or <em> for italic text.
19. What does the <hr> tag do?
o <u> for underline, <sub> for subscript,
<sup> for superscript. • The <hr> tag inserts a horizontal rule (a horizontal
line) in the page.
• These tags change how text looks without
changing its meaning. • It is used to visually separate sections of content.

15. Write the difference between <ol> and <ul>. • Example: <hr> adds a thin horizontal line across
the page.
• <ol> creates an ordered list (numbered items).
20. Name any two heading tags in HTML.
• <ul> creates an unordered list (bulleted items).
• Two heading tags are <h1> and <h2>.
Example:
• There are six levels: <h1> (largest) through <h6>
<ol> (smallest).
<li>First item</li> • Example:
<li>Second item</li> • <h1>Main Title</h1>
</ol> • <h2>Subheading</h2>
<ul> 21. What is the purpose of the <table> tag?
<li>Apple</li> • The <table> tag is used to create tabular data
<li>Banana</li> (rows and columns).

</ul> • It contains <tr> for table rows, <td> for cells, and
<th> for header cells.
16. What is an anchor tag?
• Example:
• The <a> tag defines a hyperlink (anchor).
• <table>
• It uses the href attribute to link to another URL.
• <tr><th>Name</th><th>Age</th></tr>
• Example:
• <tr><td>Alice</td><td>30</td></tr>
• <a href="https://www.example.com">Visit
Example</a> • </table>

17. What are empty tags? Give examples. 22. What does <th> represent in a table?

• Empty tags (self-closing) have no closing tag or • <th> stands for table header cell.
content.
• It defines a header cell in a table row. By default, • Radio Button (<input type="radio">): Allows
its content is bold and centered. selection of one option within a group. Radios with
the same name are linked.
• Example:
• Checkbox (<input type="checkbox">): Allows
• <table>
multiple independent selections. Each checkbox
• <tr><th>Name</th><th>Age</th></tr> is separate.

• <tr><td>Bob</td><td>25</td></tr> • Example:

• </table> • <!-- Radio buttons -->

23. What is the use of rowspan? • <input type="radio" name="color" value="red">


Red
• The rowspan attribute on a <td> or <th> makes that
cell span multiple rows. • <input type="radio" name="color" value="blue">
Blue
• Syntax example: <td rowspan="2">.
• <!-- Checkboxes -->
• This merges cells vertically. For example:
• <input type="checkbox" name="subscribe"
• <table> value="news"> News
• <tr> • <input type="checkbox" name="subscribe"
• <td rowspan="2">Name</td> value="offers"> Offers

• <td>Data1</td> 27. What is the <iframe> tag?

• </tr> • The <iframe> tag embeds another HTML page


inside the current page (inline frame).
• <tr>
• Uses attributes like src, width, height.
• <td>Data2</td>
• Example:
• </tr>
• <iframe src="https://www.example.com"
• </table> width="300" height="200"></iframe>
24. What is a form in HTML? • Often used to embed videos, maps, or other
• A <form> is a section of a webpage used to collect websites.
user input. 28. Define nested frames.
• It can include inputs like text fields, checkboxes, • Nested frames are framesets placed inside other
buttons, etc. framesets.
• Example: • Example of nested <frameset>:
• <form action="/submit" method="post"> • <frameset cols="50%,50%">
• <input type="text" name="username"> • <frameset rows="30%,70%">
• <input type="submit" value="Send"> • <frame src="frame1.html">
• </form> • <frame src="frame2.html">
25. Write the syntax for creating a text field in a form. • </frameset>
• Use the <input> tag with type="text". • <frame src="frame3.html">
• Example: • </frameset>
• <input type="text" name="username" • (Note: Framesets are outdated and not supported
placeholder="Enter your name"> in HTML5.)
• This creates a single-line text field for user input. 29. What are the disadvantages of using frames?
26. Difference between radio button and checkbox. • Frames are outdated and not supported in HTML5.
• They break the browser’s back button and make 34. What is the difference between ID and class
bookmarking difficult. selectors?

• Can cause SEO issues and complicate page • ID Selector (#): Targets an element by its unique
layout. id. Each page element can have only one ID.

• Modern web design uses CSS and modern layout • Class Selector (.): Targets one or more elements
techniques instead. by a shared class. Multiple elements can share the
same class.
30. Write the syntax of <frameset>.
• Example:
• <frameset> was used to define a frames-based
layout (replacing <body>). • <div id="header">...</div>

• Example: • <div class="menu">...</div>

• <frameset cols="50%,50%"> • #header { background: blue; }

• <frame src="left.html"> • .menu { font-size: 16px; }

• <frame src="right.html"> 35. Write the syntax of a CSS rule.

• </frameset> • A CSS rule has the form:

• (Note: <frameset> and <frame> are obsolete in • selector {


HTML5.)
• property: value;
31. What is CSS?
• }
• CSS stands for Cascading Style Sheets.
• Example:
• It is a stylesheet language used to style HTML
• p{
elements (colors, fonts, layout).
• color: blue;
• Example:
• font-size: 16px;
• body { background-color: lightblue; }
• }
• h1 { color: navy; font-size: 24px; }
• Here, p is the selector, and color: blue; is a
32. List the types of CSS.
declaration.
• Inline CSS: Using the style attribute in HTML tags.
36. What is a pseudo-class in CSS?
Example: <p style="color:red;">.
• A pseudo-class is a way to define a special state
• Internal/Embedded CSS: Using a <style> tag in
of an element.
the HTML <head>.
• Examples: :hover (when mouse is over), :active,
• <style>
:visited (link visited).
• h1 { color: green; }
• Example:
• </style>
• a:hover { color: red; } /* changes link color on hover
• External CSS: Using a separate .css file linked */
with <link>.
37. What is a media query?
• <link rel="stylesheet" href="styles.css">
• A media query applies CSS only under certain
33. What is inline CSS? conditions (screen size, device type).

• Inline CSS applies styles directly in an HTML tag’s • Used for responsive design.
style attribute.
• Syntax example:
• Example:
• @media screen and (max-width: 600px) {
• <p style="color: red; font-size: 14px;">This is red
• /* CSS rules for small screens */
text.</p>
• body { background-color: lightgreen; }
• It only affects that specific element.
• }
38. Define the box model. • Event-Driven: Easily responds to events like clicks
or keystrokes.
• The CSS box model describes layout of elements.
• (Other features: Client-side execution, object-
• It has four parts:
oriented, interpreted language, cross-platform.)
o Content: The actual content (text, images).
43. Name different data types in JavaScript.
o Padding: Space between content and
• Number: e.g., 42, 3.14.
border.
• String: text, e.g., "Hello".
o Border: Edge around padding.
• Boolean: true or false.
o Margin: Space outside the border.
• Object: Collections of key/value pairs (includes
• Example visualization:
arrays and functions).
• [ margin ] -> [ border ] -> [ padding ] -> [ content ]
• Null: represents no value.
39. What is the use of z-index?
• Undefined: variable declared but not assigned.
• z-index sets the stacking order of positioned
• Symbol: unique identifier.
elements along the z-axis (depth).
• BigInt: for very large integers (beyond Number
• Higher z-index means the element is on top of
range).
those with lower z-index.
44. How is JavaScript added to HTML?
• It only works on elements with position (e.g.,
relative, absolute). • Use the <script> tag.

• Example: o Inline: Write JS code inside <script> tags.

• .modal { position: absolute; z-index: 10; } o External: Link an external .js file.

40. Write the difference between relative and absolute • Examples:


positioning.
• <!-- Inline JS -->
• Relative (position: relative): Element is
• <script>
positioned relative to its normal position. Other
content is not affected. • console.log('Hello, World!');
• Absolute (position: absolute): Element is • </script>
removed from the normal flow and positioned

relative to the nearest positioned ancestor (or the
viewport if none). • <!-- External JS -->
• Example: • <script src="app.js"></script>
• .relative { position: relative; top: 10px; left: 20px; } 45. Define variable and constant.
• .absolute { position: absolute; top: 50px; left: 50px; • Variable: A named container for data that can
} change. Declared with let or var.
41. What is JavaScript? Example: let count = 10;

• JavaScript (JS) is a scripting language for the web. • Constant: A named container whose value cannot
be changed once set. Declared with const.
• It runs in the browser (and also on servers with Example: const PI = 3.14;
Node.js) to make web pages interactive and
dynamic. 46. Name any two operators in JavaScript.

• Example use: updating content without reloading, • Arithmetic operators: +, -, *, /, % (used for math).
responding to user actions (clicks, forms). • Comparison operators: ==, ===, !=, >, <, <=, >=
42. List any two features of JavaScript. (used to compare values).

• Dynamic Typing: Variables can hold any type • (Other examples: assignment =, logical &&, ||, etc.)
(string, number, etc.) without declaring a type. 47. What is the use of if statement?
• The if statement is used for conditional • A for loop repeats code a specific number of
execution. times.

• It runs a block of code only if a given condition is • Syntax:


true.
• for (let i = 0; i < 5; i++) {
• Example:
• // code to repeat
• if (score > 50) {
• console.log(i);
• console.log("You passed!");
• }
• }
• This runs from i = 0 up to i < 5, incrementing i by 1
48. Write syntax for a for loop. each time.

49. Define a function in JavaScript.

• A function is a reusable block of code that performs a task.

• Declared with the function keyword (or as an arrow function).

• Example:

• function greet(name) {

• return "Hello, " + name + "!";

• }

• console.log(greet("Alice")); // Outputs: Hello, Alice!

50. What is an event in JavaScript?

• An event is an action or occurrence in the browser

(like a click, key press, or page load).

• JavaScript can listen for events and run code

(event handlers) when they occur.

• Example:

• <button id="myBtn">Click me</button>

• <script>

• document.getElementById("myBtn").onclick = function() {

• alert("Button clicked!");

• };

• </script>

You might also like