Sunday, February 26, 2017

Preparing for Design questions

Many companies including Amazon have a system design round.
I have collected some material to prepare for the same :

1) https://medium.com/@Pinterest_Engineering/sharding-pinterest-how-we-scaled-our-mysql-fleet-3f341e96ca6f#.4vmrlyad1

2) https://www.quora.com/What-are-Master-and-Slave-databases-and-how-does-pairing-them-make-web-apps-faster

3) https://en.wikipedia.org/wiki/Paxos_(computer_science)

4) https://en.wikipedia.org/wiki/Spanner_(database)

5) https://en.wikipedia.org/wiki/Shard_(database_architecture)

6) https://en.wikipedia.org/wiki/Partition_(database)

7) http://ksat.me/a-plain-english-introduction-to-cap-theorem/

8) https://www.interviewbit.com/courses/system-design

Hope this helps!!

Friday, February 24, 2017

Saving contacts information using tries

Implementation for : https://www.hackerrank.com/challenges/ctci-contacts

Code :
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

struct trie {
    int isleaf;
    int child_cnt;
    trie * t[26];
};

int index(char c) {
    return c-'a';
}
trie * new_node() {
    trie * node = (trie *)malloc(sizeof(trie));
    for (int i = 0; i<26; i++) {
        node->t[i] = NULL;
    }
    node->isleaf = 0;
    int child_cnt = 0;
    return node;
}

void add (trie * root, string s) {
    int len = s.size();
    for (int i = 0; i< len; i++) {
        if (root->t[index(s[i])] == NULL) {
            root->t[index(s[i])] = new_node();
        }
        root->t[index(s[i])]->child_cnt++;
        root = root->t[index(s[i])];
    }
    root->isleaf = 1;
}

int find(trie *root, string s) {
    int len = s.size();
    for (int i = 0; i< len; i++) {
        if (root->t[index(s[i])] == NULL) {
            return 0;
        }
        root = root->t[index(s[i])];
    }
    if (root) {
        return root->child_cnt;
    }
    return 0;
}

int main(){
    int n;
    cin >> n;
    trie * root = new_node();
    for(int a0 = 0; a0 < n; a0++){
        string op;
        string contact;
        cin >> op >> contact;
        if (op == "add") {
            add(root, contact);
        } else {
            cout<<(find(root, contact))<<endl;
        }
    }
    return 0;
}

Friday, February 17, 2017

Here are 12 highlights of the Economic Survey 2017

Here are 12 highlights of the Economic Survey 2017:
* Demonetisation impact: The government says the adverse impact of demonetisation on GDP growth will be transitional. Real GDP growth in 2017-18 is projected to be in the range of 6.75 – 7.5 per cent, once the cash supply is replenished.
* Industrial growth to cool: Growth rate of the industrial sector estimated to moderate to 5.2 per cent in 2016-17 from 7.4% last fiscal. The agriculture sector to grow at 4.1 per cent in the current year up from 1.2 per cent in 2015-16
* Per-capita GSDP: Real per capita GSDP between 1983 and 2014 has shown across-the-board improvement
* Remonetisation: The Economic Survey 2017 has suggested quick remonetisation, push for digitisation, bringing land and real estate under GST ambit, reduction in taxes and stamp duties and an improved tax administration system as key reform measures to ensure long term economic benefits.
* States’ performance: There has been an improvement in the financial position of states over the last few years. The average revenue deficit has been eliminated, while the average fiscal deficit was curbed to less than 3 percent of GSDP. The average debt to GSDP ratio has also fallen. Centre’s Fiscal Responsibility and Budget Management (FRBM) Act, mirrored by Fiscal Responsibility Legislations (FRL) adopted in the States.
* NPAs: As per the Survey, gross NPAs has climbed to almost 12 per cent of gross advances for public sector banks at end-September 2016. At this level, India’s NPA ratio is higher than any other major emerging market, with the exception of Russia. The consequent squeeze of banks has led them to slow credit growth to crucial sectors-especially to industry and medium and small scale enterprises (MSMEs)-to levels unseen over the past two decades. As this has occurred, growth in private and overall investment has turned negative . A decisive resolution is urgently needed
* Asset rehabilitation: Survey suggests setting up of a centralised Public Sector Asset Rehabilitation Agency that will look after the largest, most difficult Cases, and make Politically Tough Decisions to reduce Debt .
* Poor targeting: According to the Survey, redistribution by the government is far from efficient in targeting the poor. The Survey points out that the capacity of the State in delivering essential services such as health and education is weak due to low capacity, with high levels of corruption, clientelism, rules and red tape. At the level of the states, competitive populism is more in evidence than competitive service delivery.
* Universal Basic Income: The Survey has advocated the concept of Universal Basic Income (UBI) as an alternative to the various social welfare schemes in an effort to reduce poverty. The Survey points out that the two prerequisites for a successful UBI are: (a) functional JAM (Jan Dhan, Aadhar and Mobile) system as it ensures that the cash transfer goes directly into the account of a beneficiary and (b) Centre-State negotiations on cost sharing for the programme.
* Property tax: A study done for the Survey shows that property tax potential is large and can be tapped to generate additional revenue at city level. Satellite imagery can be a useful tool for improving urban governance by facilitating better property tax compliance.
* Job creation: The Survey says Apparel and Leather industry are key to generation of formal and productive jobs: recommends reforms in labour and tax policies to make the Apparel and Leather sector globally competitive. The Survey adds that these sectors provide immense opportunities for creation of jobs for the weaker sections, especially for women, and can become vehicles for broader social transformation in the country.
* Labour migration: New estimates of labour migration in India have revealed that inter-state labour mobility is significantly higher than previous estimates. Relatively poorer states such as Bihar and Uttar Pradesh have high net out-migration. Seven states take positive CMM values reflecting net in-migration: Goa, Delhi, Maharashtra, Gujarat, Tamil Nadu, Kerala and Karnataka. Policy actions to sustain and maximise the benefits of migration include: ensuring portability of food security benefits, providing healthcare and a basic social security framework for migrants – potentially through an inter-state self-registration process.

