JAVA - Yimg

hedgebornabaloneSoftware and s/w Development

Dec 2, 2013 (3 years and 8 months ago)

54 views

JAVA



What is the difference between procedural and object
-
oriented programs?
-




What are Encapsulation, Inheritance and Polymorphism



What is the difference between Assignment and Initialization?



What is the difference between an Interface and an Abstract
class?



What is the purpose of garbage collection in Java, and when is it used?



Explain different way of using thread? Describe synchronization in respect to
multithreading.



Difference between Vector and ArrayList?



What are passby reference and passby val
ue?



What is HashMap and Map?



Difference between Swing and Awt?



What is the difference between a constructor and a method?



State the significance of public, private, protected, default modifiers both singly and in
combination.



What is static in java?



What is final?



What are Class, Constructor and Primitive data types?



What is a reflection package?



What is the difference between Integer and int?



What is the difference between exception and error?



What is the difference between process and thread?



What is an applet? What is the difference between
applications

and applets?



What is the difference between scrollbar and scrollpane?



What is a clone able interface and how many metho
ds does it contain.



What is the difference between String and String Buffer?



What is an I/O filter? What is BDK?



What is serialization and deserialization?



What are JDBCWhat are drivers available? What is the difference between JDBC and
ODBC?



What is a

Java Bean

? What is a ?



What is servlet? How are Servlets and
JSP

Pages related?



What are Predefined variable
s or implicit objects?




How could Java classes direct program messages to the
system

console, but

error
messages, say to a file?






Does it matter in what order catch

statements for FileNotFoundException and
IOExceptipon are written?




When you declar
e a method as abstract method ?




What is the difference between checked and

Unchecked Exceptions in Java ?




What are different types of
inner classes ?




How can i te
ll what state a thread is in ?




What is serialization ?



What are the static fields & static Methods ?




What are the uses of Serialization?




What is the difference between notify and notify All methods ?




What is seri
alization ?





What is a transient variable?



What is an Iterator interface?



What is clipping?



What invokes a thread's run() method?



Which

containers may have a MenuBar?




What is the difference between a Window and a Frame?



Is &&= a valid
Java operator?



What is the difference between static and non
-
static variables?



Name four Container classes.



How are the elements of a GridLayout organized?



What is a compilation unit?



To what value is a variable of the boolean type automatically initialize
d?



Why do we need public static void main(String args[]) method in Java?



What are null or Marker interfaces in Java?



How many number of non
-
public class definitions can a source file have A source file
can contain unlimited number of non
-
public class defin
itions List primitive data types,
there size and there range (min, max).



What are access modifiers?



What are wrapped classes?



What is the difference between while and do while loop?



What's the difference between constructors and other methods?



Where does j
ava thread support reside?



What is the ultimate ancestor of all java classes?






DIFFERENCES:

DBMS & RDBMS:

DBMS stands for Database Management System which is a general term for a set of software dedicated
to controlling the storage of data.

RDMBS stan
d for Relational DataBase Management System. This is the most common form of DBMS.
Invented by E.F. Codd, the only way to view the data is as a set of tables. Because there can be
relationships between the tables, people often assume that is what the word
"relational" means. Not so.
Codd was a mathematician and the word "relational" is a mathematical term from the science of set
theory. It means, roughly, "based on tables".

A DBMS has to be persistent, that is it should be accessible when the program creat
ed the data ceases
to exist or even the application that created the data restarted. A DBMS also has to provide some
uniform methods independent of a specific application for accessing the information that is stored.


RDBMS is a Relational Data Base Manage
ment System Relational DBMS. This adds the additional
condition that the system supports a tabular structure for the data, with enforced relationships between
the tables. This excludes the databases that don't support a tabular structure or don't enforce
r
elationships between tables.

Structure and UNION:

union is a way of providing an alternate way of describing the same memory area. In this way, you could
have a struct that contains a union, so that the "static", or similar portion of the data is described

first,
and the portion that changes is described by the union. The idea of a union could be handled in a
different way by having 2 different structs defined, and making a pointer to each kind of struct. The
pointer to struct "a" could be assigned to the v
alue of a buffer, and the pointer to struct "b" could be
assigned to the same buffer, but now a
-
>somefield and b
-
>someotherfield are both located in the same
buffer. That is the idea behind a union. It gives different ways to break down the same buffer are
a.

The difference between structure and union in c are: 1. union allocates the memory equal to the
maximum memory required by the member of the union but structure allocates the memory equal to
the total memory required by the members. 2. In union, one blo
ck is used by all the member of the
union but in case of structure, each member have their own memory space

STRUCTURE AND CLASS:

The struct default access type is public. A struct
should

typica
lly be used for grouping data.

The class default access type i
s private, and the default mode for inheritance is private. A class
should

be
used for grouping data and meth
ods that operate on that data.
In short, the convention is to use struct
when the purpose is to group data, and use classes when we require data a
bstraction and, perhaps
inheritance.
In C++ structures and classes are passed by value, unless explicitly de
-
referenced. In other
languages classes and structures may have distinct semantics
-

ie. objects (instances of classes) may be
passed by reference a
nd structures may be passed by value.

FUNCTION AND PROCEDURE:

A function returns a value and a procedure just executes commands.The name function comes
from math. It is used to calculate a value based on input.

A procedure is a set of command which
can be
executed in order.

In most programming languages, even functions can have a set of
commands. Hence the difference is only in the returning a value part.

ABSTRACT CLASS AND INTERFACE:

1
)We define an Interface in the Java application with a

set of abstrac
t methods without any implementation. Which

means all the methods of an interface are by default

abstract methods and public methods.

2)Once an Interface is defined in the application then any

class can implement that interface, in such case the class

must be implemented with all the mehtods of the respective

