Untitled Document-22
Untitled Document-22
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>Alice</td>
<td>30</td>
<td>New York</td>
</tr>
<tr>
<td>Bob</td>
<td>25</td>
<td>Chicago</td>
</tr>
</table>
COMPUTER SCIENCE (PAPER II)
2.What is DHTML,XML,XHTML
Self-descriptive: Data is stored with custom tags that describe what it is.
User-defined tags: Unlike HTML, you can create your own tag names.
Not for displaying data: It's meant for carrying data, not showing it like
HTML.
Lowercase
Properly nested
COMPUTER SCIENCE (PAPER II)
5. Legacy Support
Older web platforms or content management systems may still rely on
XHTML formats.
COMPUTER SCIENCE (PAPER II)
2. Switch Statement:
switch(day) {
case 'Monday':
console.log("Start of the week");
break;
case 'Friday':
console.log("Weekend is coming!");
break;
default:
console.log("Just another day");
}
COMPUTER SCIENCE (PAPER II)
// For loop
for (let i = 0; i < 5; i++) {
console.log(i);
}
// While loop
let i = 0;
while (i < 5) {
console.log(i);
i++;
}
4. Jump Statements:
// break
for (let i = 0; i < 5; i++) {
if (i === 3) break;
console.log(i);
}
// continue
for (let i = 0; i < 5; i++) {
if (i === 2) continue;
console.log(i);
}
COMPUTER SCIENCE (PAPER II)
The main advantages are the separation of content (in HTML) and
styling (in CSS) and the same CSS rules can be used across all pages
and not have to be rewritten.
Why CSS?
Saves Time: Write CSS once and reuse it across multiple HTML pages.
Easy Maintenance: Change the style globally with a single modification.
Search Engine Friendly: Clean coding technique that improves
readability for search engines.
Superior Styles: Offers a wider array of attributes compared to HTML.
Offline Browsing: CSS can store web applications locally using offline
cache, allowing offline viewing.
CSS Syntax
CSS consists of style rules that are interpreted by the browser and
applied to the corresponding elements. A style rule set includes a
selector and a declaration block.
// CSS Style
h1 { color: blue; font-size: 12px; }
Where -
Selector - h1
Declaration - { color: blue; font-size: 12px; }
The selector points to the HTML element that you want to style.
The declaration block contains one or more declarations separated by
semicolons.
Each declaration includes a CSS property name and a value, separated
by a colon.
Example
p{
color: blue;
text-align: center;
}
Syntax :
<html>
<head>
</head>
<body>
<p style="color: red;">This is inline CSS.</p>
</body>
</html>
COMPUTER SCIENCE (PAPER II)
2. Client-Side Scripting:
Running code in the browser:
JavaScript code is executed directly by the user's web browser, making
it a client-side programming language.
Game Development:
JavaScript can be used to create in-browser games and animations.
Virtual Reality and Augmented Reality:
JavaScript can be used in conjunction with other technologies to develop
VR/AR experiences.
Data Visualization:
JavaScript can be used to create interactive and engaging data
visualizations.
Backend Development:
Although primarily a client-side language, JavaScript can also be used
for backend development using Node.js.
6.What is JAVA?
Ans:
Platform independence:
Java code compiles into bytecode, which is then executed by the JVM,
allowing it to run on various operating systems (Windows, macOS,
Linux, etc.).
Secure:
Java is designed with security in mind, and its bytecode is verified before
execution, helping to prevent malicious code from being executed.
Robust:
Java's strong type system and extensive
exception handling mechanism contribute to the robustness of
applications.
COMPUTER SCIENCE (PAPER II)
Simple:
While powerful, Java's syntax is relatively easy to learn and understand,
making it a good choice for both beginners and experienced developers.
Common Uses:
Web applications:
Java is used for building web applications, including server-side logic
and user interfaces.
Enterprise software:
Java is a popular choice for developing large-scale enterprise
applications and systems.
Mobile applications:
Java is used for developing Android mobile apps and other mobile
applications.
Desktop applications:
Java can be used to create desktop applications, though other
languages like Kotlin or JavaFX are often preferred for modern desktop
development.
Other applications:
Java is also used in various other applications, such as game
development, scientific computing, and data analysis.
COMPUTER SCIENCE (PAPER II)
Ans:
Data types in Java specify the type of value that a variable can hold.
Java has two main categories of data types: primitive and reference.
(i)byte: Stores whole numbers from -128 to 127 (8-bit signed two's
complement integer).
Non-primitive types can be assigned null, which is not the case for
primitive types.
Common examples of non-primitive data types include:
(i)Classes:
COMPUTER SCIENCE (PAPER II)
Classes are blueprints for objects, defining their attributes (fields) and
behaviors (methods). An object is an instance of a class.
(ii)Interfaces:
Interfaces define a contract that classes can implement. They specify
methods that implementing classes must provide.
(iii)Arrays:
Arrays are ordered collections of elements of the same data type. They
can store multiple values under a single variable name.
(iv)Strings:
Strings represent sequences of characters. In Java, strings are objects
of the String class.
COMPUTER SCIENCE (PAPER II)
Think of it like a labeled box that holds a value — like a number, text, or
object — so you can refer to it by name.
Variables in Java
In Java, a variable must be:
Syntax:
dataType variableName = value;
Example:
int age = 25;
String name = "Alice";
1. Local Variable
void greet() {
String message = "Hello!";
System.out.println(message);
}
COMPUTER SCIENCE (PAPER II)
2. Instance Variable
(i)Declared in a class, outside methods.
(ii)Belongs to an object.
class Person {
String name; // instance variable
}
class Person {
static String species = "Human"; // static variable
}
COMPUTER SCIENCE (PAPER II)
Advantage of Array
One variable can store multiple value: The main advantage of the array
is we can represent multiple value under the same name.
Random access: We can retrieve any data from array with the help of
the index value.
Disadvantage of Array
The main limitation of the array is Size Limit when once we declare array
there is no chance to increase. and decrease the size of an array
according to our requirement, Hence memory point of view array
concept is not recommended to use. To overcome this limitation in Java
introduce the collection concept.
COMPUTER SCIENCE (PAPER II)
Types of Array
Multidimensional Array
Single-dimensional arrays:
Structure: They are linear lists, like a row of items.
Indexing: Elements are accessed by their position (index) in the list,
starting from 0.
Example: int[] numbers = {1, 2, 3, 4, 5};
Use: Suitable for storing sequences of data, like a list of names or a set
of scores.
Multi-dimensional arrays:
Structure:They are arrays of arrays, often visualized as tables with rows
and columns.
Indexing:
Elements are accessed using multiple indices, one for each dimension.
For example, a two-dimensional array (like a table) uses a row index and
a column index.
Example:int[][] matrix = {{1, 2}, {3, 4}};. This creates a 2x2 matrix (2 rows
and 2 columns).
Use:
Ideal for representing tabular data, images (pixels arranged in rows and
columns), or other data with inherent spatial structure.
COMPUTER SCIENCE (PAPER II)