IAS topper notes GS, eco and other topics

Download link : https://drive.google.com/drive/u/0/folders/0B1enFTOjOFM9VnJwc2lQM3JZS3M

Download 25 years civil services prelims exam papers

Download Link :
https://drive.google.com/file/d/0B68bKAk6jRaDVnl0dDNwNk5WT2s/view

Tuesday, February 14, 2017

IAS interview experience - 5

Date – 30th April 2014
Board – Prof David R Syiemlieh
Detailed Application Form (DAF) – Akand Sitra's Repository - Google Docs

The attendant opened the door for me, there were five members including the Chairman sitting around a circular desk. My seat was opposite to the Chairman’s and I had two Members on either side. It was more of a discussion desk rather than an interview desk. Let us call the members as CM, M1, M2, M3 and M4.

A – May I come in Sir?

CM – Come in, come in.

A – Good morning Mr.Chairman, good morning sirs.

CM – Good morning Sitra, please take your seat. (My name is Akand!!)

A – Thank you sir. ( Sat comfortably, it was a very comfy chair)

CM -So, you were born in Anantapur? (Reading my DAF)

A – Yes, sir and my home town is Kurnool.

CM – Achcha, and you live in Bangalore right now?

A – Yes sir, I’am from Bangalore.

CM – Achcha, your hobby is cycling? How did that start?

A – Sir, back in college, cycling was a necessity. Hostels were far from classes and also far from mess. So, all of us used to cycle to all places. So, a necessity had transformed into a passion. We started going on long-distance cycling trips. We cycled till Mahabalipuram which is over 50 km away and also to Kovalam beach near Chennai.

CM – Hmmmm. Around two days ago, there was another candidate with a strange hobby. It was sparrow watching. Can you tell me why sparrow watching in big cities, like Delhi is declining?

A – (Why is he asking me questions on someone else’s hobby?! Maybe he is trying to make this into a stress interview) Sir, one of the main causes for decline of sparrow watching is due to the immense pollution that every city has these days. A few decades ago, sparrow watching would not be considered as a hobby as there were sparrows everywhere! It has become a “hobbby” now because they are almost endangered.

CM – Hmmmm.. Do you know who was the first sparrow watcher in India?

A- Smiled. I don’t know Sir.

CM – Who was the founder of the Indian National Congress?

A – (Why is he asking random unrelated questions!) Sir, Dadabhai Naoroji.

CM – Ummm, along with Mr. A.O.Hume.

A – Yes Sir.

CM – He was one of the first sparrow watcher in India. Not many know this side of him, many know him just for founding INC. He was an incredible bird watcher.

A – Smiled. Okay Sir. (No clue why he was saying all this)

CM – Achcha, you worked in this company called Sabre Holdings? As an Associate Product Specialist? What was your exact work there?

A – Sir, I had joined the job in July after writing Prelims in May. Within three months I quit the job because I couldn’t find time to prepare for Mains. So, they did not give me any solid work till then. I was still in basic training.

CM – Look Sitra. (My name is Akand!!) When you talk with your peers, you can use words like “Mains”, but when you come to important interviews like this you should not only be politically correct but also academically correct. Mains can be anything.

M4 – Yeah! It can be power mains or water mains too! So what Mains is it?

A – (I understood that this was one of the stupidest questions. They were just trying to make me uncomfortable and wanted to see whether I would panic) I grinned from ear to ear. True sir, Sorry. I meant Civil Services Mains. I should be more careful. Then gave a broad smile.

CM – Okay. Tell me three best qualities you think you have.

A – (I was blank, no quality was coming into my mind) Ummm Sir, Leadership. I had assumed many leadership roles in college and I think I did a fair job.

Ummm, second would be honesty. Smiled.

Third, let me think Sir. Nothing is coming into my mind.

CM – Your smile man! Your smile is your best quality. Never forget that.

A – Yes sir, my smile. Thank you sir. And gave a big grin again.

CM – Tell me your three negative qualities now.

A – Well sir, first would be I don’t know what to talk when. I should learn to be more diplomatic. Like just now, I should have said Civil Services Mains instead of Mains.

CM – Thats all right. You can always learn that in training. Second?

A – Ummmm, I always take too much in my plate.

CM – That is, you bite more than you can chew?

A – Yes sir, back in college, I tried to organize a lot of events simultaneously. I think, if I had taken them one by one, I could have done a much better job.

CM – And third?

A – (I thought for a while) I make friends very easily Sir. That is, I have trust issues. I am very trusting.

CM – Laughing. It’s okay. That is not a negative.

Then he asked M1 to continue.

M1 – You do yoga? Tell the different types of yoga.

A – (I totally forgot this answer) Sir, there is hatha yoga, kundalini yoga, meditation yoga etc. I dont remember others.

M1 – Meditation yoga??? Hmmmm.. What is transcendental meditation?

A – I am not sure of the answer, can I take a guess Sir?

M1 – No, leave it. You know Art of Living? Who is its founder?

