Class 11 Computer Science: JavaScript and HTML5 Essentials
Class 11 Computer Science: Exam-Ready JavaScript and HTML5
Here are concise, exam-ready answers for your Class 11 Computer Science Question Bank:
1. What is Client-Side Scripting?
Client-side scripting refers to programs executed on the user's browser (the client) rather than the server. JavaScript is the most common example. It is used to create interactive web pages, validate forms, and reduce server load.
2. How to Declare a Variable in JavaScript
Variables are containers for storing data. In JavaScript, they are declared using three keywords:
- var: Used in older versions (function-scoped).
- let: Used for block-scoped variables (recommended).
- const: Used for variables whose values remain constant.
Example: let name = "Arsh";
3. JavaScript Data Types
JavaScript data types are categorized into two main groups:
- Primitive: String (text), Number (integers/decimals), Boolean (true/false), Null, Undefined, and Symbol.
- Non-Primitive: Objects and Arrays.
4. JavaScript Operators
Operators are symbols used to perform operations on values:
- Arithmetic: +, -, *, /, %
- Assignment: =, +=, -=
- Comparison: ==, ===, !=, >, <
- Logical: && (AND), || (OR), ! (NOT)
5. What is an Event?
An event is an action or occurrence that happens in the browser, which the software can respond to. Examples include clicking a button (onclick), loading a page (onload), or hovering over an image (onmouseover).
6. The if...else if Statement
This structure is used to test multiple conditions. If the first condition is false, the program checks the next else if block.
7. The if Statement
The if statement is the simplest conditional statement. It executes a block of code only if a specified condition is true.
Example: if (age >= 18) { console.log("Eligible to vote"); }
8. HTML5 Web Page Structure
An HTML5 document follows a semantic structure for better organization:
- <!DOCTYPE html>: Defines the document type.
- <html>: The root element.
- <head>: Contains metadata (title, links to CSS).
- <body>: Contains the visible content.
- Semantic Tags: <header>, <nav>, <main>, <section>, <article>, <footer>.
English with a size of 2.76 KB