0% found this document useful (0 votes)
5 views19 pages

Untitled Document-22

The document provides an overview of various computer science concepts, including HTML table creation, DHTML, XML, XHTML, JavaScript control statements, CSS, Java, data types, variables, and arrays in Java. It outlines the structure and usage of these technologies, emphasizing their roles in web development and programming. Each section includes definitions, key features, and examples to illustrate the concepts.
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)
5 views19 pages

Untitled Document-22

The document provides an overview of various computer science concepts, including HTML table creation, DHTML, XML, XHTML, JavaScript control statements, CSS, Java, data types, variables, and arrays in Java. It outlines the structure and usage of these technologies, emphasizing their roles in web development and programming. Each section includes definitions, key features, and examples to illustrate the concepts.
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/ 19

COMPUTER SCIENCE (PAPER II)

1.How do you create table using HTML?

Ans: Creating a basis table in HTML

Step 1: Start with the <table> tag


This tells the browser you're creating a table.

Step 2: Add a table row using <tr>


Each row in the table is wrapped with the <tr> tag.

Step 3: Add headers using <th>


Headers go inside a row (usually the first one) to label each column.

Step 4: Add more rows with data using <td>


Use <td> for each cell in the rows after the headers.

<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

Ans: HTML, or HyperText Markup Language, is the fundamental


language for creating web pages. It defines the structure and content of
a webpage, using tags to mark up text, images, links, and other
multimedia elements. HTML is used in conjunction with CSS and
JavaScript to create a functional and visually appealing website.

DHTML: DHTML (Dynamic HTML) is a collection of technologies used


together to create interactive and animated websites.

Key Components of DHTML:

HTML – for page structure

CSS – for styling

JavaScript – for interactivity and logic

DOM (Document Object Model) – for accessing and changing page


elements dynamically

Main Features of DHTML:

Content can change without reloading the page

Allows real-time effects like:


Moving images or text
Drop-down menus
Form validation
Hide/show sections

XML (Extensible Markup Language) is a markup language used to


store, transport, and structure data in a format that both humans and
machines can read.
COMPUTER SCIENCE (PAPER II)

Key Features of XML:

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.

Platform-independent: Works across different systems and applications.

Not for displaying data: It's meant for carrying data, not showing it like
HTML.

Common Uses of XML:

Data transfer between systems (e.g., APIs, web services)

Configuration files (e.g., Android apps, server settings)

Document formats (e.g., Microsoft Office, RSS feeds).

XHTML (Extensible Hypertext Markup Language) is a stricter,


XML-based version of HTML used for creating web pages.

Key Features of XHTML:

Follows XML rules (which are stricter than HTML).

Tags must be:

Properly closed (<br /> instead of <br>)

Lowercase

Properly nested
COMPUTER SCIENCE (PAPER II)

Makes web pages more consistent, cleaner, and easier to parse.

Designed to make web content more robust, portable, and compatible


with XML tools.

Encourages clean, error-free code.


Common Uses of XHTML:

1. Well-structured Web Pages


XHTML enforces clean and consistent code, which is useful for building
web pages that are easy to maintain and validate.

2. Mobile Web Development (Early Mobile Browsers)


Older mobile browsers (like early WAP browsers) required XHTML
because of its strict XML structure.

3. Integration with XML-based Systems


XHTML works well with other XML tools and technologies like XSLT and
XPath, making it a good fit for web systems that exchange data using
XML.

4. Web Applications Needing Strict Standards


Some enterprise or government sites use XHTML to meet accessibility
and coding standards.

5. Legacy Support
Older web platforms or content management systems may still rely on
XHTML formats.
COMPUTER SCIENCE (PAPER II)

3. What is control statment in java script?

Ans: A control statement in JavaScript is a command that controls the


flow of execution in a program. These statements decide how and when
certain blocks of code run.

Types of Control Statements in JavaScript:

1. Conditional Statements (Decision-making):

Used to run code only if a condition is true.

if (age > 18) {


console.log("Adult");
} else {
console.log("Minor");
}

2. Switch Statement:

Used to test multiple conditions.

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)

3. Looping Statements (Iteration):

Repeat a block of code multiple times.

// 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:

Used to alter the normal flow (e.g., exit loops).

// 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)