A – Sri Sri Ravishankar… Ji.. Sir.

M1 – Hmmm.. Who was his guru?

A – Sorry Sir, I don’t know that.

M1 – (Irritated) Forget yoga. Are you thorough in anything?

A – Sorry sir, I have been doing very basic yoga under my school yoga master, Mr. Rawat. Very simple pranayamas and asanas like anulom-vilom, vrikshasana etc. I am not really thorough in the theoretical aspects of yoga as I had always concentrated only on its practical uses.

M1 – You didn’t get me. Let me repeat myself. Are you thorough in anything?

A – Sir, biotechnology sir.

M1 – What biotech did you learn? Industrial or research?

A – Sir, we had courses on both industrial biotech like reaction engineering and also on research biotech like cell biology and tissue engineering. I did two internships, one in an industry and one in an research institute, IMSc.

M1 – What is the difference between industrial biotech and research biotechnology?

A – Gave a long textbook definition.

M1 -You know WTO?(Yes, Sir) What is TRIPS?

A – Trade related aspects of intellectual property rights is a policy… blah blah.. talked about traditional knowledge… blah blah.. patenting healing properties of turmeric powder, yogic postures, bad for indigenous growth…. etc etc.

M1 – But, how is patenting turmeric illegal? It is mere documentation of process, right?.

A – No sir. When a western company patents the healing properties of turmeric powder, it gains the sole right for all its properties and its commercialization. In countries like India, turmeric powder is in use for centuries. After such a patent, any traditional use will be illegal and all Indians should start paying royalty for using their own indigenous product. So intellectual properties must be regulated hence the necessity of TRIPS.

M1 – Okay, tell me the three requirements for patents.

A – Ummmm, originality? Innovation?

M1 – No. It’s novelty.

A – Okay sir. ( I thought my interview was very bad till now. I had to gain the upper ground soon or else I would get very average marks. It seemed like M1 hated me and now I had to answer more carefully. They had manipulated me enough, it was my time to manipulate them)

M2 – Tell me the difference between botany and biotechnology.

A – Sir, botany is the study of plants and organisms whereas biotechnology is the study of usage of modified living organisms for economical purposes for humans, like GM crops, drugs etc.

M2 – Okay, tell me a 20 th century Indian botany scientist.

A – Ummmm, Sir, Jagadish Chandra Bose?

M2 – Correct, can you tell me his achievements?

A – He was the first to discover that plants could communicate with each other.

M2 – Okay, any other discoveries?

A – Also something related to radio waves.

M2 – No, that is in physics, I’am asking in botany.

A – I think that’s all sir.

M2 – He also discovered that plants were living things like us too. Yes, as you said, they can communicate too. Do you know any English 20th century botanist?

A – Umm sorry sir, I cant recall any.

M2 – Ever heard of Luther Burbank?

A – Yes sir, the name is familiar but I don’t recall anything else about him.

M2 – He was a great botanist too. Without using biotechnology like in recent days, he used to make better crops. Can you tell me how?

A – By cross-breeding between two different species of the crop sir. In-breeding.

M2 – Yes, correct. He also invented something called “edible cactus”. Can you explain what that is and how he could have done it?

A – Hmmmm. Sir, usually cactii have thorns on them to protect themselves from animals which try to eat them. Maybe, Burbank tried to communicate with the cactus and tried to tell it that the surrounding is safe for it. There are no animals in the area to eat it. This made the cactus not grow the thorns, thus using communication he got cactus without thorns which can be edible.

M2 – Yes, correct. On a totally unrelated note, can you tell me who said this quote? “I am not an Athenian or Greek, I am a world Citizen”

A – Ummm, Socrates??

M2 – No, it was Aristotle. (It is Socrates actually) Can you tell me what you understood from it?

A – In today’s globalized world, the whole world is becoming one global village. The boundaries between different states, nationalities are eroding day by day. With communication technology, one can contact any part of the world instantly. Every country is becoming more and more similar with common companies like McDonalds etc. So, distinguishing ourselves through countries is being replaced by becoming a global citizen. Who knows Sir, in the near future all countries might become one and literally replace with world citizenship as prophesized by Aristotle. (It was Socrates)

M2 – Hmm. You are partially correct. But, according to me I think he was saying that we all are humans first. Let’s be human beings before dividing ourselves into various countries.

A – Yes Sir. But he used the term “world citizen”, so I think it is much more than just being a human being.

M2 – Yes, Sitra. You are right. (My name is Akand!!!)

CM – What are your preferences?

A – First, the administrative services Sir, then the police services..

CM – Administrative? For which country? British eh? Bhutan eh?

A – I am sorry Sir. I did it again. I should be more academically correct. I meant the Indian Administrative Services. (He was trying to stress me out again.)

CM – Achcha, always be diplomatic and think before you answer. (Yes Sir) What are your state preferences?

A – Sir, I don’t mind working in any part of the country, every state has its own problems. But, since the choice of preference was given I would take Andhra Pradesh, because of familiarity with ground problems.

CM – Hmmm, next? (Sir, Karnataka). Next? (Tamil Nadu) Next? (Kerala). (He was testing me whether I had actually remembered my state preferences. Many people just allocate them randomly, but thankfully I remembered all the South Indian states)

M3 – You said your first positive quality is Leadership. Can you tell me the difference between a leader and an administrator.

A – Sir, a leader should be a person who can enthuse his subordinates anytime so that they are willing to work for the profit of the organization. An administrator is more a mix of a manager and a leader. A manager just needs to facilitate and give directions. So, an administrator should be an efficient leader and an effective manager.

