Archive for October 2008
I come across loads of interesting questions which have been asked in interviews. Just thought of posting them here in my blog…
There is a long table with 100 cups arranged in a line. The cups are numbered from one to hundred. Initially all cups are closed with lids.
This is what you do:
First, you open all cups that are multiples of 1. ( Obviously all hundred cups )
Next, you invert all the cups that are multiples of 2. Inverting a cup refers to opening a cup if it is closed, or, closing a cup if it is open.
Next, you invert all cups that are multiples of 3.
This process is continued for 4, 5. 6, …. 100.
After this is done, how many cups will be open, and what are their numbers ??
There is a standard chess board. ( 8 x 8 ). A horse is placed on a corner square, say, black
The task that is being done is the obvious, move to all squares in the chess board, without landing on a square more than once.
The question is different:
Is it possible to reach the corner that is diagonally opposite to the starting square after moving to all other squares ? If yes, how ? If no, why ?
My mathematics teacher at TIME coaching classes was explaining about ancient Indians and their knowledge and skill. He extolled about the Hindus, Jains and Buddhists, about their researches, philosophies and their knowledge about the meaning of life.
Consider the following statements:
X does not exist.
There are two states for X. Existence and non-existence. Now, the question is,
Is there an excluded middle between the two states, i.e., is there an intermediate state ? Like, X exists but does not exist ???
Well, the research goes thus:
Consider you are sleeping.
In your dreams, you are chased by a tiger. You fear for life. You start running in order to escape.
Suddenly, you wake up from your sleep. You see no tiger. You are not running. You dont have any fear for life.
Now, we see that the tiger existed in dreams, but not in the awake state. It was real in dreams but unreal in reality. X (tiger) exists, but does not exist…
Why so much complexity ? Concept is very simple…
While we wake up every morning, we have a buffer time when we are awake, yet we are sleeping. We tend to live partly in our dreams.
One day, I experienced this. I had a nice dream. Suddenly, I woke up in order to go to class. I locked the room and went out. Apparently, my roommate was still sleeping inside the room. Conclusion : He did not feature in my dream, and I was dreaming when I was locking him inside. So, he did not exist, though he existed…
After one full week of preparation, giving lectures and handling lab classes, the Java programming workshop has finally come to an end. The workshop was conducted by me with the help of my friend, Aswin, as a part of Software Freedom Week celebrations.
This was the first workshop conducted in college by me after I was selected as the Campus Ambassador for Sun Microsystems. Java is one of the greatest products from Sun, which is extensively used in programming, web applications, mobile applications and more. So, I felt that conducting a workshop on Java programming would help the students learn the language. The workshop was intended to show the students the door to the world of Java.
The curriculum of NITT does not have an exclusive Java course. But there are many students who are interested in learning the language. I have seen many friends of mine who have tried to learn Java, but were confused about where to start and how to proceed.
The workshop was planned for second year B. Tech CSE students of my college. I went to their classroom and briefed them about the various open source technologies, about the Campus Ambassador Programme of Sun and about the numerous workshops that are to follow in the months to come. I also asked the students to do a study on open source and write an article on the same. The response was very good.
My HOD arranged the conference hall and the laboratory for our use. With the help of Aswin, I installed Java and Netbeans in all computers in the lab. The projector was set up too. The stage was set for the workshop.
32 students had been selected for the workshop. Everyone had assembled, eagerly awaiting the start. I distributed the Netbeans CDs, pens and key chains which Sun Microsystems had sent for the workshop. Then the classes began.
We started right from the basics, explaining the simple looping constructs, the conditional statements and various other syntax. Then we moved on to object oriented programming and related concepts like abstraction and polymorphism. Concepts of classes and objects were explained with regular demos on screen.
When Aswin was handling the class, I was busy taking snaps. Our HOD also visited the class to make sure everything was running smoothly.
We then explained the concepts of streams used in input/output. Exception handling was taught in detail. The lab practice sessions were interesting. Some students came up with excellent solutions which even we never thought of. The workshop was a learning experience for us too.
We also conducted a small review examination to gauge the understanding of the participating candidates. We wrote a simple Java program to evaluate the answers of students. The answers were discussed later.
We then ventured into complex topics like networking and swt. Students were taught how to write a chat application. They also had a lab session on that, where they implemented chat application and file sending programmes.
Practice makes a programmer perfect. Learning from the book will not help in learning a language. To become an expert, one must practice various programs and develop programming skills. This was emphasized during the workshop.
During the workshop, we asked the students to look up some interesting topics online, like obfuscated code and the dining philosophers problem. This helped the students to learn loads of new stuff.
All the presentations used and the demo programs were mailed to the students. The students’ feedback on the programme was also overwhelming. On the last day, I requested the students to look beyond text books and the curriculum. There must be a thirst for knowledge. Everyone must participate in the development of open source technologies. Gone is the age when there was a divide between the developer and the user. Now is the age where the user is the developer.
The first Java workshop was thus completed successfully. I am planning for the next workshop, which might be on Opensolaris, one of the most stable operating systems from Sun Microsystems. Looking forward to learning and sharing…
A Letter to Every Indian
The Former President of India DR. A. P. J. Abdul Kalam ‘s Speech in Hyderabad .
Why is the media here so negative?
Why are we in India so embarrassed to recognize our own strengths, our achievements?
We are such a great nation. We have so many amazing success stories but we refuse to acknowledge them. Why?
We are the first in milk production.
We are number one in Remote sensing satellites.
We are the second largest producer of wheat.
We are the second largest producer of rice.
Look at Dr. Sudarshan , he has transferred the tribal village into a self-sustaining, self-driving unit. There are millions of such achievements but our media is only obsessed in the bad news and failures and disasters.
I was in Tel Aviv once and I was reading the Israeli newspaper. It was the day after a lot of attacks and bombardments and deaths had taken place. The Hamas had struck. But the front page of the newspaper had the picture of a Jewish gentleman who in five years had transformed his desert into an orchard and a granary. It was this inspiring picture that everyone woke up to. The gory details of killings, bombardments, deaths, were inside in the newspaper, buried among other news.
In India we only read about death, sickness, terrorism, crime.. Why are we so NEGATIVE? Another question: Why are we, as a nation so obsessed with foreign things? We want foreign T.Vs, we want foreign shirts. We want foreign technology.
Why this obsession with everything imported. Do we not realize that self-respect comes with self-reliance? I was in Hyderabad giving this lecture, when a 14 year old girl asked me for my autograph. I asked her what her goal in life is. She replied: I want to live in a developed India . For her, you and I will have to build this developed India . You must proclaim. India is not an under-developed nation; it is a highly developed nation.
Do you have 10 minutes? Allow me to come back with a vengeance.
Got 10 minutes for your country? If yes, then read; otherwise, choice is yours.
YOU say that our government is inefficient.
YOU say that our laws are too old.
YOU say that the municipality does not pick up the garbage.
YOU say that the phones don’t work, the railways are a joke. The airline is the worst in the world, mails never reach their destination.
YOU say that our country has been fed to the dogs and is the absolute pits.
YOU say, say and say. What do YOU do about it?
Take a person on his way to Singapore. Give him a name – ‘YOURS’. Give him a face – ‘YOURS’. YOU walk out of the airport and you are at your International best. In Singapore you don’t throw cigarette butts on the roads or eat in the stores. YOU are as proud of their Underground links as they are. You pay $5 (approx. Rs. 60) to drive through Orchard Road (equivalent of Mahim Causeway or Pedder Road) between 5 PM and 8 PM. YOU come back to the parking lot to punch your parking ticket if you have over stayed in a restaurant or a shopping mall irrespective of your status identity In Singapore you don’t say anything, DO YOU? YOU wouldn’t dare to eat in public during Ramadan, in Dubai . YOU would not dare to go out without your head covered in Jeddah.
YOU would not dare to buy an employee of the telephone exchange in London at 10 pounds (Rs.650) a month to, ‘see to it that my STD and ISD calls are billed to someone else.’YOU would not dare to speed beyond 55 mph (88 km/h) in Washington and then tell the traffic cop, ‘Jaanta hai main kaun hoon (Do you know who I am?). I am so and so’s son. Take your two bucks and get lost.’ YOU wouldn’t chuck an empty coconut shell anywhere other than the garbage pail on the beaches in Australia and New Zealand .
Why don’t YOU spit Paan on the streets of Tokyo? Why don’t YOU use examination jockeys or buy fake certificates in Boston??? We are still talking of the same YOU. YOU who can respect and conform to a foreign system in other countries but cannot in your own. You who will throw papers and cigarettes on the road the moment you touch Indian ground. If you can be an involved and appreciative citizen in an alien country, why cannot you be the same here in India?
In America every dog owner has to clean up after his pet has done the job. Same in Japan.
Will the Indian citizen do that here?’ He’s right. We go to the polls to choose a government and after that forfeit all responsibility.
We sit back wanting to be pampered and expect the government to do everything for us whilst our contribution is totally negative. We expect the government to clean up but we are not going to stop chucking garbage all over the place nor are we going to stop to pick a up a stray piece of paper and throw it in the bin. We expect the railways to provide clean bathrooms but we are not going to learn the proper use of bathrooms.
We want Indian Airlines and Air India to provide the best of food and toiletries but we are not going to stop pilfering at the least opportunity. This applies even to the staff who is known not to pass on the service to the public. When it comes to burning social issues like those related to women, dowry, girl child! and others, we make loud drawing room protestations and continue to do the reverse at home. Our excuse? ‘It’s the whole system which has to change, how will it matter if I alone forego my sons’ rights to a dowry.’ So who’s going to change the system?
What does a system consist of? Very conveniently for us it consists of our neighbours, other households, other cities, other communities and the government. But definitely not me and YOU. When it comes to us actually making a positive contribution to the system we lock ourselves along with our families into a safe cocoon and look into the distance at countries far away and wait for a Mr.Clean to come along & work miracles for us with a majestic sweep of his hand or we leave the country and run away.
Like lazy cowards hounded by our fears we run to America to bask in their glory and praise their system. When New York becomes insecure we run to England . When England experiences unemployment, we take the next flight out to the Gulf. When the Gulf is war struck, we demand to be rescued and brought home by the Indian government. Everybody is out to abuse and rape the country. Nobody thinks of feeding the system. Our conscience is mortgaged to money.
Dear Indians, The article is highly thought inductive, calls for a great deal of introspection and pricks one’s conscience too. I am echoing J. F. Kennedy’s words to his fellow Americans to relate to Indians..
‘ASK WHAT WE CAN DO FOR INDIA AND DO WHAT HAS TO BE DONE TO MAKE INDIA WHAT AMERICA AND OTHER WESTERN COUNTRIES ARE TODAY’
Lets do what India needs from us.
–Dr. Abdul Kalam