4. Explain CSS in detail?

Ans: CSS (Cascading Style Sheets) is a language designed to simplify


the process of making web pages presentable.

It allows you to apply styles to HTML documents by prescribing colors,


fonts, spacing, and positioning.

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.

HTML uses tags and CSS uses rule sets.

CSS styles are applied to the HTML element using selectors.

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.

Selector: Targets specific HTML elements to apply styles.


Declaration: Combination of a property and its corresponding value.
// HTML Element
<h1>GeeksforGeeks</h1>
COMPUTER SCIENCE (PAPER II)

// 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)

5. What is use of javascript?

Ans: JavaScript is a programming language used to create dynamic


content for websites. It achieves this by adding new HTML elements
while modifying existing ones. Many coders enhance web development
skills using JavaScript to create user-friendly and interactive websites.

Here's a more detailed look at its uses:


1. Front-End Web Development:

Making websites interactive:


JavaScript allows for the creation of dynamic content, animations,
pop-up menus, and other interactive elements.

Improving user experience:


By adding features like form validation and real-time data updates,
JavaScript enhances the user experience on websites.

Creating dynamic content:


It allows developers to modify the content of a web page without
reloading the entire page.

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.

Interacting with the Document Object Model (DOM):


JavaScript can modify HTML and CSS, allowing for dynamic updates to
the user interface.

3. Beyond Web Development:


Mobile App Development:
JavaScript can be used to develop mobile applications using frameworks
like React Native.
COMPUTER SCIENCE (PAPER II)

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.

In summary, JavaScript is a versatile language that empowers


developers to create engaging and dynamic web experiences, and its
versatility extends beyond web development into various other areas of
software development.
COMPUTER SCIENCE (PAPER II)

6.What is JAVA?

Ans:

Java is a widely used, high-level, object-oriented programming language


and software platform developed by Sun Microsystems (now owned by
Oracle). It's known for its platform independence, meaning code can be
written once and run on any device with a Java Virtual Machine (JVM).
Java is a popular choice for developing web applications, enterprise
software, and mobile apps.

Here's a more detailed breakdown:


Key Features:
Object-oriented:
Java's design revolves around the concept of objects, which are
instances of classes and encapsulate both data (attributes) and behavior
(methods).

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.).

Automatic memory management:


Java uses a garbage collector, which automatically manages memory
allocation and deallocation, reducing the risk of memory leaks.

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)

7. Explain data types in JAVA?

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.

Primitive Data Types

There are eight primitive data types in Java:

(i)byte: Stores whole numbers from -128 to 127 (8-bit signed two's
complement integer).

(ii)short: Stores whole numbers from -32,768 to 32,767 (16-bit signed


two's complement integer).

(iii)int: Stores whole numbers from -2,147,483,648 to 2,147,483, 647


(32-bit signed two's complement integer).

(iv)long: Stores whole numbers from -9,223,372,036,854,775,808 to


9,223,372,036,854,775,807 (64-bit signed two's complement integer).

(v)float: Stores single-precision floating-point numbers (32-bit).

(vi)double: Stores double-precision floating-point numbers (64-bit).

(vii)boolean: Stores true or false values.

(viii)char: Stores a single 16-bit Unicode character.

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)

8.What is variables? Explain variables in Java?

Ans: A variable is a container used to store data or information that can


be used and changed in a program.

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:

1. Declared with a data type


2. Given a name
3. Optionally initialized (given a value)

Syntax:
dataType variableName = value;

Example:
int age = 25;
String name = "Alice";

Types of Variables in Java:

1. Local Variable

Declared inside a method or block.

Only accessible within that method.

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
}

3. Static Variable (Class Variable)

(i)Declared with static keyword.


(ii)Shared among all objects of a class.

class Person {
static String species = "Human"; // static variable
}
COMPUTER SCIENCE (PAPER II)

9.Explain Array in JAVA?


Ans: Array in java

Array is a collection of similar type of data. It is fixed in size means that


you can't increase the size of array at run time. It is a collection of
homogeneous data elements. It stores the value on the basis of the
index value.

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.

Code Optimization: No, need to declare a lot of variable of same type


data, We can retrieve and sort data easily.

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

There are two types of array in Java.

Single Dimensional 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)

You might also like