M3 – What is this S-Net ambassador? What have you done there?

A – Sir, Sustainability Network is an organization in IIT Madras, which takes care of the sustainability of the energy resources we use. My work as a S-Net ambassador was to calculate the total energy consumption in my hostel and also to calculate the unnecessary wastage going through. I was also asked to calculate the area on the roof where a solar water heater could be established. I made a report with all my recommendations and observations in it.

M3 – Ok. Do you Food stability act?

M4 – He means Food Security Act.

A – The NFSA? Yes sir, the idea behind the act was that everybody should be comfortable regarding food. Noone should sleep on an empty stomach.

M4 – Everybody? Are you sure?

A – Yes sir, I was coming to the technical part. The govt gives subsidized food grains to 2/3rds of the population. 75% in the rural areas and 50% in the urban areas. So that everybody can be happy and not hungry.

M4 – Everybody?

A – Mostly, people below the poverty line Sir. But the core idea was everybody should be well-fed.

M4 – Everybody? Think harder. It is called the National Food Security Act.

A – (Then it dawns on me) No Sir, not everybody. Only Indians.

M4 – Yes correct. It is only for the Indian citizens and not the world population. You should be very careful in your choice of words. This is the third time. In one instant, you changed the beneficiaries from 1 billion to 7 billion!

A – (Gave a sheepish grin)(Smiled) Yes sir, sorry. I should be academically correct. ( Even M4 was playing with me like CM. Why is everyone trying to make me tense?)

M3 – Okay, you are from Andhra Pradesh. Tell me about the status.

A – Sir, recently after the division of Andhra Pradesh into Telengana and residual Andhra Pradesh, the future is going to be both grim and hopeful for the residual Andhra. With Hyderabad gone to Telangana, more than 60% of the revenue is gone. With most of the Godavari and Krishna running through Telangana, there will be water shortage for the residual Andhra too. Not only that, all educational institutions, offices, important colleges, everything is gone. I am not saying the division is a bad thing, the emotions of the Telangana people must be respected. But the repercussions on the residual Andhra are very high. It has nothing right now, that is the sole reason why I want to go the Andhra cadre. The IAS officers who join now will be pioneers in rebuilding the state. I want to bring a planned change in all districts and bring Andhra back to its former glory. And the whole Andhra is united this time to bring back enormous developmental change. So, even when the situation is very bad everyone is hopeful of starting everything back from scratch Sir.

M3 – Okay, you said Hyderabad is gone to Telangana right? What other important cities are in Andhra now?

A – Sir, Vishakhapatnam. Vijaywada, Tirupthi etc. Mostly all the district capitals, most of them are big towns not large metropolitan commercial cities like Hyderabad.

M3 – Okay, and these cities are in residual Andhra?

A – Yes Sir.

M4 – (Reading the Accomplishments section in my DAF) What is this NCO? AIR 225?

A – NCO is National Cyber Olympiad where “Indian” students from all over the country had participated. It was mostly an online exam which tests our computer skills. I got rank 225 all India.

M4 – What is cyber crime?

A – Any crime made through computer technology and the internet is cyber crime Sir. Like hacking govt websites, online transactions of money etc.

M4 – KVPY. “Offered” to join IISER? I didnt understand. You were offered to join an institution?

A – Yes Sir, Kishore Vaigyanik Prothsahith Yojana is a govt scheme where exams are conducted to take students into basic sciences. I wrote the exam in my 12th std and I was offered to join IISER with a stipend after I cleared it. But then, I got through IITJEE also, so I declined this offer to join IIT Madras.

M4 – Hmmm. Good. What is this Al Gore Sustainable thing?

A – Sir, Al Gore Sustainability Technology Venture Competition was an event founded by a Professor in Carnegie Mellon University. She had come to IITM and she said she wanted volunteers to organize this event and I was one of the volunteers. We organized it in a grand scale. It is basically a competition for sustainable business plans for upcoming start-ups. I saw many astonishing designs which can be put for use in rural India.

M4 – Okay, who was Al Gore.

A – He was the ex-Vice President of the US.

M4 – Yes, he was into politics too and not only the environment. Did he win a Nobel Prize?

A – Yes sir, he won one.

M4 – Are you sure? No he did not.

A – I think he did Sir. Smiled.

M4 – You have Marathons in your DAF too? Tell me where the word marathon is derived from.

A – I am sorry Sir, I dont know. I think it is another Greek word.

M4 – You and your friends used to run marathons but never discussed about the origin of the name?

A – Smiling. Yes sir, sorry sir. We were more worried about completing the marathon only. He laughed.

M4 – What is this Eureka run?

A – It was the name of an NGO which organized a run Sir. After running, whatever money we contributed, they would make a good use of it.

M4 – Okay, tell me how the word “Eureka” originate?

A – (Trying to remember.) Sir, I know the story. There was a guy sitting in his bath tub and he came out crying Eureka after discovering a scientific principle.

CM – “Guy”!? A guy? Was he wearing jeans? Was he listening to his iPod?

A – Oops Sorry Sir. I did it again. (Smiling)(He was smiling too) I should be more academically correct in my statements. A respected scientist came out running into the streets after discovering buoyancy sir.

M4 – What was his name?

A – (Tried hard to think but forgot this simple fact.) Sorry sir, I don’t remember.

M4 – No, you cant say I don’t knows anymore. (Laughing) Take a guess.

A – Sir, Aristotle. :P
M4 – No, it was Archimedes.

A – Yes sir!  (With a sudden emotion of recognizing the simple answer)

