Académique Documents
Professionnel Documents
Culture Documents
The FileSystemObject, or FSO, is an often used component to access the web server's file
system. For example, you can create files, read the contents of files, determine whether or not a
folder or file exists, iterate through the contents of a folder or directory, or any other number of
file system-related tasks. You can create an instance of the FileSystemObject component in an
ASP page with the following code:
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Ans3.
Applet
Application
Small Program
Large Program
Example:
import java.awt.*;
import java.applet.*;
public class Myclass extends Applet
{
public void init() { }
public void start() { }
public void stop() {}
Ans4.
Ans5.
A stream can be defined as a sequence of data. The InputStream is used to read data from a
source and the OutputStream is used for writing data to a destination. InputStream and
OutputStream are the basic stream classes in Java.
All the other streams just add capabilities to the basics, like the ability to read a whole chunk of
data at once for performance reasons (BufferedInputStream) or convert from one kind of
character set to Java's native unicode (Reader), or say where the data is coming from
(FileInputStream, SocketInputStream and ByteArrayInputStream, etc.)
To perform read and write operation on binary files we need a mechanism to read that binary
data on file/to write binary data (i.e. in the form of byte). These classes are capable to read and
write one byte on binary files. Thats why we use Stream Classes.
Ans 7.
A device context is a structure that defines a set of graphic objects and their associated attributes,
as well as the graphic modes that affect output. The graphic objects include a pen for line
drawing, a brush for painting and filling, a bitmap for copying or scrolling parts of the screen, a
palette for defining the set of available colors, a region for clipping and other operations, and a
path for painting and drawing operations. The remainder of this section is divided into the
following three areas.
Ans8.
Pascal encourages modular programming, where a program is created from a number of smaller
and simpler pieces known as modules. Modules can make call other modules (i.e. execute other
modules), or even call themselves. Pascal supports two kinds of modules, which are called
functions and procedures.
Functions are called in expressions, and each function call has a value in an expression.
Procedures on the other hand are called in procedure statements. In all other respects functions
and procedures are identical, and the generic term subroutine will be used to refer to both types
of modules.
Sometimes it is useful to create subroutines that accept input data and/or produce output data.
One way to achieve this to have the subroutines use global variables (i.e. variables declared in
the main program block) to store the input and output data. However the overuse of global
variables can make programs difficult to understand and change. The basic problem is that since
gloval variables are not specific to any particular subroutine, it can be difficult to keep track of
which subroutines use which global variables and when. As a result, subroutines can become
tightly intertwined making it very difficult to change one subroutine without changing the others.
Ans9/
Generic Programming is a programming paradigm for developing efficient, reusable software
libraries. Pioneered by Alexander Stepanov and David Musser, Generic Programming obtained
its first major success when the Standard Template Library became part of the ANSI/ISO C++
standard. Since then, the Generic Programming paradigm has been used to develop many generic
libraries.
The Generic Programming process focuses on finding commonality among similar
implementations of the same algorithm, then providing suitable abstractions so that a single,
generic algorithm can cover many concrete implementations. This process, called lifting, is
repeated until the generic algorithm has reached a suitable level of abstraction, where it provides
maximal reusability while still yielding efficient, concrete implementations. The abstractions
themselves are expressed as requirements on the parameters to the generic algorithm.
Ans10.
Read information from HTTP, FTP, and gopher servers as easily as reading files from a
hard drive.
Use HTTP, FTP, and gopher protocols without programming directly to WinSock or
TCP/IP.
Developers who use the Win32 Internet functions do not need to be familiar with TCP/IP
or Windows Sockets. You can still program at the socket level, using WinSock and
TCP/IP protocols directly, but it's even easier to use the MFC WinInet classes to access
HTTP, FTP, and gopher protocols across the Internet. For many common operations,
developers do not need to know the details of the particular protocol they are using.
Many operations that can be performed by your computer as a client to other computers on the
Internet can take a long time. The speed of these operations is usually limited by the speed of
your network connection, but they can also be affected by other network traffic and the
complexity of the operation. Connecting to a remote FTP server, for example, requires that your
computer first look up the name of that server to find its address. Your application will then
attempt to connect to the server at that address. Once the connection is opened, your computer
and the remote server will initiate a conversation with the file transfer protocol before you can
actually use the connection to retrieve files.
Ans11.
dialog box in Visual Basic is an example of a modeless dialog box. Use modeless dialog boxes to
display frequently used commands or information.
To display a form as a modal dialog box
Use the Show method with a style argument of vbModal (a constant for the value 1).
For example:
' Display frmAbout as a modal dialog.
frmAbout.Show vbModal
Note If a form is displayed as modal, the code following the Show method is not executed until
the dialog box is closed. However, when a form is shown as modeless, the code following the
Show method is executed immediately after the form is displayed.
The Show method has another optional argument, owner, that can be used to specify a parentchild relationship for a form. You can pass the name of a form to this argument to make that form
the owner of the new form.
To display a form as a child of another form
Use the Show method with both style and owner arguments.
For example:
' Display frmAbout as a modeless child of frmMain.
frmAbout.Show vbModeless, frmMain
Using the owner argument with the Show method ensures that the dialog box will be minimized
when its parent is minimized, or unloaded should the parent form be closed.
Ans13
Java Generic methods and generic classes enable programmers to specify, with a single method
declaration, a set of related methods, or with a single class declaration, a set of related types,
respectively.
Generics also provide compile-time type safety that allows programmers to catch invalid types at
compile time.
Using Java Generic concept, we might write a generic method for sorting an array of objects,
then invoke the generic method with Integer arrays, Double arrays, String arrays and so on, to
sort the array elements.
Generic Methods
You can write a single generic method declaration that can be called with arguments of different
types. Based on the types of the arguments passed to the generic method, the compiler handles
each method call appropriately. Following are the rules to define Generic Methods
All generic method declarations have a type parameter section delimited by angle
brackets (< and >) that precedes the method's return type ( < E > in the next example).
Each type parameter section contains one or more type parameters separated by commas.
A type parameter, also known as a type variable, is an identifier that specifies a generic
type name.
The type parameters can be used to declare the return type and act as placeholders for the
types of the arguments passed to the generic method, which are known as actual type
arguments.
A generic method's body is declared like that of any other method. Note that type
parameters can represent only reference types, not primitive types (like int, double and
char).
Example
Following example illustrates how we can print an array of different type using a single Generic
method
public class GenericMethodTest {
// generic method printArray
public static < E > void printArray( E[] inputArray ) {
// Display array elements
for(E element : inputArray) {
System.out.printf("%s ", element);
}
System.out.println();
}
public static void main(String args[]) {
// Create arrays of Integer, Double and Character
Integer[] intArray = { 1, 2, 3, 4, 5 };
Double[] doubleArray = { 1.1, 2.2, 3.3, 4.4 };
Character[] charArray = { 'H', 'E', 'L', 'L', 'O' };
Ans14.
There are two data types available in Java
Default value is 0
Byte data type is used to save space in large arrays, mainly in place of integers, since a
byte is four times smaller than an integer.
short
Short data type can also be used to save memory as byte data type. A short is 2 times
smaller than an integer
Default value is 0.
Integer is generally used as the default data type for integral values unless there is a
concern about memory.
int
long
Default value is 0L
float
Float is mainly used to save memory in large arrays of floating point numbers
Float data type is never used for precise values such as currency
double
This data type is generally used as the default data type for decimal values, generally the
default choice
Double data type should never be used for precise values such as currency
boolean
This data type is used for simple flags that track true/false conditions
char
Reference Datatypes
Reference variables are created using defined constructors of the classes. They are used
to access objects. These variables are declared to be of a specific type that cannot be
changed. For example, Employee, Puppy, etc.
Class objects and various type of array variables come under reference datatype.
A reference variable can be used to refer any object of the declared type or any
compatible type.
Ans15.
Features of Java
1. Features of Java
1. Simple
2. Object-Oriented
3. Platform Independent
4. secured
5. Robust
6. Architecture Neutral
7. Portable
8. High Performance
9. Distributed
10.Multi-threaded
There is given many features of java. They are also known as java buzzwords. The Java Features
Simple
According to Sun, Java language is simple because:
syntax is based on C++ (so easier for programmers to learn it after C++).
removed many confusing and/or rarely-used features e.g., explicit pointers,
operator overloading etc.
No need to remove unreferenced objects because there is Automatic Garbage
Collection in java.
Object-oriented
Object-oriented means we organize our software as a combination of different
types of objects that incorporates both data and behaviour.
Object-oriented programming(OOPs) is a methodology that simplify software
development and maintenance by providing some rules.
Basic concepts of OOPs are:
1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
Platform Independent
based platform.
The Java platform differs from most other platforms in the sense that it is a
software-based platform that runs on the top of other hardware-based platforms. It
has two components:
1. Runtime Environment
2. API(Application Programming Interface)
Java code can be run on multiple platforms e.g. Windows, Linux, Sun Solaris, Mac/OS etc. Java
code is compiled by the compiler and converted into bytecode. This bytecode is a platformindependent code because it can be run on multiple platforms i.e. Write Once and Run
Anywhere(WORA).
Secured
No explicit pointer
Classloader: adds security by separating the package for the classes of the
local file system from those that are imported from network sources.
Bytecode Verifier: checks the code fragments for illegal code that can
These security are provided by java language. Some security can also be provided by application
developer through SSL, JAAS, Cryptography etc.
Robust
Robust simply means strong. Java uses strong memory management. There are lack of pointers
that avoids security problem. There is automatic garbage collection in java. There is exception
handling and type checking mechanism in java. All these points makes java robust.
Architecture-neutral
Portable
High-performance
Java is faster than traditional interpretation since byte code is "close" to native
code still somewhat slower than a compiled language (e.g., C++)
Distributed
We can create distributed applications in java. RMI and EJB are used for creating
distributed applications. We may access files by calling the methods from any
machine on the internet.
Multi-threaded
A thread is like a separate program, executing concurrently. We can write Java programs that
deal with many tasks at once by defining multiple threads. The main advantage of multi-
threading is that it doesn't occupy memory for each thread. It shares a common memory area.
Threads are important for multi-media, Web applications etc.