Interface otherwise the class will become as abstract class.

3)A class can implement any no. of interfaces, in such case

the class must be implimented with all the methods of those

interfaces ot
herwise the class will become as abstract class

(OR)


1) Abstract class defines few or none of the methods, but

interface defines all the methods..

2) Abstract classes should have subclasses else that will

be useless..

Interfaces must have implementation
s by other classes else

that will be useless

3)only an interface can extend another interface, but any

class can extend an abstract class..

4)All variable in interfaces are final by default



ORACLE AND SQL

sql
-

Structured Query Language Oracle
-

It is
a one t
ype of DBMS software SQL
-----


Sql is a comman language for DBMS,RDBMS,ORDBMS.It is a language used to query(
insert/retrieve/delete/u
pdate) the records in database.

I
n this sql,sql plus are there.

It is a world
widely a
ccepted language for databa
se.

Ex: c,c++

ORACLE


It is a software package, that is used to handl
e or to maintaine the databse.

It is a software to
give the structure of database storage. * Oracle 7, Oralce 8, Oracle 8i, Oracle 9i, Oracle 11i are
available in market.


It is a compa
ny called" Ora
lce " to produce this software.

Ex: Turbo C, Borland C



ARRAY AND LIST:

An array has a changeable length. A list
does not. An array is something
you can push or pop, while a list
is a
set of values. Some people make
the distinction that a l
ist is a value while an array is a variable.

Subroutines are passed and return
lists, you put things into list
context, you initialize arrays with list
s,
and you "foreach()" across a
list. "@" variables are arrays, anonymous arrays are arrays, arrays in

sc
alar context behave like the number of elements in them, subroutines

access their arguments through
the arr
ay @_, and "push"/"pop"/"shift" only work on arrays.
As a side note, there's no such thing as

a
list in scalar context. When
you say


$scalar = (2, 5
, 7, 9);


you're using the comma operator in scalar context, so it uses the scalar

comma operator. There never was a list there at all! This causes the

last value to be returned: 9.

Vector, Array and Arraylist

1.Vector and Arraylist are grownable or shinka
ble where are array is not.

2.Vector and Arraylist are implemented from List interface where as array is a primitive data
type

3.Vector is Synchrnized where as arraylist is not

4.For best performance better to use arraylist than vector

ARRAY AND ARRAY L
IST:

Array is the collection of values of the same data type

>the
variables

in an array is called array elements

>Array is a reference type data type

>The array structure in System's Memory


Array list is a class .

>when you want to access the elements of
an array through its index value location in an
array,use an ArrayList.

>The use of the arraylist is an alternative to the use of th array.

>The Methods Of ArrayList class are

1)Add

2)Remove

3)Clear

4)Insert

5)TrimToSize

6)Sort

7)Reverse

ABSTRACTION AND EN
CAPSULATION:

Abstraction is achieved through encapsulation..Abstraction solves the problem in the design side
while encapsulation is theimplementation.

Abstraction is virtual
class design
.Before actually
defining class developer will think about what all p
roperties methods and event will be there in
my class. Whereas encapsulation is data hiding.At the time of class defenation developer will
think about which should display to end user and which should not.In Short Abstraction is
Collection of data and Enca
psulation is Exposure (or grouping) of data in appropriate access
specifier .

COMPILER AND INTERPRETER:

An interpreter translates some form of source code into a

target representation that it can immediately execute and

evaluate. The structure of the inter
preter is similar to

that of a compiler, but the amount of time it takes to

produce the executable representation will vary as will the

amount of optimization.


Compiler characteristics:

* spends a lot of time analyzing and processing the program

* resulti
ng executable is some form of machine
-

specific

binary code

* the computer hardware interprets (executes) the resulting code

* program execution is fast


Interpreter characteristics:

* relatively little time is spent analyzing and processing

the program

*
the resulting code is some sort of intermediate code

* the resulting code is interpreted by another program

* program execution is relatively slow

HUB AND SWITCH

HUB works on Physical layer where as SWITCH works on data link layer,HUB based networks
are on

one collision domain where as in Switch based network switch divides networks into
multiple collision domains.Switch also maintains MAC address tables.A Simple SimilieHub
-

Think of a postman with a letter to deliver in a row of houses, none of the houses

have numbers
so he has to visit each house and ask the owner if the letter is for them.

Switch
-

All the houses are numbered, so the postman knows where to go, and doesn't have to
bother any other home owners
.



IPV4 & IPV6

IPv6 is based on IPv4, it is an

evolution of IPv4. So many things that we find with IPv6 are familiar to us.
The main differences are:

1.Simplified header format. IPv6 has a fixed length header, which does not include most of the options
an IPv4 header can include. Even though the IPv6

header contains two 128 bit addresses (source and
destination IP address) the whole header has a fixed length of 40 bytes only. This allows for faster
processing.

Options are dealt with in extension headers, which are only inserted after the IPv6 header
if needed. So
for instance if a packet needs to be fragmented, the fragmentation header is inserted after the IPv6
header. The basic set of extension headers is defined in RFC 2460.

2.Address extended to 128 bits. This allows for hierarchical structure of

the address space and provides
enough addresses for almost every 'grain of sand' on the earth. Important for security and new
services/devices that will need multiple IP addresses and/or permanent connectivity.

3.A lot of the new IPv6 functionality is bu
ilt into ICMPv6 such as Neighbor Discovery, Autoconfiguration,
Multicast Listener Discovery, Path MTU Discovery.

4.Enhanced Security and QoS Features.

MAC AND IP:

MAC address is fixed to the hardware device (for example a network card) and can not be chan
ged. IP
address is assignable. The default IP address for a device can be computed by converting the four right
-
most numbers of the MAC address from hex to decimal.