M4 – So you play Kho Kho and Kabaddi too? Nobody plays these games anymore.

A – Yes sir, I used to play back in school. I was in Kendriya Vidyalaya so all these games were compulsory.

M4 – But, isn’t Kho Kho a girl’s game?

A – No Sir! It is played by boys too. We have a national boys kho kho team in our school.

M4 – Good good. ( I don’t know why he was impressed when I said my school had a team. I had nothing to do with it :P)

M4 – Sitra, you have done so many things! And you are not even 23 yet!

CM – Yes yes, he is too young. You can see that on his face itself.

M4 – I think he is one of the youngest we have seen in this stage right?

A – (Smiled) Thank you sir.

M4 – Okay, tell me about biodiversity. How does it harm humans?

A – Sir, biodiversity is the variety of living organisms in the surroundings. But sir, people keep saying if we destroy the biodiversity, “nature” will be destroyed. I think it is the other way round. Nature will always be there. It was there in the past, it is there now and it will continue to be in the future. When humans try to harm the environment through pollution etc., they are not harming nature. But they are harming themselves. It is their species which is going to get destroyed and not nature. Through usage of too many polluting chemicals, global warming, melting of polar caps, submerging of coastal areas, nothing serious is happening to nature. It is our survival that we should be worried about.

(I was on a high when I was saying this)

M4 – Okay. But can you be more specific how biodiversity changes can affect humans?

A – There would be adverse effects on the food chain. The whole biodiversity is a large web Sir. Even if there is a disturbance in one end, the whole web can get affected. Every species has a specific function in nature, if we destroy that species, we are harming ourselves and the whole fabric Sir.

M4 – Okay. Tell me which is better. Small states or big states? Small states like Goa have been developed too and large states like Gujarat are developed too. So should we have many small states or should we have very few large states??

A – Sir, every issue has both pros and cons. If we have large states, the ground level administration can become tough, but large states send a large number of MP s to the Parliament and they have the numbers to bring in state-specific policies. Whereas, small states can be administered very well because of less area and less population, but they send only 1 or 2 MP s. 1 MP doesnt make much difference in 545 other MP s Sir. So, I would say it should be in middle. The state should be small enough to be managed well and also large enough to get enough attention in the Parliament.

M4 – Haha so you took the middle ground. Safest approach.

CM – Thank you Sitra, your interview is over. (My name is Akand!!)

A – Thank you Sir. ( I got up and was about to leave)

M4 – What is the meaning of your name, Sitra?

A – Sir, my name is Akand. Sitra is just a family name. :)

CM – Achcha, makes more sense now.

A – Thank you Sir.

And left. Came out at 10 45. Half an hour exact.

IAS interview experience - 4

Board: Prof. H.C. Gupta
Stream: MBBS
Optional: Medical Science
Service preference: IAS>IFS>IRS
Place of birth- Varanasi
Hobbies- Reading, writing articles and quizzing

To the best of my memory, it went like this-

Chairman sir-
So u finished your MBBS last year March..what have you been doing since? (4 months before prelims..what could i have been doing Sir!! Duh-uh)

So you belong to the Prime Minister's constituency..Any changes that have been brought since he became the MP?
Don't you think we should ban throwing of religious waste in the Ganges?

M1-
As a DM of Varanasi what steps will you take to handle-
A) the lack of sanitation
B) the touts/thugs faced by tourists
C) the street vendors encroaching narrow roads to temples and ghats

What does women empowerment mean to you?
 What steps would you take as a lady officer in this regard?

What is the difference between AIDS and HIV?

What is the government doing to control AIDS? Is it working?

How does a patient of AIDS die?

M2-
Name 2 authors of indian origin who have won the Booker prize.
Can you name one more?

Why IAS after MBBS?

What qualities do you have that you think will make you a good civil servant?

M3-
Largest economy in the world?

How many times is china's GDP of India's GDP?

Suppose there is a medical college in your district and the nurses and Group D staff has gone on strike, what steps will you take as a DM?
Will you intervene in the first stage?
Suppose the negotiations fail? Then?
What is your last resort?
Anything milder than that? (I answered ESMA)
Whom shall you ask for help?

M4-
What is the place of medical ethics in todays world of commercial medicine, medical insurance, etc etc etc(a lot of big words)?

How can we bring more ethicality into our doctors?

Where did you do your rural stint? How was the experience?

<Smiling broadly> tell me which was the tallest mountain in the world before they discovered Mt.Everest?

Chairman- Thank you. You may go now.

IAS interview experience - 3

CSE Interview, 2014
Board: H C Gupta + four members ( all gents)
Date: 19 May 2015, 4.30 PM
Duration: 30 minutes
Optional: Sociology
Chairman: Read out my educational and employment details from DAF
1. Which NGO did you work?
2. What sectors does it work? ( drinking water and sanitation)
3. Which projects on sanitation did you work. Please explain
4. Who is the founder of Sulabh International?
5. What is Sulabh model of toilets
6. Is there any other alternative sanitation models?
7. Tell me about the recent Karnataka High Court verdict? ( Jayalalitha case) What is her full name?
8. Why did Tamil Nadu HC transfer the case to Karnataka?

M1:
1. Why is Lokpal needed?
2. What is Lokayukta? Who is current Lokayukta in Karnataka?
3. How do you curb corruption in India?
4. Among all the rights based approach which scheme you think is best? (MNREGA)
5. Is MNREGA successful? Tell it loopholes?
6. How do you create better community assets?

