You are on page 1of 13

1. Define Applet.

2. Define Applet life cycle

Applet life cycle is a process of how an object in java is created, initiated, ended, and destroyed
during its entire cycle of execution in an application.
It has five core methods which are, init(), start(), stop(), paint() and destroy(). In java, their methods
are invoked for execution.

3. Define HTML

HTML stands for Hyper Text Markup Language. HTML is the standard markup language for creating
Web pages. HTML describes the structure of a Web page. HTML consists of a series of elements.
HTML elements tell the browser how to display the content.

4. What is Applet tag

The <APPLET> tag resembles the HTML <IMG> image tag. It contains attributes that identify the
applet to be displayed and, optionally, give the web browser hints about how it should be
displayed. [50] The standard image tag sizing and alignment attributes, such as height and width,
can be used inside the applet tag.

5. What is Stream. Class

The Stream class defines objects which accepts a sequence of characters. Streams may also have an output
in which case multiple stream objects can be cascaded to build a stream pipe where the output of a stream
is directed into the input of the next stream object "down the line".

6. What is file

In Java, a File is an abstract data type. A named location used to store related
information is known as a File. There are several File Operations like creating a
new File, getting information about File, writing into a File, reading from a File
and deleting a File.

7. Write down a purpose of file write class or file reader class.

The purpose of FileReader class is to read the streams of characters. This class inherits form the
InputStreamReader class.
The Purpose of FileWriter class is to write streams of characters. This class inherits from the
OutputStreamWriter class.

3M
1. Function of file class.

2. What is random excess file.

a. RandomAccessFile in java is a class that lets the user read and write to a file at the same
time.
b. It extends the Object class and implements DataInput and DataOutput interfaces.
c. These interfaces facilitate the conversion of primitive type data to a sequence of bytes and
bytes to specified type data.
d. It is used to read and write data to a file simultaneously. The file acts as a large array of
bytes stored in the file system.
e. Methods of this class usually throw EOFException i.e. End of File Exception if the end of the
file is reached before the desired number of bytes are read. It is a type of IOException.
f. IOException is thrown if any error occurs other than EOFException like if the byte cannot be
read or written.

3. Write any 3 input stream methods of byte stream class.

Any 3
4. Explain any 3 method of applet clas
5. How to applet differ from application program.

6. Explain the purpose of param tag.


5M
1. Explain Output Stream class with example

2. Explain reader class with example


In this tutorial, we will learn about Java Reader, its subclasses and its methods with the help
of an example.

The Reader class of the java.io package is an abstract superclass that represents a stream of
characters.
Since Reader is an abstract class, it is not useful by itself. However, its subclasses can be used
to read data.

import java.io.Reader;
import java.io.FileReader;
class Main {
public static void main(String[] args) {

// Creates an array of character


char[] array = new char[100];

try {
// Creates a reader using the FileReader
Reader input = new FileReader("input.txt");

// Checks if reader is ready


System.out.println("Is there data in the stream? " + input.ready());

// Reads characters
input.read(array);
System.out.println("Data in the stream:");
System.out.println(array);

// Closes the reader


input.close();
}

catch(Exception e) {
e.getStackTrace();
}
}
}

Output

Is there data in the stream? true


Data in the stream:
This is a line of text inside the file.

3. What is applet tag. Explain with example.


4. Write a program to pass a parameter

5. Explain stock destroy method in applet.


10 M
1. What is applet? Life cycle of applet in detail.
OR
2. How to pass parameter with example
3. How to build applet code . explain its syntax example.
4. Discuss any 10 HTML tag with example.

I. <h1> - Heading Tag: Represents the main heading of a webpage.

Example: <h1>Welcome to My Website</h1>

II. <p> - Paragraph Tag: Defines a paragraph of text.

Example: <p>This is a paragraph of text.</p>

III. <a> - Anchor Tag: Creates a hyperlink to another webpage or resource.

Example: <a href="https://www.example.com">Click here</a>

IV. <img> - Image Tag: Inserts an image into the webpage.

Example: <img src="image.jpg" alt="Image description">

V. <ul> - Unordered List Tag: Defines an unordered (bulleted) list.

Ex –

<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
VI. <ol> - Ordered List Tag: Defines an ordered (numbered) list.
Ex-
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>

VII. <div> - Division Tag: Defines a division or section of a webpage.

Example: <div>This is a division.</div>

VIII. <table> - Table Tag: Creates a table with rows and columns.
Ex-
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
IX. <form> - Form Tag: Represents an HTML form for user input.
Ex –
<form action="/submit" method="post">
<input type="text" name="username" placeholder="Enter your username">
<input type="password" name="password" placeholder="Enter your password">
<input type="submit" value="Submit">
</form>

X. <span> - Span Tag: Defines a section within a document.

Example: <span style="color: red;">This is a red span.</span>

5. What is file class. Explain how to open and close file class.

You might also like