As my friend was passing the elephants, he suddenly stopped, confused by the fact that these huge creatures were being held by only a small rope tied to their front leg. No chains, no cages. It was obvious that the elephants could, at anytime, break away from the ropes they were tied to but for some reason, they did not. My friend saw a trainer nearby and asked why these beautiful, magnificent animals just stood there and made no attempt to get away.
"Well," he said, "when they are very young and much smaller we use the same size rope to tie them and, at that age, it's enough to hold them. As they grow up, they are conditioned to believe they cannot break away. They believe the rope can still hold them, so they never try to break free." My friend was amazed. These animals could at any time break free from their bonds but because they believed they couldn't, they were stuck right where they were.
Like the elephants, how many of us go through life hanging onto a belief that we cannot do something, simply because we failed at it once before? So make an attempt to grow further.... Why shouldn't we try it again?
"YOUR ATTEMPT MAY FAIL, BUT NEVER FAIL TO MAKE AN ATTEMPT."
Tuesday, March 31, 2009
Monday, March 30, 2009
things to do in the elevator.....
1) When there's only one other person in the elvator, tap them
on the shoulder and then pretend it wasn't you.
2) Push the buttons and pretend they give you a shock. Smile,
and go back for more.
3) Ask if you can push the button for other people, but push the
wrong ones.
4) Call the Psychic Hotline from your cell phone and ask if they
know what floor your on.
5) Hold the doors open and say your waiting for a friend. After
a while, let the doors close, and say, "Hi Greg. How's your day
been?"
6) Drop a pen and wait until someone goes to pick it up, then
scream, "That's mine!"
7) Bring a camera and take pictures of everyone in the elevator.
8) Move your desk into the elevator and whenever anyone gets on,
ask if they have an apointment.
9) Lay down the twister mat and ask people if they would like to
play.
10) Leave a box in the corner, and when someone gets on, ask
them if they can hear ticking.
11) Pretend you are a flight attendant and review emergency
procedures and exits with the passengers.
12) Ask, "Did you feel that?"
13) Stand really close to someone, sniffing them occasionally.
14) When the doors close, announce to the others, "It's okay,
don't panic, they open again!"
15) Swat at flies that don't exist.
16) Tell people that you can see their aura.
17) Call out, "Group Hug!"and then enforce it.
18) Grimace painfully while smacking your forehead and
muttering, "Shut up, all of you, just shut up!"
19) Crack open your briefcase or purse, and while peering
inside, ask, "Got enough air in there?"
20) Stand silently and motionless in the corner, facing the
wall, without getting off.
21) Stare at another passenger for a while, then announce in
horror, "Your one of THEM!" and back away slowly.
22) Wear a puppet on your hand and use it to talk to the other
passengers.
23) Listen to the elevator walls with your stethoscope.
24) Make explosion noises when anyone presses a button.
25) Stare, grinning at another passenger for a while, then
announce, "I have new socks on".
26) Draw a little square on the floor with chalk and announce to
the other passnegers, "This is MY personal space" e
on the shoulder and then pretend it wasn't you.
2) Push the buttons and pretend they give you a shock. Smile,
and go back for more.
3) Ask if you can push the button for other people, but push the
wrong ones.
4) Call the Psychic Hotline from your cell phone and ask if they
know what floor your on.
5) Hold the doors open and say your waiting for a friend. After
a while, let the doors close, and say, "Hi Greg. How's your day
been?"
6) Drop a pen and wait until someone goes to pick it up, then
scream, "That's mine!"
7) Bring a camera and take pictures of everyone in the elevator.
8) Move your desk into the elevator and whenever anyone gets on,
ask if they have an apointment.
9) Lay down the twister mat and ask people if they would like to
play.
10) Leave a box in the corner, and when someone gets on, ask
them if they can hear ticking.
11) Pretend you are a flight attendant and review emergency
procedures and exits with the passengers.
12) Ask, "Did you feel that?"
13) Stand really close to someone, sniffing them occasionally.
14) When the doors close, announce to the others, "It's okay,
don't panic, they open again!"
15) Swat at flies that don't exist.
16) Tell people that you can see their aura.
17) Call out, "Group Hug!"and then enforce it.
18) Grimace painfully while smacking your forehead and
muttering, "Shut up, all of you, just shut up!"
19) Crack open your briefcase or purse, and while peering
inside, ask, "Got enough air in there?"
20) Stand silently and motionless in the corner, facing the
wall, without getting off.
21) Stare at another passenger for a while, then announce in
horror, "Your one of THEM!" and back away slowly.
22) Wear a puppet on your hand and use it to talk to the other
passengers.
23) Listen to the elevator walls with your stethoscope.
24) Make explosion noises when anyone presses a button.
25) Stare, grinning at another passenger for a while, then
announce, "I have new socks on".
26) Draw a little square on the floor with chalk and announce to
the other passnegers, "This is MY personal space" e
Sunday, March 29, 2009
Five reasons to believe computers are females :
Five reasons to believe computers are females :
1.No one but the creater understands their internal logic.
2.The native language they use to communicate with other
computers is incomprihensibleto everyone else.
3.The message 'Bad command or file name' is about as
informative as 'If you don't know why I am mad at you, then
I am certainly not going to tell you.'
4.As soon as you make a commitment to one,you find yourself
spending half of your paycheck on accessories for it.
5.Even your smallest mistakes are stored in longterm memory for later retrieval
1.No one but the creater understands their internal logic.
2.The native language they use to communicate with other
computers is incomprihensibleto everyone else.
3.The message 'Bad command or file name' is about as
informative as 'If you don't know why I am mad at you, then
I am certainly not going to tell you.'
4.As soon as you make a commitment to one,you find yourself
spending half of your paycheck on accessories for it.
5.Even your smallest mistakes are stored in longterm memory for later retrieval
10 Ways You Know Your Internet Connection Is Slow:-
10 Ways You Know Your Internet Connection Is Slow:-
1. Text on Web pages displays as Morse Code.
2. Graphics arrive via FedEx.
3. You believe a heavier string might improve your connection.
4. You post a message to your favorite newsgroup and it displays a week later.
5. Your credit card expires while ordering online.
6. ESPN Web site exhibits 'Heisman Trophy Winner'...for 1989.
7. You're still in the middle of downloading that popular new game, 'PacMan'.
8. Everyone you talk to on the 'net phone' sounds like Forrest Gump.
9. You receive e-mails with stamps on them.
10. When you click the 'Send' button, a little door opens on the side of your monitor and a pigeon flies out.
Is yours slow.... ???? ;).......
1. Text on Web pages displays as Morse Code.
2. Graphics arrive via FedEx.
3. You believe a heavier string might improve your connection.
4. You post a message to your favorite newsgroup and it displays a week later.
5. Your credit card expires while ordering online.
6. ESPN Web site exhibits 'Heisman Trophy Winner'...for 1989.
7. You're still in the middle of downloading that popular new game, 'PacMan'.
8. Everyone you talk to on the 'net phone' sounds like Forrest Gump.
9. You receive e-mails with stamps on them.
10. When you click the 'Send' button, a little door opens on the side of your monitor and a pigeon flies out.
Is yours slow.... ???? ;).......
QUOTES FOR U!!
“Just because something is easy to measure doesn't mean it's important.”
Seth Godin
“Make the most of yourself, for that is all there is of you.”
-Ralph waldo
“Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, It is the only thing that ever has.”
Margaret Mead
“We must be our own before we can be another's.”
-Ralph waldo
“People are, if anything, more touchy about being thought silly than they are about being thought unjust.”
E. B. White
“Selling to people who actually want to hear from you is more effective than interrupting strangers who don't.”
Seth Godin
“To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.”
-Ralph waldo
“Take away my people, but leave my factories, and soon grass will grow on the factory floors. Take away my factories, but leave my people, and soon we will have a new and better factory.”
Andrew Carnegie
Seth Godin
“Make the most of yourself, for that is all there is of you.”
-Ralph waldo
“Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, It is the only thing that ever has.”
Margaret Mead
“We must be our own before we can be another's.”
-Ralph waldo
“People are, if anything, more touchy about being thought silly than they are about being thought unjust.”
E. B. White
“Selling to people who actually want to hear from you is more effective than interrupting strangers who don't.”
Seth Godin
“To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.”
-Ralph waldo
“Take away my people, but leave my factories, and soon grass will grow on the factory floors. Take away my factories, but leave my people, and soon we will have a new and better factory.”
Andrew Carnegie
Don't Listen To The Naysayers! Find Success YOUR Way......
You’ll find that when you have a great product or service and you start to succeed people will usually come out of the woodwork that will try to take you down a peg, whether intentionally or not. When I used to mention owning my own business early on or not wanting to work for anyone but myself, people would always act the same way. They’d stare at me for several seconds with an odd look on their face and would either say, “What?! You have to have a job!” or “That would never work.” These comments don’t even make sense when you think of all the corporations and small businesses throughout the world. They make up everything we purchase on a daily basis and they all started with a single idea and grew from there. People will many times think that because they’ve worked their entire lives in a 9-5 job that that’s the only way to make a living and will gladly let you know that you’re wrong for thinking you could start and run a successful business. No matter how much they tell you this nonsense, you have to ignore them and understand that they haven’t opened their minds to the possibility of being on their own and supporting themselves.
Society as a whole encourages us to work hard for someone else and most teaching methods throughout school do the same. Of course there are lessons on how to run certain aspects of a business like
accounting and finance, but if you really want to learn more about specifically doing something exclusively for yourself, you’re limited unless you attend a private school designed with the entrepreneur in mind. These schools can be very expensive and, therefore, may not be a valid choice for a lot of people out there. This is another reason why so many people have built the belief system in their heads that the only way to succeed is to work year after year doing the same thing and not really moving up much or being stimulated enough to keep their interest.
The point is this: most people will never understand what it’s like to be completely free in life and to not have to worry about money or to freely do with their time whatever they choose. You can’t really blame them in a way because this is a social norm of the world. This is how society has lead us all to believe life should run and it’s nothing new. It has been going on since the beginning of time and will continue to far into the future. With the advent of the Internet, many more people have become empowered and have started pulling away from “normality,” but the bulk of the world will continue thinking the same way it always has. You have to do what is right for you and if you dream to be something more, to pull away from the rest of pack and do something on your own terms, then you will attain a level of happiness you never thought possible. Ignore the negativity of naysayers and thrive!
A courtesy of ...www.thearticleblogs.com
Society as a whole encourages us to work hard for someone else and most teaching methods throughout school do the same. Of course there are lessons on how to run certain aspects of a business like
accounting and finance, but if you really want to learn more about specifically doing something exclusively for yourself, you’re limited unless you attend a private school designed with the entrepreneur in mind. These schools can be very expensive and, therefore, may not be a valid choice for a lot of people out there. This is another reason why so many people have built the belief system in their heads that the only way to succeed is to work year after year doing the same thing and not really moving up much or being stimulated enough to keep their interest.
The point is this: most people will never understand what it’s like to be completely free in life and to not have to worry about money or to freely do with their time whatever they choose. You can’t really blame them in a way because this is a social norm of the world. This is how society has lead us all to believe life should run and it’s nothing new. It has been going on since the beginning of time and will continue to far into the future. With the advent of the Internet, many more people have become empowered and have started pulling away from “normality,” but the bulk of the world will continue thinking the same way it always has. You have to do what is right for you and if you dream to be something more, to pull away from the rest of pack and do something on your own terms, then you will attain a level of happiness you never thought possible. Ignore the negativity of naysayers and thrive!
A courtesy of ...www.thearticleblogs.com
Saturday, March 28, 2009
5 TOP THINGS WHOSE TASTE IS NOWHERE TO BE FOUnD EXCEPT INDIA!!!!
5. CHAT -----
By chat i dont mean the kind we do online ....but its the spicy pani puri...bhel puri...n sorts of stuff....indian's will surely about it.. ;)