M2:
1. What is intellectual property?
2. What is Geographical Indications?
3. Why is Indian GIs less successful than EU GI like wine etc
4. Tell me about USA GI. How are they performing?
5. Why negative balance of trade is bad for India? We can very well import goods?
6. Why our exports not competitive? ( Long question , he gave example of automobile industry being competitive)
7.  Case: Your are District Collector, there is a calamity( floods) all  crops are destroyed and there are no official records about cropping  patter in our office? You have to start from scratch. What are the steps  you will take? (long question)
8.  How will you finance the crop losses? Tell about National Calamity  fund? National contingency fund? Differences? Who gives funds?

M3:
1. Why Urban local bodies not able to self finance urban projects?
2. What are the sources of funds for ULBs?
3. What is percentage of property tax collection in ULBs?
4. How can you overcome the shortfalls in tax collection?
5. What is Solid waste tax and water cess?

M4:
1. Why are old age homes growing in India(My hobby is “visiting old age homes”)
2. What will you do if children abandon their parents and send to old age homes? What is the age of your parents?
3. What are the laws related to it?
4. Which war movies have you seen? Did you watch any 16th- 17th war movies( This is NOT my hobby)
Chairman: Your interview is over.

Monday, February 13, 2017

IAS interview experience - 2

UPSC CSE 2014 Interview Transcript

I got my interview scheduled for the afternoon session of 15th May 2015. With the wishes of my family and friends, and carrying loads of hopes of my dear ones, I prepared myself for the big day. I reached UPSC with My pillar of support - the one who is more confident about me than myself.
Loads of thoughts crossed my mind but one gentle touch gave me all the strength in the world. I entered in. The gate separated the smiles.
I was allotted Mr. Manbir Singh’s board. After the verification of documents we moved to the waiting hall. Below that dome of the Dholpur house which remains the dream of lakhs of aspirants. After hours of wait, chats and discussions, I was called in at around 4.45 pm.
I entered the room, wished the Chairman and the members. He told me to take my seat. I dragged the chair and settled down.
C: So you are already in a Group-A service. You must be following the current issues. Which newspaper do you read? What was in the editorial today?
Me: Sir I read the one about the high productivity of this budget session after almost 15 years, due to the majority this government has got.
C: Productivity in terms of what?
Me: Sir, in terms of the working time, bills passed, discussions, question hours
C: Okay, So what were the bills passed by the Parliament in this session? Parliament, not Lok Sabha.
Me: Sir, Black money bill. Some bills like LARR amendment, GST have been sent to committees.
C: Is Black money bill really needed in India?
Me: Yes sir it is definitely a progressive legislation as black money leads to a parallel economy. In most cases the money laundered is diverted to terrorism financing which makes it all the more important for India due to its sensitive and strategic location.
C: Will the bill serve the purpose?
Me: Sir curbing black money will of course be achieved in the long term but the present need is to create deterrence since huge amounts of money are involved.
C: So you feel it won’t bring immediate changes?
Me: Sir on an immediate basis the aim is to bring back the black money stashed abroad. Since the issue is a complex one involving political corridors and other vested interests, curbing it may not happen immediately. The bill is very essential but its implementation will decide its effectiveness.
I was a little relaxed by then as the Chairman had finished shooting his questions.
M1: What is BPR? Sam Pitroda who headed NKC said that BPR is essential while computerization of government departments. Your comments.
didn't know much about the question and so answered vaguely.
M1: What is BCP? What is going concern? Government accounting? Types of accounts?
One thing that I confidently said for all the above questions were – Sorry Sir, I don’t know.(Lol)
M1: Tell me what is cut motion? What is token cut?
I explained in my words. Couldn't recollect any bookish ones.
M1: Explain the budgetary process.
I felt a truckload of polity questions bulldozing me. Finally the next member shifted to a different arena – even more dreadful. It was based on my graduation - Electronics & Communication Engineering.
M2: What is GSM? CDMA? What are the differences between them?
Some random preparation helped me answer them pretty decently.
M2: What is broadband? Potential in India. What are the government initiatives for rural connectivity?
I explained internet and mobile penetration with reference to the National Telecom Policy 2012 and broadband for service delivery. I also explained NOFN.
M2: What is USOF?
It was asked as USOF finances NOFN, so answered it.
M2: Let me give you a case study. Give your comments.
He explained a labour union issue in a very elaborate manner. If you are the DM will you order police firing? Yes/No.
The 3rd member was a lady. Again it was a round of Indian polity.

M3:    Which bills were referred to the joint and the select committees?
         What are the proposed changes in the child labour law?
         What is a private member bill? Recent example. When was the previous such instance?
         What does the 8th schedule of the constitution contain?
She then asked what is Vedaranyam plan? I didn't have any idea about it except its location.

Another random question – Who was Ibn Battuta? Which emperor did he meet in India?
M4: I will ask you simple questions (He smiled).
I thought - Simple? So he feels the questions till now were not simple! (It was a great feeling)
M4: Lightning and thunder. What are the values of the speed of light and sound?
  Hot water or steam – which causes more burns?
  Will tubelight continue to glow even after the starter is removed?
