Will Power
An old man lived alone in Minnesota. He wanted to spade his potato garden, but it was very hard work.
His only son, who would have helped him, was in prison. The old man wrote a letter to his son and mentioned his situation.
Dear Son, I am feeling pretty bad because it looks like I won't be able to plant my potato garden this year.
I hate to miss doing the garden, because your mother always loved planting time. I'm just getting too old to be digging up a garden plot.If you were here, all my troubles would be over. I know you would dig the plot for me, if you weren't in prison.
Love, Dad
.........
Shortly, the old man received this telegram:
"For Heaven's sake, Dad,don't dig up the garden!! That's where I buried the GUNS!" At 4a.m.
The next morning,
A dozen FBI agents and local police officers showed up and dug up the entire garden without finding any guns.
Confused, the old man wrote another note to his son telling him what happened, and a sked him what to do next.
His son's reply was: "Go ahead and plant your potatoes, Dad. It's the best I could do for you from here."
********
- Moral Of the Story
NO MATTER WHERE YOU ARE IN THE WORLD,
IF YOU HAVE DECIDED TO DO SOMETHING DEEP FROM YOUR HEART, YOU CAN DO IT.
IT IS THE THOUGHT THAT MATTERS NOT WHERE YOU ARE OR WHERE THE PERSON IS.
Sunday, November 30, 2008
Friday, November 28, 2008
The TeaCup
The Teacup
There was a couple who used to go to shop in the beautiful stores. They both liked antiques and pottery and especially teacups. One day in this beautiful shop they saw a beautiful teacup. They said, "May we see that? We've never seen one quite so beautiful." As the lady handed it to them, suddenly the teacup spoke.
"You don't understand," it said. "I haven't always been a teacup. There was a time when I was red and I was clay." My master took me and rolled me and patted me over and over and I yelled out, "let me alone", but he only smiled, "Not yet."
"Then I was placed on a spinning wheel," the teacup said, "and suddenly I was spun around and around and around. Stop it! I'm getting dizzy!" I screamed. But the master only nodded and said, 'Not yet."
Then he put me in the oven. I never felt such heat. I wondered why he wanted to burn me, and I yelled and knocked at the door. I could see him through the opening and I could read his lips as He shook his head, "Not yet."
Finally the door opened, he put me on the shelf, and I began to cool. "There, that's better," I said. And he brushed and painted me all over. The fumes were horrible. I thought I would gag. "Stop it, stop it!" I cried. He only nodded, "Not yet."
Then suddenly he put me back into the oven, not like the first one. This was twice as hot and I knew I would suffocate. I begged. I pleaded. I screamed. I cried. All the time I could see him through the opening nodding his head saying, "Not yet."
Then I knew there wasn't any hope. I would never make it. I was ready to give up. But the door opened and he took me out and placed me on the shelf. One hour later he handed me a mirror and said, "Look at yourself." And I did. I said, "That's not me; that couldn't be me. It's beautiful. I'm beautiful."
"I want you to remember," then, he said, "I know it hurts to be rolled and patted, but if I had left you alone, you'd have dried up. I know it made you dizzy to spin around on the wheel, but if I had stopped, you would have crumbled.
I knew it hurt and was hot and disagreeable in the oven, but if I hadn't put you there, you would have cracked. I know the fumes were bad when I brushed and painted you all over, but if I hadn't done that, you never would have hardened; you would not have had any color in your life.
And if I hadn't put you back in that second oven, you wouldn't survive for very long because the hardness would not have held. Now you are a finished product. You are what I had in mind when I first began with you."
********
God knows what He's doing (for all of us).He is the Potter, and we are His clay.
He will mold us and make us, So that we may be made into a flawless piece of work To fulfill His good, pleasing, and perfect will.
There was a couple who used to go to shop in the beautiful stores. They both liked antiques and pottery and especially teacups. One day in this beautiful shop they saw a beautiful teacup. They said, "May we see that? We've never seen one quite so beautiful." As the lady handed it to them, suddenly the teacup spoke.
"You don't understand," it said. "I haven't always been a teacup. There was a time when I was red and I was clay." My master took me and rolled me and patted me over and over and I yelled out, "let me alone", but he only smiled, "Not yet."
"Then I was placed on a spinning wheel," the teacup said, "and suddenly I was spun around and around and around. Stop it! I'm getting dizzy!" I screamed. But the master only nodded and said, 'Not yet."
Then he put me in the oven. I never felt such heat. I wondered why he wanted to burn me, and I yelled and knocked at the door. I could see him through the opening and I could read his lips as He shook his head, "Not yet."
Finally the door opened, he put me on the shelf, and I began to cool. "There, that's better," I said. And he brushed and painted me all over. The fumes were horrible. I thought I would gag. "Stop it, stop it!" I cried. He only nodded, "Not yet."
Then suddenly he put me back into the oven, not like the first one. This was twice as hot and I knew I would suffocate. I begged. I pleaded. I screamed. I cried. All the time I could see him through the opening nodding his head saying, "Not yet."
Then I knew there wasn't any hope. I would never make it. I was ready to give up. But the door opened and he took me out and placed me on the shelf. One hour later he handed me a mirror and said, "Look at yourself." And I did. I said, "That's not me; that couldn't be me. It's beautiful. I'm beautiful."
"I want you to remember," then, he said, "I know it hurts to be rolled and patted, but if I had left you alone, you'd have dried up. I know it made you dizzy to spin around on the wheel, but if I had stopped, you would have crumbled.
I knew it hurt and was hot and disagreeable in the oven, but if I hadn't put you there, you would have cracked. I know the fumes were bad when I brushed and painted you all over, but if I hadn't done that, you never would have hardened; you would not have had any color in your life.
And if I hadn't put you back in that second oven, you wouldn't survive for very long because the hardness would not have held. Now you are a finished product. You are what I had in mind when I first began with you."
********
God knows what He's doing (for all of us).He is the Potter, and we are His clay.
He will mold us and make us, So that we may be made into a flawless piece of work To fulfill His good, pleasing, and perfect will.
Wednesday, November 26, 2008
Dirty mind & High Expections
It was professor smith's first day at St. Johns medical college as a faculty. Known for his teaching excellence, he made his entry into a classroom of 1st year medical students, where he received a warm welcome from the students, followed by their intro.
To start with, he planned to put forth a question to the class. He said, "Well students, before we start off with today's lecture, let me ask you a simple question on human anatomy".
He gazed across the classroom, spotted a female student Suzie, and said, "Tell me Suzie, which part of the human body grows 10 times its original size when excited?"
Hearing this question, Suzie's face grew pale in embarrassment, she replied:" you should be ashamed to ask such a question to a female. I am sorry, but I can't answer your, this question".
Thwarted by the girl's reply, professor smith rolled on his sight around the classroom afresh, to find out if there was anyone else who could satisfy his query.
This time he located a male student Henry, who had already raised his hand in affirmation to answer the question, and allowed the lad to go ahead.
Henry answered: "pupil of a human eye".
The professor applauded for the boy's accurate answer; then turned back to Suzie and said: "look, Suzie, I am sorry but, I must tell you a couple of things:
(1) You lack knowledge
(2) You have a dirty mind and
(3) Your Expectations are too high !!! (10 times .. .. Huh .. .. MY GOD !!! )
To start with, he planned to put forth a question to the class. He said, "Well students, before we start off with today's lecture, let me ask you a simple question on human anatomy".
He gazed across the classroom, spotted a female student Suzie, and said, "Tell me Suzie, which part of the human body grows 10 times its original size when excited?"
Hearing this question, Suzie's face grew pale in embarrassment, she replied:" you should be ashamed to ask such a question to a female. I am sorry, but I can't answer your, this question".
Thwarted by the girl's reply, professor smith rolled on his sight around the classroom afresh, to find out if there was anyone else who could satisfy his query.
This time he located a male student Henry, who had already raised his hand in affirmation to answer the question, and allowed the lad to go ahead.
Henry answered: "pupil of a human eye".
The professor applauded for the boy's accurate answer; then turned back to Suzie and said: "look, Suzie, I am sorry but, I must tell you a couple of things:
(1) You lack knowledge
(2) You have a dirty mind and
(3) Your Expectations are too high !!! (10 times .. .. Huh .. .. MY GOD !!! )
Labels:
Funny Collection,
Inspirational Story,
Jokes
Monday, November 24, 2008
Things TO DO in Life
Things To Do!
...
The moment we are living now is very precious and people around us are precious. We realise this only when we miss the moments and the people..
The obituary page had my name and photo in it. It wasn't too good a snap of me, I thought, as I looked at it absent-mindedly. And then I gave a cry of terror, "What's my photo doing in the death column?"
I remembered, the sharp chest pain last night. I looked around, it was morning; but my coffee had not been made. People were entering the house and walking through the bedroom door. I walked in and looked on the bed. There I was, all laid out; dead.
People stared at me, not many were crying, and some, I noticed, looked relieved. "LISTEN" I shouted, "I' M HERE, I'M OKAY , I'M NOT DEAD." Nobody heard me. They were all looking at the me on the bed. I walked back into the sitting room.
The coffin had arrived. It was being set up in the center. I watched them carry my body and put it in. "I' M NOT READY TO GO AS YET" I shouted, "I STILL HAVE WORK TO DO. DONT BURY ME BEFORE I AM READY"
I looked around. "Where's my family?," I asked myself. They were in the next room, weeping. "I'M NOT DEAD " I shouted to my wife and children. They continued to weep.
"How can I go before telling you I love you?," I asked my wife.
"How can I go, before hugging you both?," I asked my children.
I wept with them.
The singing was coming from the next room. I walked in as they sang my favourite songs.
There were tears in the eyes of one of the men as he sang. "But we haven't talked to each other for years", I said to him. "Why are you crying? Come on, shake my hand and let's make up." The man continued crying as he sang. He did not see my extended hand.
My dog walked up and smelt my coffin. She didn't seem too shattered I was no more. "I guess I was too strict with you," I told her, "Come, let me pet you."
The dog yawned as it stretched out and fell asleep.
The singing stopped as the priest came in. He sat next to the man who was crying and leaned to talk to him. I went close to hear what he was asking. "Is there anything good," he asked, " the dead man did in his life time?" The man who was crying shook his head sadly.
There was a hush as my wife walked into the room. "She looks beautiful," I thought. "YOU LOOK BEAUTIFUL" I shouted. She did not hear my words. She had never heard them before, because I had never said them. "G OD," I screamed in agony, "A little more time to do all the things I should have one!"
I watched as they lifted my coffin and carried it to the hearse outside. My dog did not bother getting up from deep sleep. The priest refrained from saying any word about me. They all understood, there was nothing good to say. I turned to say sorry to the man who had the tears. I turned to hug my children. I leaned over to whisper words of love into my wife's ears, and then I looked up and cried, "God, one more chance!"
"You shouted in your sleep," said my wife as she gently woke me up. "Did you have a nightmare?"
She looked startled, as I hugged her tight and whispered, "You're beautiful!"
...
The moment we are living now is very precious and people around us are precious. We realise this only when we miss the moments and the people..
The obituary page had my name and photo in it. It wasn't too good a snap of me, I thought, as I looked at it absent-mindedly. And then I gave a cry of terror, "What's my photo doing in the death column?"
I remembered, the sharp chest pain last night. I looked around, it was morning; but my coffee had not been made. People were entering the house and walking through the bedroom door. I walked in and looked on the bed. There I was, all laid out; dead.
People stared at me, not many were crying, and some, I noticed, looked relieved. "LISTEN" I shouted, "I' M HERE, I'M OKAY , I'M NOT DEAD." Nobody heard me. They were all looking at the me on the bed. I walked back into the sitting room.
The coffin had arrived. It was being set up in the center. I watched them carry my body and put it in. "I' M NOT READY TO GO AS YET" I shouted, "I STILL HAVE WORK TO DO. DONT BURY ME BEFORE I AM READY"
I looked around. "Where's my family?," I asked myself. They were in the next room, weeping. "I'M NOT DEAD " I shouted to my wife and children. They continued to weep.
"How can I go before telling you I love you?," I asked my wife.
"How can I go, before hugging you both?," I asked my children.
I wept with them.
The singing was coming from the next room. I walked in as they sang my favourite songs.
There were tears in the eyes of one of the men as he sang. "But we haven't talked to each other for years", I said to him. "Why are you crying? Come on, shake my hand and let's make up." The man continued crying as he sang. He did not see my extended hand.
My dog walked up and smelt my coffin. She didn't seem too shattered I was no more. "I guess I was too strict with you," I told her, "Come, let me pet you."
The dog yawned as it stretched out and fell asleep.
The singing stopped as the priest came in. He sat next to the man who was crying and leaned to talk to him. I went close to hear what he was asking. "Is there anything good," he asked, " the dead man did in his life time?" The man who was crying shook his head sadly.
There was a hush as my wife walked into the room. "She looks beautiful," I thought. "YOU LOOK BEAUTIFUL" I shouted. She did not hear my words. She had never heard them before, because I had never said them. "G OD," I screamed in agony, "A little more time to do all the things I should have one!"
I watched as they lifted my coffin and carried it to the hearse outside. My dog did not bother getting up from deep sleep. The priest refrained from saying any word about me. They all understood, there was nothing good to say. I turned to say sorry to the man who had the tears. I turned to hug my children. I leaned over to whisper words of love into my wife's ears, and then I looked up and cried, "God, one more chance!"
"You shouted in your sleep," said my wife as she gently woke me up. "Did you have a nightmare?"
She looked startled, as I hugged her tight and whispered, "You're beautiful!"
Saturday, November 22, 2008
When maths teacher writes love letter
When maths teacher writes love letter
...
My Dear SweetHeart,
Yesterday, I was passing by your rectangular house in trigonometric lane.
There I saw you with our cute circular face,conical nose and spherical eyes,standing in your triangular garden.
Before seeing you my heart was a null set, but when a vector of magnitude (likeness) from your eyes at a deviation of theta radians made a tangent to my heart, it differentiated.
My love for you is a quadratic equation with real roots, which only you can solve by making good binary relation with me.
The cosine of my love for you extends to infinity.
I promise that I should not resolve you into partial functions but if I do so, you can integrate me by applying the limits from zero to infinity.
You are as essential to me as an element to a set.
The geometry of my life revolves around your acute personality.
My love, if you do not meet me at parabola restaurant on date 10 at sunset, when the sun is making an angle of 160 degrees, my heart would be like a solved polynomial of degree 10.
With love from your higher order derivatives of maxima and minima, of an unknown function.
...
My Dear SweetHeart,
Yesterday, I was passing by your rectangular house in trigonometric lane.
There I saw you with our cute circular face,conical nose and spherical eyes,standing in your triangular garden.
Before seeing you my heart was a null set, but when a vector of magnitude (likeness) from your eyes at a deviation of theta radians made a tangent to my heart, it differentiated.
My love for you is a quadratic equation with real roots, which only you can solve by making good binary relation with me.
The cosine of my love for you extends to infinity.
I promise that I should not resolve you into partial functions but if I do so, you can integrate me by applying the limits from zero to infinity.
You are as essential to me as an element to a set.
The geometry of my life revolves around your acute personality.
My love, if you do not meet me at parabola restaurant on date 10 at sunset, when the sun is making an angle of 160 degrees, my heart would be like a solved polynomial of degree 10.
With love from your higher order derivatives of maxima and minima, of an unknown function.
Thursday, November 20, 2008
House of 1000 mirrors
House of 1000 mirrors
Long ago in a small, far away village, there was place known as the House of 1000 Mirrors.
A small, happy little dog learned of this place and decided to visit. When he arrived, he bounced happily up the stairs to the doorway of the house.
He looked through the doorway with his ears lifted high and his tail wagging as fast as it could. To his great surprise, he found himself staring at 1000 other happy little dogs with their tails wagging just as fast as his. He smiled a great smile, and was answered with 1000 great smiles just as warm and friendly. As he left the House, he thought to himself, "This is a wonderful place. I will come back and visit it often."
In this same village, another little dog, who was not quite as happy as the first one, decided to visit the house. He slowly climbed the stairs and hung his head low as he looked into the door.
When he saw the 1000 unfriendly looking dogs staring back at him, he growled at them and was horrified to see 1000 little dogs growling back at him. As he left, he thought to himself, "That is a horrible place, and I will never go back there again."
All the faces in the world are mirrors. What kind of reflections do you see in the faces of the people you meet?
Long ago in a small, far away village, there was place known as the House of 1000 Mirrors.
A small, happy little dog learned of this place and decided to visit. When he arrived, he bounced happily up the stairs to the doorway of the house.
He looked through the doorway with his ears lifted high and his tail wagging as fast as it could. To his great surprise, he found himself staring at 1000 other happy little dogs with their tails wagging just as fast as his. He smiled a great smile, and was answered with 1000 great smiles just as warm and friendly. As he left the House, he thought to himself, "This is a wonderful place. I will come back and visit it often."
In this same village, another little dog, who was not quite as happy as the first one, decided to visit the house. He slowly climbed the stairs and hung his head low as he looked into the door.
When he saw the 1000 unfriendly looking dogs staring back at him, he growled at them and was horrified to see 1000 little dogs growling back at him. As he left, he thought to himself, "That is a horrible place, and I will never go back there again."
All the faces in the world are mirrors. What kind of reflections do you see in the faces of the people you meet?
Tuesday, November 18, 2008
J2EE Interview Questions Answers - Vol 3
What is binding (JavaServer Faces technology) ?
Wiring UI components to back-end data sources such as backing bean properties.
What is build file ?
The XML file that contains one or more asant targets. A target is a set of tasks you want to be executed. When starting asant, you can select which targets you want to have executed. When no target is given, the project's default target is executed.
What is business logic ?
The code that implements the functionality of an application. In the Enterprise JavaBeans architecture, this logic is implemented by the methods of an enterprise bean.
What is business method ?
A method of an enterprise bean that implements the business logic or rules of an application.
What is callback methods ?
Component methods called by the container to notify the component of important events in its life cycle.
What is caller ?
Same as caller principal.
What is caller principal ?
The principal that identifies the invoker of the enterprise bean method.
What is cascade delete ?
A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has container-managed persistence.
What is CDATA ?
A predefined XML tag for character data that means "don't interpret these characters," as opposed to parsed character data (PCDATA), in which the normal rules of XML syntax apply. CDATA sections are typically used to show examples of XML syntax.
What is certificate authority ?
A trusted organization that issues public key certificates and provides identification to the bearer.
What is client-certificate authentication ?
An authentication mechanism that uses HTTP over SSL, in which the server and, optionally, the client authenticate each other with a public key certificate that conforms to a standard that is defined by X.509 Public Key Infrastructure.
What is comment ?
In an XML document, text that is ignored unless the parser is specifically told to recognize it.
What is commit ?
The point in a transaction when all updates to any resources involved in the transaction are made permanent.
What is component contract ?
The contract between a J2EE component and its container. The contract includes life-cycle management of the component, a context interface that the instance uses to obtain various information and services from its container, and a list of services that every container must provide for its components.
What is component-managed sign-on ?
A mechanism whereby security information needed for signing on to a resource is provided by an application component.
What is connector ?
A standard extension mechanism for containers that provides connectivity to enterprise information systems. A connector is specific to an enterprise information system and consists of a resource adapter and application development tools for enterprise information system connectivity. The resource adapter is plugged in to a container through its support for system-level contracts defined in the Connector architecture.
What is container-managed persistence ?
The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean's container.
Wiring UI components to back-end data sources such as backing bean properties.
What is build file ?
The XML file that contains one or more asant targets. A target is a set of tasks you want to be executed. When starting asant, you can select which targets you want to have executed. When no target is given, the project's default target is executed.
What is business logic ?
The code that implements the functionality of an application. In the Enterprise JavaBeans architecture, this logic is implemented by the methods of an enterprise bean.
What is business method ?
A method of an enterprise bean that implements the business logic or rules of an application.
What is callback methods ?
Component methods called by the container to notify the component of important events in its life cycle.
What is caller ?
Same as caller principal.
What is caller principal ?
The principal that identifies the invoker of the enterprise bean method.
What is cascade delete ?
A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has container-managed persistence.
What is CDATA ?
A predefined XML tag for character data that means "don't interpret these characters," as opposed to parsed character data (PCDATA), in which the normal rules of XML syntax apply. CDATA sections are typically used to show examples of XML syntax.
What is certificate authority ?
A trusted organization that issues public key certificates and provides identification to the bearer.
What is client-certificate authentication ?
An authentication mechanism that uses HTTP over SSL, in which the server and, optionally, the client authenticate each other with a public key certificate that conforms to a standard that is defined by X.509 Public Key Infrastructure.
What is comment ?
In an XML document, text that is ignored unless the parser is specifically told to recognize it.
What is commit ?
The point in a transaction when all updates to any resources involved in the transaction are made permanent.
What is component contract ?
The contract between a J2EE component and its container. The contract includes life-cycle management of the component, a context interface that the instance uses to obtain various information and services from its container, and a list of services that every container must provide for its components.
What is component-managed sign-on ?
A mechanism whereby security information needed for signing on to a resource is provided by an application component.
What is connector ?
A standard extension mechanism for containers that provides connectivity to enterprise information systems. A connector is specific to an enterprise information system and consists of a resource adapter and application development tools for enterprise information system connectivity. The resource adapter is plugged in to a container through its support for system-level contracts defined in the Connector architecture.
What is container-managed persistence ?
The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean's container.
Sunday, November 16, 2008
JAVA Interview Questions Answers - Vol 3
What is synchronization and why is it important?
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
What are synchronized methods and synchronized statements?
Synchronized methods are methods that are used to control access to a method or an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
What are three ways in which a thread can enter the waiting state?
A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.
Can a lock be acquired on a class?
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
What's new with the stop(), suspend() and resume() methods in JDK 1.2?
The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
What is the preferred size of a component?
The preferred size of a component is the minimum component size that will allow the component to display normally.
What's the difference between J2SDK 1.5 and J2SDK 5.0?
There's no difference, Sun Microsystems just re-branded this version.
What would you use to compare two String variables - the operator == or the method equals()?
I'd use the method equals() to compare the values of the Strings and the == to check if two variables point at the same instance of a String object.
What is thread?
A thread is an independent path of execution in a system.
What is multi-threading?
Multi-threading means various threads that run in a system.
How does multi-threading take place on a computer with a single CPU?
The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
How to create a thread in a program?
You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run() method and call start() method to start the thread.
Can Java object be locked down for exclusive use by a given thread?
Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.
Can each Java object keep track of all the threads that want to exclusively access to it?
Yes. Use Thread.currentThread() method to track the accessing thread.
Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.
What invokes a thread's run() method?
After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
What are synchronized methods and synchronized statements?
Synchronized methods are methods that are used to control access to a method or an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
What are three ways in which a thread can enter the waiting state?
A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.
Can a lock be acquired on a class?
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
What's new with the stop(), suspend() and resume() methods in JDK 1.2?
The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
What is the preferred size of a component?
The preferred size of a component is the minimum component size that will allow the component to display normally.
What's the difference between J2SDK 1.5 and J2SDK 5.0?
There's no difference, Sun Microsystems just re-branded this version.
What would you use to compare two String variables - the operator == or the method equals()?
I'd use the method equals() to compare the values of the Strings and the == to check if two variables point at the same instance of a String object.
What is thread?
A thread is an independent path of execution in a system.
What is multi-threading?
Multi-threading means various threads that run in a system.
How does multi-threading take place on a computer with a single CPU?
The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
How to create a thread in a program?
You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run() method and call start() method to start the thread.
Can Java object be locked down for exclusive use by a given thread?
Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.
Can each Java object keep track of all the threads that want to exclusively access to it?
Yes. Use Thread.currentThread() method to track the accessing thread.
Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.
What invokes a thread's run() method?
After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.
Friday, November 14, 2008
C Interview Questions Answers - Vol 3
What will be the result of the following code?
#define TRUE 0 // some code while(TRUE) { // some code }
This will not go into the loop as TRUE is defined as 0.
What will be printed as the result of the operation below:
int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%d\n",x);
x++;
changevalue(x);
printf("Second output:%d\n",x);
modifyvalue();
printf("Third output:%d\n",x);
}
Answer: 12 , 13 , 13
What will be printed as the result of the operation below:
main()
{
int x=10, y=15;
x = x++;
y = ++y;
printf(“%d %d\n”,x,y);
}
Answer: 11, 16
What will be printed as the result of the operation below:
main()
{
int a=0;
if(a==0)
printf(“Tech Preparation\n”);
printf(“Tech Preparation\n”);
}
Answer: Two lines with “Tech Preparation” will be printed.
What will the following piece of code do
int f(unsigned int x)
{
int i;
for (i=0; x!0; x>>=1){
if (x & 0X1)
i++;
}
return i;
}
Answer: returns the number of ones in the input parameter X
What will happen in these three cases?
if(a=0){
//somecode
}
if (a==0){
//do something
}
if (a===0){
//do something
}
What are x, y, y, u
#define Atype int*
typedef int *p;
p x, z;
Atype y, u;
Answer: x and z are pointers to int. y is a pointer to int but u is just an integer variable
Advantages of a macro over a function?
Macro gets to see the Compilation environment, so it can expand __ __TIME__ __FILE__ #defines. It is expanded by the preprocessor.
For example, you can’t do this without macros
#define PRINT(EXPR) printf( #EXPR “=%d\n”, EXPR)
PRINT( 5+6*7 ) // expands into printf(”5+6*7=%d”, 5+6*7 );
You can define your mini language with macros:
#define strequal(A,B) (!strcmp(A,B))
Macros are a necessary evils of life. The purists don’t like them, but without it no real work gets done.
#define TRUE 0 // some code while(TRUE) { // some code }
This will not go into the loop as TRUE is defined as 0.
What will be printed as the result of the operation below:
int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%d\n",x);
x++;
changevalue(x);
printf("Second output:%d\n",x);
modifyvalue();
printf("Third output:%d\n",x);
}
Answer: 12 , 13 , 13
What will be printed as the result of the operation below:
main()
{
int x=10, y=15;
x = x++;
y = ++y;
printf(“%d %d\n”,x,y);
}
Answer: 11, 16
What will be printed as the result of the operation below:
main()
{
int a=0;
if(a==0)
printf(“Tech Preparation\n”);
printf(“Tech Preparation\n”);
}
Answer: Two lines with “Tech Preparation” will be printed.
What will the following piece of code do
int f(unsigned int x)
{
int i;
for (i=0; x!0; x>>=1){
if (x & 0X1)
i++;
}
return i;
}
Answer: returns the number of ones in the input parameter X
What will happen in these three cases?
if(a=0){
//somecode
}
if (a==0){
//do something
}
if (a===0){
//do something
}
What are x, y, y, u
#define Atype int*
typedef int *p;
p x, z;
Atype y, u;
Answer: x and z are pointers to int. y is a pointer to int but u is just an integer variable
Advantages of a macro over a function?
Macro gets to see the Compilation environment, so it can expand __ __TIME__ __FILE__ #defines. It is expanded by the preprocessor.
For example, you can’t do this without macros
#define PRINT(EXPR) printf( #EXPR “=%d\n”, EXPR)
PRINT( 5+6*7 ) // expands into printf(”5+6*7=%d”, 5+6*7 );
You can define your mini language with macros:
#define strequal(A,B) (!strcmp(A,B))
Macros are a necessary evils of life. The purists don’t like them, but without it no real work gets done.
Wednesday, November 12, 2008
C++ Interview Questions Answers - Vol 3
What is the difference between an ARRAY and a LIST?
Answer1
Array is collection of homogeneous elements.
List is collection of heterogeneous elements.
For Array memory allocated is static and continuous.
For List memory allocated is dynamic and Random.
Array: User need not have to keep in track of next memory allocation.
List: User has to keep in Track of next location where memory is allocated.
Answer2
Array uses direct access of stored members, list uses sequencial access for members.
//With Array you have direct access to memory position 5
Object x = a[5]; // x takes directly a reference to 5th element of array
//With the list you have to cross all previous nodes in order to get the 5th node:
list mylist;
list::iterator it;
for( it = list.begin() ; it != list.end() ; it++ )
{
if( i==5)
{
x = *it;
break;
}
i++;
}
Does c++ support multilevel and multiple inheritance?
Yes.
What is a template?
Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two following ones:
templatefunction_declaration; template function_declaration;
The only difference between both prototypes is the use of keyword class or typename, its use is indistinct since both expressions have exactly the same meaning and behave exactly the same way.
Define a constructor - What it is and how it might be called (2 methods).
Answer1
constructor is a member function of the class, with the name of the function being the same as the class name. It also specifies how the object should be initialized.
Ways of calling constructor:
1) Implicitly: automatically by complier when an object is created.
2) Calling the constructors explicitly is possible, but it makes the code unverifiable.
Answer2
class Point2D{
int x; int y;
public Point2D() : x(0) , y(0) {} //default (no argument) constructor
};
main(){
Point2D MyPoint; // Implicit Constructor call. In order to allocate memory on stack, the default constructor is implicitly called.
Point2D * pPoint = new Point2D(); // Explicit Constructor call. In order to allocate memory on HEAP we call the default constructor.
You have two pairs: new() and delete() and another pair : alloc() and free().
Explain differences between eg. new() and malloc()
Answer1
1.) “new and delete” are preprocessors while “malloc() and free()” are functions. [we dont use brackets will calling new or delete].
2.) no need of allocate the memory while using “new” but in “malloc()” we have to use “sizeof()”.
3.) “new” will initlize the new memory to 0 but “malloc()” gives random value in the new alloted memory location [better to use calloc()]
Answer2
new() allocates continous space for the object instace
malloc() allocates distributed space.
new() is castless, meaning that allocates memory for this specific type,
malloc(), calloc() allocate space for void * that is cated to the specific class type pointer.
What is the difference between class and structure?
Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private.
Answer1
Array is collection of homogeneous elements.
List is collection of heterogeneous elements.
For Array memory allocated is static and continuous.
For List memory allocated is dynamic and Random.
Array: User need not have to keep in track of next memory allocation.
List: User has to keep in Track of next location where memory is allocated.
Answer2
Array uses direct access of stored members, list uses sequencial access for members.
//With Array you have direct access to memory position 5
Object x = a[5]; // x takes directly a reference to 5th element of array
//With the list you have to cross all previous nodes in order to get the 5th node:
list mylist;
list::iterator it;
for( it = list.begin() ; it != list.end() ; it++ )
{
if( i==5)
{
x = *it;
break;
}
i++;
}
Does c++ support multilevel and multiple inheritance?
Yes.
What is a template?
Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two following ones:
template
The only difference between both prototypes is the use of keyword class or typename, its use is indistinct since both expressions have exactly the same meaning and behave exactly the same way.
Define a constructor - What it is and how it might be called (2 methods).
Answer1
constructor is a member function of the class, with the name of the function being the same as the class name. It also specifies how the object should be initialized.
Ways of calling constructor:
1) Implicitly: automatically by complier when an object is created.
2) Calling the constructors explicitly is possible, but it makes the code unverifiable.
Answer2
class Point2D{
int x; int y;
public Point2D() : x(0) , y(0) {} //default (no argument) constructor
};
main(){
Point2D MyPoint; // Implicit Constructor call. In order to allocate memory on stack, the default constructor is implicitly called.
Point2D * pPoint = new Point2D(); // Explicit Constructor call. In order to allocate memory on HEAP we call the default constructor.
You have two pairs: new() and delete() and another pair : alloc() and free().
Explain differences between eg. new() and malloc()
Answer1
1.) “new and delete” are preprocessors while “malloc() and free()” are functions. [we dont use brackets will calling new or delete].
2.) no need of allocate the memory while using “new” but in “malloc()” we have to use “sizeof()”.
3.) “new” will initlize the new memory to 0 but “malloc()” gives random value in the new alloted memory location [better to use calloc()]
Answer2
new() allocates continous space for the object instace
malloc() allocates distributed space.
new() is castless, meaning that allocates memory for this specific type,
malloc(), calloc() allocate space for void * that is cated to the specific class type pointer.
What is the difference between class and structure?
Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private.
Monday, November 10, 2008
Resume Writing tips for fresh graduates
Resume Writing tips for fresh graduates
Writing a resume for the first time is quite difficult especially for newly graduates. The pressure of creating a good resume is very high because everyone wants to be in the position that they applied. Nowadays, because of high turn around of graduates compared to the available jobs to be filled in, it is not easy for fresh graduates to find work at once. Pressure is even heavy because some companies are quite hesitant to accept applicants without work experiences. Further more, there are some companies who had preferences to applicants that come from well-known colleges or universities. However, majority of newly graduates do not really have any work backgrounds because there are some courses that offer internship as optional requirement and many others totally exclude internship in its curriculum.
For these reasons, applying for an internship or on-the-job training during college breaks is quite valuable and will help you in creating a comprehensive resume right after graduation. Graduates may also opt to find short-term internship right after graduating if they want to have some edge over their fellow graduates. These job trainings are often considered as valid work experiences.
But for those graduates who do not have a chance to work during their college days, creating a good and impressive resume is the key to grab the employer's attention along with the remarkable grades and scholastic achievements earned during school days.
Begin your resume by creating your career objective. When writing an objective, avoid bland or general description of your profession or skills. It must be based to the actual description of your skills related on the job you are applying for. Thus, you should prepare distinct objective to every position you wish to apply.
It is not uncommon for first time applicants to include too many details on the Personal Information section of their resume. Personal information like your hobbies and interest are usually irrelevant in job applications. If the interviewer wants to know more about you personally, it will be asked during your interview.
Another noticeable section in newly graduates' resume is their long list of reference. Reference must not be listed on the resume. Prepare them separately on another page and should only be presented when requested by the interviewer.
Functional Resume is the usual recommended resume format for newly graduates because this format focused on the appropriate talent or skills of the applicant. Length of resume depends on the list of achievements and work experiences but for newly graduates, a two-page resume is recommended. Be certain that all significant skills or experience related to the job you are applying are all included. Make sure that your resume is free of error. Be conscious about the punctuations, spelling and grammar. Keep your sentences short and simple. Ask somebody to proof read your resume for any error that might escape you visually.
Lastly, remember that a resume is a professional document. It is the passport to your job. Print them using black ink in plain and good quality paper. Put your name centered at the top and never present your resume in plastic slide folder.
Writing a resume for the first time is quite difficult especially for newly graduates. The pressure of creating a good resume is very high because everyone wants to be in the position that they applied. Nowadays, because of high turn around of graduates compared to the available jobs to be filled in, it is not easy for fresh graduates to find work at once. Pressure is even heavy because some companies are quite hesitant to accept applicants without work experiences. Further more, there are some companies who had preferences to applicants that come from well-known colleges or universities. However, majority of newly graduates do not really have any work backgrounds because there are some courses that offer internship as optional requirement and many others totally exclude internship in its curriculum.
For these reasons, applying for an internship or on-the-job training during college breaks is quite valuable and will help you in creating a comprehensive resume right after graduation. Graduates may also opt to find short-term internship right after graduating if they want to have some edge over their fellow graduates. These job trainings are often considered as valid work experiences.
But for those graduates who do not have a chance to work during their college days, creating a good and impressive resume is the key to grab the employer's attention along with the remarkable grades and scholastic achievements earned during school days.
Begin your resume by creating your career objective. When writing an objective, avoid bland or general description of your profession or skills. It must be based to the actual description of your skills related on the job you are applying for. Thus, you should prepare distinct objective to every position you wish to apply.
It is not uncommon for first time applicants to include too many details on the Personal Information section of their resume. Personal information like your hobbies and interest are usually irrelevant in job applications. If the interviewer wants to know more about you personally, it will be asked during your interview.
Another noticeable section in newly graduates' resume is their long list of reference. Reference must not be listed on the resume. Prepare them separately on another page and should only be presented when requested by the interviewer.
Functional Resume is the usual recommended resume format for newly graduates because this format focused on the appropriate talent or skills of the applicant. Length of resume depends on the list of achievements and work experiences but for newly graduates, a two-page resume is recommended. Be certain that all significant skills or experience related to the job you are applying are all included. Make sure that your resume is free of error. Be conscious about the punctuations, spelling and grammar. Keep your sentences short and simple. Ask somebody to proof read your resume for any error that might escape you visually.
Lastly, remember that a resume is a professional document. It is the passport to your job. Print them using black ink in plain and good quality paper. Put your name centered at the top and never present your resume in plastic slide folder.
Saturday, November 8, 2008
Writing Resume Objective
Writing Resume Objective
The Objective is basically the resume section that contains the career plan statement of the applicant in relation to what the employer or company looks for. The Objective Section is written beneath the portion of the resume that includes the applicant's name, address, contact number, and email address. Frequently, the career objective is written as one paragraph consisting of one to three sentences only.
This is the part of the resume that introduces the applicant to the employer and the appropriate section where the applicant can assert himself to convince the company that he is the perfect candidate for that particular position. For this reason, the applicants need to devote considerable time and effort to establish a well stated Resume Objective. The applicant must outline his strengths, abilities, or qualifications and match them with the various positions he is trying to apply for.
The goal of Resume Objective is to increase the chance of getting a positive response from the employer. The applicants need to provide an effective Objective so that the employer will be encouraged to read the resume further. When the candidate is looking for a career change or have a limited work experience, he should do something to divert the employer's focus on where he is going, rather than where he had been. If the candidate is looking for another work in his present career, it is more important to stress his qualities, achievements and abilities.
The first sentence of the objective must be able to transmit that you are definitely the best candidate for the position and that you want to do something good in their company. This is very effective because every company wants to choose someone who shares the very same aspiration with them because success will be much easier.
Avoid the word “I” because this denotes a self-centered point of view. Remember that the company wants to hire you because of the good things you can do for them as an employee. They will choose you to help their company grows. Make your objective statement direct and concrete.
Objective is job specific. When the candidate is applying for several companies, he should also create definite objective for each of them depending on what each company look for. The candidate must never settle for bland or general objective because this can not hit his purpose to be invited for an interview.
Bland objective reflects a vague career disposition. This may likewise leave an impression that the candidate do not really know what he is applying for or he is just trying to land in any job. The bargaining power of the applicant is likely to decline in this situation.
Do not intend to put broad and inexplicit phrases because it may cause the interviewer to doubt, ask more questions about the applicant, or just be bored of reading it. Blend in some different words that will make the career objective interesting. It is necessary not to overdo the objective but it is advisable to maximize the Objective Section of your resume to your best advantage and you will reap greater returns.
The Objective is basically the resume section that contains the career plan statement of the applicant in relation to what the employer or company looks for. The Objective Section is written beneath the portion of the resume that includes the applicant's name, address, contact number, and email address. Frequently, the career objective is written as one paragraph consisting of one to three sentences only.
This is the part of the resume that introduces the applicant to the employer and the appropriate section where the applicant can assert himself to convince the company that he is the perfect candidate for that particular position. For this reason, the applicants need to devote considerable time and effort to establish a well stated Resume Objective. The applicant must outline his strengths, abilities, or qualifications and match them with the various positions he is trying to apply for.
The goal of Resume Objective is to increase the chance of getting a positive response from the employer. The applicants need to provide an effective Objective so that the employer will be encouraged to read the resume further. When the candidate is looking for a career change or have a limited work experience, he should do something to divert the employer's focus on where he is going, rather than where he had been. If the candidate is looking for another work in his present career, it is more important to stress his qualities, achievements and abilities.
The first sentence of the objective must be able to transmit that you are definitely the best candidate for the position and that you want to do something good in their company. This is very effective because every company wants to choose someone who shares the very same aspiration with them because success will be much easier.
Avoid the word “I” because this denotes a self-centered point of view. Remember that the company wants to hire you because of the good things you can do for them as an employee. They will choose you to help their company grows. Make your objective statement direct and concrete.
Objective is job specific. When the candidate is applying for several companies, he should also create definite objective for each of them depending on what each company look for. The candidate must never settle for bland or general objective because this can not hit his purpose to be invited for an interview.
Bland objective reflects a vague career disposition. This may likewise leave an impression that the candidate do not really know what he is applying for or he is just trying to land in any job. The bargaining power of the applicant is likely to decline in this situation.
Do not intend to put broad and inexplicit phrases because it may cause the interviewer to doubt, ask more questions about the applicant, or just be bored of reading it. Blend in some different words that will make the career objective interesting. It is necessary not to overdo the objective but it is advisable to maximize the Objective Section of your resume to your best advantage and you will reap greater returns.
Thursday, November 6, 2008
J2EE Interview Questions Answers - Vol 2
What is "application client" ?
A first-tier J2EE client component that executes in its own Java virtual machine. Application clients have access to some J2EE platform APIs.
What is "application client container" ?
A container that supports application client components.
What is "application client module" ?
A software unit that consists of one or more classes and an application client deployment descriptor.
What is "application component provider" ?
A vendor that provides the Java classes that implement components' methods, JSP page definitions, and any required deployment descriptors.
What is "application configuration resource file" ?
An XML file used to configure resources for a Java Server Faces application, to define navigation rules for the application, and to register converters, Validator, listeners, renders, and components with the application.
What is "archiving" ?
The process of saving the state of an object and restoring it.
What is "asant" ?
A Java-based build tool that can be extended using Java classes. The configuration files are XML-based, calling out a target tree where various tasks get executed.
What is "attribute"?
A qualifier on an XML tag that provides additional information.
What is authentication ?
The process that verifies the identity of a user, device, or other entity in a computer system, usually as a prerequisite to allowing access to resources in a system. The Java servlet specification requires three types of authentication-basic, form-based, and mutual-and supports digest authentication.
What is authorization ?
The process by which access to a method or resource is determined. Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.
What is authorization constraint ?
An authorization rule that determines who is permitted to access a Web resource collection.
What is B2B ?
B2B stands for Business-to-business.
What is backing bean ?
A JavaBeans component that corresponds to a JSP page that includes JavaServer Faces components. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.
What is basic authentication ?
An authentication mechanism in which a Web server authenticates an entity via a user name and password obtained using the Web application's built-in authentication mechanism.
What is bean-managed persistence ?
The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean.
What is bean-managed transaction ?
A transaction whose boundaries are defined by an enterprise bean.
What is binding (XML) ?
Generating the code needed to process a well-defined portion of XML data.
A first-tier J2EE client component that executes in its own Java virtual machine. Application clients have access to some J2EE platform APIs.
What is "application client container" ?
A container that supports application client components.
What is "application client module" ?
A software unit that consists of one or more classes and an application client deployment descriptor.
What is "application component provider" ?
A vendor that provides the Java classes that implement components' methods, JSP page definitions, and any required deployment descriptors.
What is "application configuration resource file" ?
An XML file used to configure resources for a Java Server Faces application, to define navigation rules for the application, and to register converters, Validator, listeners, renders, and components with the application.
What is "archiving" ?
The process of saving the state of an object and restoring it.
What is "asant" ?
A Java-based build tool that can be extended using Java classes. The configuration files are XML-based, calling out a target tree where various tasks get executed.
What is "attribute"?
A qualifier on an XML tag that provides additional information.
What is authentication ?
The process that verifies the identity of a user, device, or other entity in a computer system, usually as a prerequisite to allowing access to resources in a system. The Java servlet specification requires three types of authentication-basic, form-based, and mutual-and supports digest authentication.
What is authorization ?
The process by which access to a method or resource is determined. Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.
What is authorization constraint ?
An authorization rule that determines who is permitted to access a Web resource collection.
What is B2B ?
B2B stands for Business-to-business.
What is backing bean ?
A JavaBeans component that corresponds to a JSP page that includes JavaServer Faces components. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.
What is basic authentication ?
An authentication mechanism in which a Web server authenticates an entity via a user name and password obtained using the Web application's built-in authentication mechanism.
What is bean-managed persistence ?
The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean.
What is bean-managed transaction ?
A transaction whose boundaries are defined by an enterprise bean.
What is binding (XML) ?
Generating the code needed to process a well-defined portion of XML data.
Tuesday, November 4, 2008
JAVA Interview Questions Answers - Vol 2
What is Java?
Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that of Objective C. Java should not be confused with JavaScript, which shares only the name and a similar C-like syntax. Sun Microsystems currently maintains and updates Java regularly.
What does a well-written OO program look like?
A well-written OO program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.
Can you have virtual functions in Java?
Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has only coded in Java. Virtual functions or virtual methods are functions or methods that will be redefined in derived classes.
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to make a clone of the map in order to save the original data on side. What do you think of it? ?
If Jack made a clone of the map, any changes to the clone or the original map would be seen on both maps, because the clone of Map is a shallow copy. So Jack made a wrong decision.
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?
Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you create a thread by implementing Runnable interface, you save a space for your class to extend another class now or in future.
What is NullPointerException and how to handle it?
When an object is not initialized, the default value is null. When the following things happen, the NullPointerException is thrown:
--Calling the instance method of a null object.
--Accessing or modifying the field of a null object.
--Taking the length of a null as if it were an array.
--Accessing or modifying the slots of null as if it were an array.
--Throwing null as if it were a Throwable value.
The NullPointerException is a runtime exception. The best practice is to catch such exception even if it is not required by language design.
An application needs to load a library before it starts to run, how to code?
One option is to use a static block to load a library before anything is called. For example,
class Test {
static {
System.loadLibrary("path-to-library-file");
}
....
}
When you call new Test(), the static block will be called first before any initialization happens. Note that the static block position may matter.
How could Java classes direct program messages to the system console, but error messages, say to a file?
The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);
What's the difference between an interface and an abstract class?
An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
Name the containers which uses Border Layout as their default layout?
Containers which uses Border Layout as their default are: window, Frame and Dialog classes.
What do you understand by Synchronization?
Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value.
Synchronization prevents such type of data corruption.
E.g. Synchronizing a function:
public synchronized void Method1 () {
// Appropriate method-related code.
}
E.g. Synchronizing a block of code inside a function:
public myFunction (){
synchronized (this) {
// Synchronized code here.
}
}
Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that of Objective C. Java should not be confused with JavaScript, which shares only the name and a similar C-like syntax. Sun Microsystems currently maintains and updates Java regularly.
What does a well-written OO program look like?
A well-written OO program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.
Can you have virtual functions in Java?
Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has only coded in Java. Virtual functions or virtual methods are functions or methods that will be redefined in derived classes.
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to make a clone of the map in order to save the original data on side. What do you think of it? ?
If Jack made a clone of the map, any changes to the clone or the original map would be seen on both maps, because the clone of Map is a shallow copy. So Jack made a wrong decision.
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?
Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you create a thread by implementing Runnable interface, you save a space for your class to extend another class now or in future.
What is NullPointerException and how to handle it?
When an object is not initialized, the default value is null. When the following things happen, the NullPointerException is thrown:
--Calling the instance method of a null object.
--Accessing or modifying the field of a null object.
--Taking the length of a null as if it were an array.
--Accessing or modifying the slots of null as if it were an array.
--Throwing null as if it were a Throwable value.
The NullPointerException is a runtime exception. The best practice is to catch such exception even if it is not required by language design.
An application needs to load a library before it starts to run, how to code?
One option is to use a static block to load a library before anything is called. For example,
class Test {
static {
System.loadLibrary("path-to-library-file");
}
....
}
When you call new Test(), the static block will be called first before any initialization happens. Note that the static block position may matter.
How could Java classes direct program messages to the system console, but error messages, say to a file?
The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);
What's the difference between an interface and an abstract class?
An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
Name the containers which uses Border Layout as their default layout?
Containers which uses Border Layout as their default are: window, Frame and Dialog classes.
What do you understand by Synchronization?
Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value.
Synchronization prevents such type of data corruption.
E.g. Synchronizing a function:
public synchronized void Method1 () {
// Appropriate method-related code.
}
E.g. Synchronizing a block of code inside a function:
public myFunction (){
synchronized (this) {
// Synchronized code here.
}
}
Sunday, November 2, 2008
ASP Interview Questions Answers - Vol 2
What happens to ASP pages?
The browser makes a HTTP request; the server does the processing and gives a HTML response to the browser.
How can you change the primary scripting language for a page?
Specify
What is application Object?
Shares information among users of an application. Gives a notification when an application starts or ends.
What is the difference between client-side script and server-side script?
Scripts executed only by the browser without contacting the server is called client-side script. It is browser dependent. The scripting code is visible to the user and hence not secure. Scripts executed by the web server and processed by the server is called server-side script.
What is the command to display characters to the HTML page?
Response.Write
Explain the POST & GET Method or Explain the difference between them?
POST METHOD:
The POST method generates a FORM collection, which is sent as a HTTP request body. All the values typed in the form will be stored in the FORM collection.
GET METHOD:
The GET method sends information by appending it to the URL (with a question mark) and stored as A Querystring collection. The Querystring collection is passed to the server as name/value pair.
The length of the URL should be less than 255 characters.
How many global.asa files can an Application have?
Only one global.asa file and it’s placed in the virtual directory’s root.
How many global.asa files can an Application have?
Only one global.asa file and it’s placed in the virtual directory’s root.
What are Scripting Objects?
Objects that can enhance the application are known as the Scripting Objects.
What is the Order of precedence for LOGICAL Operators ?
NOT, AND, OR, XOR, EQV, IMP
What is an Err Object?
Name it’s properties and methods.
What are LOCAL and GLOBAL variables?
Local variables lifetime ends when the Procedure ends. Global variables lifetime begins at the start of the script and ends at the end of the script and it can be used by any procedure within the script. Declaring a variable by using the keyword PRIVATE makes the variable global within the script, but if declared using PUBLIC, then all scripts can refer the variable.
Which is the default Scripting Language on the client side?
JavaScript
What is HTML (Hypertext Markup Language)?
It’s a method by which web pages can be built and generally used for formatting and linking text.
What is a Web Server?
It’s a Computer that provides Web services on the Internet or on a local Intranet. It is designed to locate, address and send out simple HTML pages to all other users who access these pages.
What is Session Object?
It stores information about a User’s session. Gives a notification when a user session begins or ends.
What is Server-Side includes?
It provides extra information by which it makes the site easier to manage. It can include text files using the #include statement, retrieve the size and last modification date of a file, defines how variables and error messages are displayed and inserts the values of HTTP variables in the page sent back to the browser.
The browser makes a HTTP request; the server does the processing and gives a HTML response to the browser.
How can you change the primary scripting language for a page?
Specify
What is application Object?
Shares information among users of an application. Gives a notification when an application starts or ends.
What is the difference between client-side script and server-side script?
Scripts executed only by the browser without contacting the server is called client-side script. It is browser dependent. The scripting code is visible to the user and hence not secure. Scripts executed by the web server and processed by the server is called server-side script.
What is the command to display characters to the HTML page?
Response.Write
Explain the POST & GET Method or Explain the difference between them?
POST METHOD:
The POST method generates a FORM collection, which is sent as a HTTP request body. All the values typed in the form will be stored in the FORM collection.
GET METHOD:
The GET method sends information by appending it to the URL (with a question mark) and stored as A Querystring collection. The Querystring collection is passed to the server as name/value pair.
The length of the URL should be less than 255 characters.
How many global.asa files can an Application have?
Only one global.asa file and it’s placed in the virtual directory’s root.
How many global.asa files can an Application have?
Only one global.asa file and it’s placed in the virtual directory’s root.
What are Scripting Objects?
Objects that can enhance the application are known as the Scripting Objects.
What is the Order of precedence for LOGICAL Operators ?
NOT, AND, OR, XOR, EQV, IMP
What is an Err Object?
Name it’s properties and methods.
What are LOCAL and GLOBAL variables?
Local variables lifetime ends when the Procedure ends. Global variables lifetime begins at the start of the script and ends at the end of the script and it can be used by any procedure within the script. Declaring a variable by using the keyword PRIVATE makes the variable global within the script, but if declared using PUBLIC, then all scripts can refer the variable.
Which is the default Scripting Language on the client side?
JavaScript
What is HTML (Hypertext Markup Language)?
It’s a method by which web pages can be built and generally used for formatting and linking text.
What is a Web Server?
It’s a Computer that provides Web services on the Internet or on a local Intranet. It is designed to locate, address and send out simple HTML pages to all other users who access these pages.
What is Session Object?
It stores information about a User’s session. Gives a notification when a user session begins or ends.
What is Server-Side includes?
It provides extra information by which it makes the site easier to manage. It can include text files using the #include statement, retrieve the size and last modification date of a file, defines how variables and error messages are displayed and inserts the values of HTTP variables in the page sent back to the browser.
Subscribe to:
Comments (Atom)