4. Every1 giving u advice no matter what!!!
Here u find no matte how much knowledge any1 has....he is ready to give ya advice....

3.INDIAN ABUSES!!!
No matter what u do.......do good or bad.....u get the abuses....bad words.....get ready to experience themmm..
2. THE CLIMATE
The types of climate present here....really makes it a biodiversified nation....which makes its people enjoy the most....

1. CRICKET....
PEOPLE are mad here of the sport.......can do anything to play or watch it....

By chat i dont mean the kind we do online ....but its the spicy pani puri...bhel puri...n sorts of stuff....indian's will surely about it.. ;)

4. Every1 giving u advice no matter what!!!
Here u find no matte how much knowledge any1 has....he is ready to give ya advice....

3.INDIAN ABUSES!!!
No matter what u do.......do good or bad.....u get the abuses....bad words.....get ready to experience themmm..
2. THE CLIMATE
The types of climate present here....really makes it a biodiversified nation....which makes its people enjoy the most....

1. CRICKET....
PEOPLE are mad here of the sport.......can do anything to play or watch it....

Hyderabad once known as Bhagyanagar (City of Fortune), is the capital city and most populous city of the Indian state of Andhra Pradesh. The city of Hyderabad has an estimated population of about 7 million. The city has thus been classified as an A-1 status city joining the list of other A-1 cities such as Mumbai, Delhi, Kolkata, Chennai and Bangalore.
Hyderabad is known for its rich history, culture and architecture representing its unique character as a meeting point for North and South India, and also its multilingual culture, both geographically, culturally and intellectually. Also known as The City of Nizams and The City of Pearls,[1] Hyderabad is today one of the fast developing cities in the country and a modern hub of Information Technology, ITES and Biotechnology.
Hyderabad has become a preferred conference venue in India, with many conferences and meetings taking place in the city. The city is home to the world's largest film studio, the Ramoji Film City as well as the second largest film industry in the country, the Telugu Film Industry known popularly as Tollywood. The city is also known to be a sporting destination with many national and international games conducted here. The people here are called Hyderabadis. The city is regarded as a blend of traditionality with modernity.