I answered all of them and explained the science behind them. Felt relieved with that stream of simple questions.
M4: What is MCB?
Me: Sorry Sir, I don’t know.
M4: Explain the Evolution of IT in India.
I said about internet , smart phone based apps etc.
M4: How does mobile technology function?
I explained geographically divided cells (hexagonal), mobile towers, hand-offs
M4: What are the differences between TVs of older times and the present?
Me: Sir, miniaturization. Earlier CRTs were used for display while now we have shifted to LCD and even LEDs.
M4: Abbreviate LCD and LED. Which is better in terms of image quality?
I just answered his question without explaining much.
M4: What is 3D TV?
I again kept my answer short as I didn't know the technical details of 3D TV.
C: Thank you
I thanked everybody and left.
Outside the gate there were eager eyes waiting to see me. I got back to those patient yet anxious ones that waited for four long hours. Blessing in my life!
P.S: The only aspect from my DAF on which questions were asked was my Graduation. It was a totally unexpected kind of test I faced. My kind suggestion to aspirants is to have a very open mind while going for Personality Test. Don’t have preconceived thoughts about what kind of questions you will face, but that shouldn't stop one from preparing one’s DAF well.


Expect the unexpected. Those 25-30 minutes is like a roller coaster ride – you will experience many emotions. Enjoy the thrill. All the very best. :-)

Sunday, February 12, 2017

Gvim tip and tricks - 3

If you are using vim editor. You can compile the file from the editor using following command:
: !g++ %
! - means run shell command
g++ - cpp compiler
% - current file.

IAS interview experience - 1

IAS interview experience :

Rank : 58
Attempt No : 1st

Board: Professor H.C. Gupta
Date: 9 June 2015
Time: 4:30 pm

Academic Background: B.Tech, Electrical IIT Delhi (2013)
Job Experience: RBI & Samsung (both intern), Estee Advisors (current)
Hobbies: Learning language, chess, teaching.

-------------- (Chairperson) ---------

CP: So are you working ?

Me: Yes sir.

CP : Where and what are you doing?

Me: Sir, I am working as a technical analyst at Estee Advisors Private Limited, Gurgaon

CP: What's your role.

Me: Sir, I write softwares for High Frequency Trading platform.

CP: In which stock exchanges does your company trade?

Me: NSE, BSE, MCX, CME, SGCX, DGCX

CP: Recently the govt has launched a scheme related to gold. Do you know about it?

Me: Yes sir. It is called Gold Monetisation Scheme .... details followed.

CP: I think it's a completely useless scheme. People are emotionally attached to their jewellery and therefore they would never put their jewellery in bank.

Me: Sir we can offer higher interest rate and moreover all our gold is not in the form of jewellery.

CP: (not convinced by my answer). It's the bureaucrat like you that give such nonsense suggestions. Tell me some measures to improve the scheme.

Me: (.. gave some measures).

CP: (again not convinced). The steps suggested by you have been tried earlier in many different forms. If they did not work in past then how will it work in future?

Me: Sir, it's better to have hope than be pessimistic.

CP: Do you think having hope will run the country ?

CP suggested to other members to ask questions.

------------------------------------------ (Member - 1)  ------------------

M1: So Bhavesh, tell me what's a blue water navy?

Me: I told him the definition etc.

M1: What is India doing in this regard ?

Me: Told him about our PMs visit, navy rescue efforts, joint exercise, upgradation etc.

M1: He asked me about some warfare ships imported from Russia.

Me: Sorry sir, I don't recall the name

M1: Your hobby is language learning. What languages do you know?

Me: Sir, I like learning scripts and I can read and write in all major Indian languages.

M1: Can you write your name in Tamil .

Me: I wrote my name in Tamil.



M1: So your name is Bhavesh and not Bhaavesh.

Me: Yes sir !

Lady Member (from Bengal): Write your name in Bengali

Me: I wrote my name in Bengali



Lady Member: Great, this guy can be posted to any corner of the country.

M1: Why are you learning these languages.

Me: Told him about my project to digitise all Indian texts from ancient to medieval era in a searchable format.

---------------------------------- (M2 : Lady Member)  --------------------
M2: So you have worked in RBI?

Me: Yes ma'am.

M2: Do you think RBI role is as important today as it was 20 years.

Me: Gave some standard text book answers.

M2: Why 21st century is called Asian Century.

Me: A standard reply follows ...

M2: Give some reasons why Bollywood will supercede Hollywood in 21st century.

Me: Large diaspora, diversity, music, huge population etc ...

M2: Which was the last book you studied?

Me: Surely You're Joking Feynman - Richard Feynman

M2: What's it about?

Me: Told her about the life of great physicist etc....

---------------------------------- (Member - 3)  ------------------------------

M3: Why our agricultural policy is flawed?

Me: Gave a very long reply - compromising on long term gains vs short term benefits etc. ....

M3: Did India liberalise too early?

Me: Again a long answer followed. I gave ample data both in favour and in against ...
----------------------------------------------- (Member - 4) ----------

M4: Tell me something about John Nash. Which disease was he suffering from?

Me: Narrated his life history in detail .............

M4: Who gave the concept of Game Theory first?

Me: Sorry sir, I don't recall the name.

M4: How many Nobel prizes have been awarded in the field of game theory.

Me: I told him 6 but 11 was the answer.

M4: Why IITians don't join DRDO?

Me: Gave a long reply .............

M4: I will have to talk to DRDO !!

-------------------------------------------------------------------------------------------------------------------------------

Chairperson: Thank you Bhavesh, your interview is over.


My Assessment:
I really had a fun time in the interview. Contrary to what others tell, the board members are extremely cordial and friendly. Prof H.C. Gupta is a genius. He did his PhD at the age of 20 / 22 years !!
Although he seems intimidating at first but he actually tries to put you through stress test.

Overall I was quite satisfied with my effort. Now waiting for marks; although UPSC is known for giving very less marks even if you think that your interview went fine.

EDIT: I got 209 / 275 marks !