Hyderabad is known for its rich history, culture and architecture representing its unique character as a meeting point for North and South India, and also its multilingual culture, both geographically, culturally and intellectually. Also known as The City of Nizams and The City of Pearls,[1] Hyderabad is today one of the fast developing cities in the country and a modern hub of Information Technology, ITES and Biotechnology.
Hyderabad has become a preferred conference venue in India, with many conferences and meetings taking place in the city. The city is home to the world's largest film studio, the Ramoji Film City as well as the second largest film industry in the country, the Telugu Film Industry known popularly as Tollywood. The city is also known to be a sporting destination with many national and international games conducted here. The people here are called Hyderabadis. The city is regarded as a blend of traditionality with modernity.

OS viva questions....
1) State and explain about what an operating system is?
Operating system is made up of basically two functions they are managing resources and extending the machine. Operating system gives a user interface through which he can perform various functions. It acts as a medium for communication between the machine and user.
2) Explain about what a signal is?
A signal is a software mechanism that informs a process of the occurrence of asynchronous events. It does not employ priorities but it is more or less similar to a hardware interrupt. That is, all signals are treated equally. Signals that occur at the same time are presented to a process one at a time, with no particular ordering.
3) What design and management issues are raised by the existence of concurrency?
The operating system must be able to keep track of the various active processes.
The operating system must allocate and de-allocate various resources for each active process.
The operating system must protect the data and physical resources of each process against unintended interference by other processes. This involves techniques that relate to memory, files, and I/O devices.
The results of a process must be independent of the speed at which the execution is carried out relative to the speed of other concurrent process.
4) What are the contexts in which concurrency may occur?
Concurrency may arise in three different contexts.
Multiple applications: -Processing time of the computer to be dynamically shared among a number of active jobs or applications
Structured application: - With principles of modular design and structured programming some applications can be effectively implemented as a set of concurrent process.
Operating system structure: -The same structuring advantages apply to the system programmer.
5) What is a data register and address register?
Data registers can be assigned to a variety of functions by the programmer. They can be used with any machine instruction that performs operations on data.
Address registers contain main memory addresses of data and instructions or they contain a portion of the address that is used in the calculation of the complete addresses.
6) What are server operating systems?
These run on servers, which are very large personal computers, work stations, or even mainframes. They serve multiple users at once over a network and allow the users to share hardware and software resources. Server O.S. provide various functions such as file and print service, or web service. Typical server operating systems are UNIX and Windows 2000.
7) Describe system calls for file management?
To make changes a file must be opened. This call specifies the file name to be opened, either as an absolute path name or relative to the working directory, and a code of O_RDONLY, O_WRONLY or O_RDWR, meaning open for reading, writing or both. The file descriptor can then be used for reading or writing.
8) Describe about MULTICS?
MULTICS is described as having a series of concentric rings, with the inner ones being more privileged than the outer ones. When a procedure in an outer ring wanted to call a procedure in an inner ring, it had to make the equivalent of a system call which is a TRAP instruction. MULTICS hardware made it possible to designate individual process as protected against reading, writing, or executing.
9) Describe about threads?
Different threads in a process are not quite as independent as different process. All threads share the same global variables as they have the same address space. One thread can read, write, or even completely wipe out another threads stack.
10) Describe the mechanism of upcall?
When the kernel knows that a thread has blocked, the kernel notifies the processes run time system, passing as parameters on the stack the number of the thread in question and a description of the event that occurred. The notification happens by having the kernel activate the run-time system at a known starting address, roughly analogous to a signal in UNIX.
11) Give an example of page replacement in the areas of computer design?
Majority of the computers have more than one memory caches consisting of 32-byte or 64-byte blocks of memory. Whenever a cache is full then some part of the block should be chosen for removal. This problem is precisely the same page replacement except on a shorter time scale.
12) Describe about preemptive scheduling algorithm?
A preemptive scheduling algorithm picks a process and lets it run for a maximum of some fixed time. If it is still running at the end of the time interval, it is suspended and the scheduler picks another process to run. Doing preemptive scheduling requires having a clock interrupt occur at the end of the time interval to give control of the CPU back to the scheduler.
13) Give a case situation where a scheduling is needed?
When an interrupt occurs, a scheduling decision may be made. If the interrupt came from an I/O device that has now completed its work, some process that was blocked waiting for the I/O may now be ready to run. It is up to the scheduler to decide if the newly ready process should run or not.
14) Describe about checkpointing?
Checkpointing a process means that its state is written to a file so that it can be restarted later. The checkpoint contains not only the memory image, but also the resource state, that is, which resources are currently assigned to the process. To be most effective, new checkpoints should not overwrite old ones but should be written to new files. Whole sequences of checkpoint files are accumulated due to the process getting executed.
15) Describe the two phases of two-phase locking?
In the first phase, the process tries to lock all the records it needs, one at a time. If it succeeds, it begins the second phase, performing its updates and releasing the locks. No real work is done in the first phase.
16) Explain about deadlocks in operating systems?
Deadlock is a potential problem in any operating system. It occurs when a group of processes each have been granted exclusive access to some resources, and each one wants yet another resource that belongs to another process in the group. All of then are blocked and non will ever run again.
17) Explain about the paging systems?
Paging systems can be modeled by abstracting the page reference string from the program and using the same reference string with different algorithms. These models can be used to make some predictions about paging behavior. Attention to issues such as determining the working set, memory allocations, and page size are required.
Operating system is made up of basically two functions they are managing resources and extending the machine. Operating system gives a user interface through which he can perform various functions. It acts as a medium for communication between the machine and user.
2) Explain about what a signal is?
A signal is a software mechanism that informs a process of the occurrence of asynchronous events. It does not employ priorities but it is more or less similar to a hardware interrupt. That is, all signals are treated equally. Signals that occur at the same time are presented to a process one at a time, with no particular ordering.
3) What design and management issues are raised by the existence of concurrency?
The operating system must be able to keep track of the various active processes.
The operating system must allocate and de-allocate various resources for each active process.
The operating system must protect the data and physical resources of each process against unintended interference by other processes. This involves techniques that relate to memory, files, and I/O devices.
The results of a process must be independent of the speed at which the execution is carried out relative to the speed of other concurrent process.
4) What are the contexts in which concurrency may occur?
Concurrency may arise in three different contexts.
Multiple applications: -Processing time of the computer to be dynamically shared among a number of active jobs or applications
Structured application: - With principles of modular design and structured programming some applications can be effectively implemented as a set of concurrent process.
Operating system structure: -The same structuring advantages apply to the system programmer.
5) What is a data register and address register?
Data registers can be assigned to a variety of functions by the programmer. They can be used with any machine instruction that performs operations on data.
Address registers contain main memory addresses of data and instructions or they contain a portion of the address that is used in the calculation of the complete addresses.
6) What are server operating systems?
These run on servers, which are very large personal computers, work stations, or even mainframes. They serve multiple users at once over a network and allow the users to share hardware and software resources. Server O.S. provide various functions such as file and print service, or web service. Typical server operating systems are UNIX and Windows 2000.
7) Describe system calls for file management?
To make changes a file must be opened. This call specifies the file name to be opened, either as an absolute path name or relative to the working directory, and a code of O_RDONLY, O_WRONLY or O_RDWR, meaning open for reading, writing or both. The file descriptor can then be used for reading or writing.
8) Describe about MULTICS?
MULTICS is described as having a series of concentric rings, with the inner ones being more privileged than the outer ones. When a procedure in an outer ring wanted to call a procedure in an inner ring, it had to make the equivalent of a system call which is a TRAP instruction. MULTICS hardware made it possible to designate individual process as protected against reading, writing, or executing.
9) Describe about threads?
Different threads in a process are not quite as independent as different process. All threads share the same global variables as they have the same address space. One thread can read, write, or even completely wipe out another threads stack.
10) Describe the mechanism of upcall?
When the kernel knows that a thread has blocked, the kernel notifies the processes run time system, passing as parameters on the stack the number of the thread in question and a description of the event that occurred. The notification happens by having the kernel activate the run-time system at a known starting address, roughly analogous to a signal in UNIX.
11) Give an example of page replacement in the areas of computer design?
Majority of the computers have more than one memory caches consisting of 32-byte or 64-byte blocks of memory. Whenever a cache is full then some part of the block should be chosen for removal. This problem is precisely the same page replacement except on a shorter time scale.
12) Describe about preemptive scheduling algorithm?
A preemptive scheduling algorithm picks a process and lets it run for a maximum of some fixed time. If it is still running at the end of the time interval, it is suspended and the scheduler picks another process to run. Doing preemptive scheduling requires having a clock interrupt occur at the end of the time interval to give control of the CPU back to the scheduler.
13) Give a case situation where a scheduling is needed?
When an interrupt occurs, a scheduling decision may be made. If the interrupt came from an I/O device that has now completed its work, some process that was blocked waiting for the I/O may now be ready to run. It is up to the scheduler to decide if the newly ready process should run or not.
14) Describe about checkpointing?
Checkpointing a process means that its state is written to a file so that it can be restarted later. The checkpoint contains not only the memory image, but also the resource state, that is, which resources are currently assigned to the process. To be most effective, new checkpoints should not overwrite old ones but should be written to new files. Whole sequences of checkpoint files are accumulated due to the process getting executed.
15) Describe the two phases of two-phase locking?
In the first phase, the process tries to lock all the records it needs, one at a time. If it succeeds, it begins the second phase, performing its updates and releasing the locks. No real work is done in the first phase.
16) Explain about deadlocks in operating systems?
Deadlock is a potential problem in any operating system. It occurs when a group of processes each have been granted exclusive access to some resources, and each one wants yet another resource that belongs to another process in the group. All of then are blocked and non will ever run again.
17) Explain about the paging systems?
Paging systems can be modeled by abstracting the page reference string from the program and using the same reference string with different algorithms. These models can be used to make some predictions about paging behavior. Attention to issues such as determining the working set, memory allocations, and page size are required.
JAVA viva questions...
Q:
Are the imports checked for validity at compile time? e.g. will the code containing an import such as java.lang.ABCD compile?
A: Yes the imports are checked for the semantic validity at compile time. The code containing above line of import will not compile. It will throw an error saying,can not resolve symbol
symbol : class ABCD
location: package io
import java.io.ABCD;
Q:
Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?
A: No you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of it's subpackage.
Q:
What is the difference between declaring a variable and defining a variable?
A: In declaration we just mention the type of the variable and it's name. We do not initialize it. But defining means declaration + initialization.
e.g String s; is just a declaration while String s = new String ("abcd"); Or String s = "abcd"; are both definitions.
Q:
What is the default value of an object reference declared as an instance variable?
A: null unless we define it explicitly.
Q:
Can a top level class be private or protected?
A: No. A top level class can not be private or protected. It can have either "public" or no modifier. If it does not have a modifier it is supposed to have a default access.If a top level class is declared as private the compiler will complain that the "modifier private is not allowed here". This means that a top level class can not be private. Same is the case with protected.
Q:
What type of parameter passing does Java support?
A: In Java the arguments are always passed by value .
Q:
Primitive data types are passed by reference or pass by value?
A: Primitive data types are passed by value.
Q:
Objects are passed by value or by reference?
A: Java only supports pass by value. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object .
Q:
What is serialization?
A: Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream.
Q:
How do I serialize an object to a file?
A: The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file.
Q:
Which methods of Serializable interface should I implement?
A: The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods.
Q:
How can I customize the seralization process? i.e. how can one have a control over the serialization process?
A: Yes it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process.
Q:
What is the common usage of serialization?
A: Whenever an object is to be sent over the network, objects need to be serialized. Moreover if the state of an object is to be saved, objects need to be serilazed.
Q:
What is Externalizable interface?
A: Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by implementing these methods.
Q:
When you serialize an object, what happens to the object references included in the object?
A: The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is serialized, all the included objects are also serialized alongwith the original obect.
Q:
What one should take care of while serializing the object?
A: One should make sure that all the included objects are also serializable. If any of the objects is not serializable then it throws a NotSerializableException.
Q:
What happens to the static fields of a class during serialization?
A:
There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are
1. Serialization ignores static fields, because they are not part of ay particular state state.
2. Base class fields are only hendled if the base class itself is serializable.
3. Transient fields.
Are the imports checked for validity at compile time? e.g. will the code containing an import such as java.lang.ABCD compile?
A: Yes the imports are checked for the semantic validity at compile time. The code containing above line of import will not compile. It will throw an error saying,can not resolve symbol
symbol : class ABCD
location: package io
import java.io.ABCD;
Q:
Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?
A: No you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of it's subpackage.
Q:
What is the difference between declaring a variable and defining a variable?
A: In declaration we just mention the type of the variable and it's name. We do not initialize it. But defining means declaration + initialization.
e.g String s; is just a declaration while String s = new String ("abcd"); Or String s = "abcd"; are both definitions.
Q:
What is the default value of an object reference declared as an instance variable?
A: null unless we define it explicitly.
Q:
Can a top level class be private or protected?
A: No. A top level class can not be private or protected. It can have either "public" or no modifier. If it does not have a modifier it is supposed to have a default access.If a top level class is declared as private the compiler will complain that the "modifier private is not allowed here". This means that a top level class can not be private. Same is the case with protected.
Q:
What type of parameter passing does Java support?
A: In Java the arguments are always passed by value .
Q:
Primitive data types are passed by reference or pass by value?
A: Primitive data types are passed by value.
Q:
Objects are passed by value or by reference?
A: Java only supports pass by value. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object .
Q:
What is serialization?
A: Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream.
Q:
How do I serialize an object to a file?
A: The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file.
Q:
Which methods of Serializable interface should I implement?
A: The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods.
Q:
How can I customize the seralization process? i.e. how can one have a control over the serialization process?
A: Yes it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process.
Q:
What is the common usage of serialization?
A: Whenever an object is to be sent over the network, objects need to be serialized. Moreover if the state of an object is to be saved, objects need to be serilazed.
Q:
What is Externalizable interface?
A: Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by implementing these methods.
Q:
When you serialize an object, what happens to the object references included in the object?
A: The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is serialized, all the included objects are also serialized alongwith the original obect.
Q:
What one should take care of while serializing the object?
A: One should make sure that all the included objects are also serializable. If any of the objects is not serializable then it throws a NotSerializableException.
Q:
What happens to the static fields of a class during serialization?
A:
There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are
1. Serialization ignores static fields, because they are not part of ay particular state state.
2. Base class fields are only hendled if the base class itself is serializable.
3. Transient fields.
Subscribe to:
Posts (Atom)