Taken from : https://www.quora.com/What-type-of-questions-are-asked-in-UPSC-CSE-interviews/answer/Bhavesh-Mishra

C CODE for seedfill algorithm

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void boundary_fill(int x,int y,int fill_color,int boun_color)
{
    int color;
    color=getpixel(x,y);
    if(color!=fill_color && color!=boun_color)
    {
        boundary_fill(x-1,y,fill_color,boun_color);
        boundary_fill(x+1,y,fill_color,boun_color);
        boundary_fill(x,y-1,fill_color,boun_color);
        boundary_fill(x,y+1,fill_color,boun_color);
    }
    delay(30);
}
void main()
{
    int gd=0,gm,fill=9,boun=15,x1,y1;
    initgraph(&gd,&gm,"");
    x1=5;
    y1=5;
    line(0,240,640,240);
    line(320,0,320,480);
    rectangle(320,225,325,240);
    boundary_fill(x1,y1,fill,boun);
    getch();
    closegraph();
}

C CODE for drawing flag and animation

#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main()
{

    int gdriver = DETECT, gmode, errorcode,r1,r2,x1,y1,x;
    int left=150, top=150, right=500, bottom=100,i,y;
    float j;

    initgraph(&gdriver, &gmode, "");

    for(i=0;i<3;i++)
    {
        rectangle(left,top,right,bottom);
        top=bottom;
        bottom=bottom-50;
        setcolor(0);
    }
    for(y=150;y>=0;y--)
    {
        line(150,y,500,y);
        if(y<=150 && y>=100)
            setcolor(2);
        if(y<=100 && y>=50)
            setcolor(15);
        if(y<=50 && y>=0)
            setcolor(4);
    }
    setcolor(1);
    circle(325,75,25);
    for(j=0;j<=6.28;j=j+0.26167)
    {
        r1=25*cos(j);
        r2=25*sin(j);
        line(325,75,r1+325,-r2+75);
    }
    setcolor(6);

    line(150,150,150,600);
    y=0;
    for(x1=500;x1>=400;x1--)
    {
        setcolor(0);
        line(x1,0,x1,150);
        delay(50);
    }
    y1=0;
    for(x=400;x<=500;x++)
    {
        if(y1>=0 && y1<=50)
        {
            setcolor(4);
            line(x,0,x,50);
        }
        delay(50);
        y1++;
    }
    y1=50;
    for(x=400;x<=500;x++)
    {
        if(y1>=50 && y1<=100)
        {
            setcolor(15);
            line(x,50,x,100);
        }
        delay(50);
        y1++;
    }
    y1=100;
    for(x=400;x<=500;x++)
    {
        if(y1>=100 && y1<=150)
        {
            setcolor(2);
            line(x,100,x,150);
        }
        delay(50);
        y1++;
    }



    setcolor(4);
    getch();
    closegraph();
}

C CODE to draw line using mid point approach

#include<conio.h>
#include<iostream.h>
#include<graphics.h>

void put_pixel(int x, int y, int col)
{
 putpixel(x+320, 240-y, col);
}

void mid_pt(int x1, int y1, int x2, int y2)
{
 int d;
 float m;
 setcolor(RED);
 line(320,0,320,480);
 setcolor(BLUE);
 line(0,240,640,240);
 setcolor(WHITE);

 if(x2!=x1)
   m=1.0*(y2-y1)/(x2-x1);

 int xa,ya,xb,yb;

 if(x1<x2)
 {
   xa=x1;ya=y1;
   xb=x2;yb=y2;
 }
 else
 {
   xa=x2;ya=y2;
   xb=x1;yb=y1;
 }

 int dx = xb-xa;
 int dy = yb-ya;

 float x = xa, y = ya;
 if( m>=0 && m<=1 )
 {
   put_pixel(xa,ya,15);
   d = 2.0*dy-dx;
   while(x<xb)
   {
     if(d>0)
     {
    //case ne
    d+=dy-dx;
    x++;
    y++;
     }
     else
     {
    d+= dy;
    x++;
     }
     put_pixel(x,y,15);
   }
 }
 else if(m>-1 && m<0)
 {
   put_pixel(xa,ya,15);
   d = 2.0*dy+dx;
   while(x<xb)
   {
     if(d>0)
     {
    //case e
    d+=dy;
    x++;

     }
     else
     {
    d+= dy+dx;
    x++;  y--;
     }
     put_pixel(x,y,15);
   }
 }
 else if(m>1)
 {
   put_pixel(xa,ya,15);
   d = dy - 2.0*dx;
   while(x<xb)
   {
     if(d>0)
     {
    //case n
    d-= dx;
    y++;
     }
     else
     {
    d+= dy-dx;
    x++;  y++;
     }
     put_pixel(x,y,15);
   }
 }
 else if(m<-1)
 {
   put_pixel(xa,ya,15);
   d = dy + 2.0*dx;
   while(x<xb)
   {
     if(d>0)
     {
    //case se
    d+=dy+dx;
    x++;y--;
     }
     else
     {
    d+= dx;
    y--;
     }
     put_pixel(x,y,15);
   }
 }
}

void main()
{
 clrscr();
 int x1,y1,x2,y2;
 cout<<"Enter x1,y1 : ";
 cin>>x1>>y1;
 cout<<"Enter x2,y2 : ";
 cin>>x2>>y2;

 int gd = DETECT, gm;
 initgraph(&gd,&gm,"c:\\tc\\bgi");

 mid_pt(x1,y1,x2,y2);
 getch();
 closegraph();
}