General Knowledge: What are basic facts every person should know?

General Knowledge: What are basic facts every person should know? by Anurag R Nair

Answer by Anurag R Nair:

SENSEX(SENSitivity indEX) is a measure of performance of our stock market. Sensex was started with an arbitrary number 100 on Jan 1 1979.

Ever wondered what this index represents ?

Sensex is computed from the performance of 30 of the biggest companies of India.And the rise and fall of these companies are directly proportional to the rise and fall of Sensex. If these 30 top companies cumulatively grow by X% then Sensex will also rise X%.So this index depicts the health of our economy.

And how this index value is calculated?

Free floating market capitalization method is used for this purpose.Suppose we have 2 companies,Co A and Co B-

Co A has 100 shares out of which 90 are available for general public (called free floating shares) and 10 are owned by company management. Each share is valued at Rs 100.

Co B has 1000 shares out of which 800 are available for public and 200 for company management.Each share is valued at Rs 10.

Co A has a total value=Total market capitalization =total no of shares*value of each share=100*100=Rs 10000

Co B has a total value =Total market capitalization=total no of shares*value of each share=1000*10=Rs 10000

Co A has a total free floating value=Total free floating capitalization=total no free floating shares*value of each share=90*100=Rs 9000

Co B has a total free floating value=Total free floating capitalization=total no free floating shares*value of each share=800*10=Rs 8000

So the total free floating capitalization adds up to=9000+8000=Rs 17000(of A and B)

Now suppose we say that the amount of 17000 is equal to 100 Sensex point for reference then we calculate the Sensex points with this point based on the gain/loss of the company.

So now if these 2 companies free floating capitalization becomes 170000 in 20 years, then Sensex will indicate 1000 .

Similarly for a list of 30 companies in BSE which include-ACC, Ambuja Cements, Bajaj Auto, BHEL, Bharti Airtel, Cipla, DLF, Grasim Industries, HDFC, HDFC Bank, Hindalco Industries, Hindustan Lever, ICICI Bank, Infosys, ITC, Larsen & Toubro, Mahindra & Mahindra, Maruti Udyog, NTPC, ONGC, Ranbaxy Laboratories, Reliance Communications, Reliance Energy, Reliance Industries, Satyam Computer Services, State Bank of India, Tata Consultancy Services, Tata Motors, Tata Steel, and Wipro.

We simply cumulate free floating capitalization of all these 30 companies with a base point of 100 Base Index for ease with financial year 1978–79 as reference.

General Knowledge: What are basic facts every person should know?

What are some of the most esoteric programming skills you’ve seen in a candidate?

What are some of the most esoteric programming skills you've seen in a candidate? by Vladislav Zorov

Answer by Vladislav Zorov:

I have a bit of experience programming in Quipper – a Haskell dialect for driving quantum computers. Also QScript, the language of Google’s Quantum Computing Playground (and have several published programs on my profile there).

By the most optimistic predictions, it will be around 20 years until it starts making sense to put that on my CV, LOL 😀

What are some of the most esoteric programming skills you've seen in a candidate?

Why can’t India and Pakistan make peace?

Why can't India and Pakistan make peace? by @DrAwdheshSingh

Answer by Awdhesh Singh:

A man was travelling through a muddy road when his car got suddenly trapped in the pool of mud. He tried very hard to move but his car failed to come out of it.

Suddenly, he saw a villager coming toward him in his bullock cart.

Once the bullock cart came near, he requested him to pull his car out of mud. A deal of Rs 100 was negotiated between them for the work and the villager pulled the car using his bullocks.

The man felt greatly relieved and paid him the money.

He then asked the villager, “There may be so many cars that would be getting trapped in this mud.”

Villager: “True sir. You are the seventh person since morning whose car got trapped in this mud.”

Man: “Oh my God! Did you have to pull all of them.”

Villager: “Yes Sir.”

Man: “You must be busy full day pulling the cars from the mud having no time to do your own work.”

Villager: “Very True Sir. I have to do all my work in night only.”

Man: “Oh I see! By the way, what work you do in night.”

Villager: “I just ensure that this mud is never dried.”

There are so many people on both sides of the India-Pakistan border who ensure that the mud is never dried.

Why can't India and Pakistan make peace?

What would happen if you put a mirror in a scanner?

What would happen if you put a mirror in a scanner? by Archie D'Cruz

Answer by Archie D'Cruz:

Let’s find out, shall we?

I took this fairly large round mirror and scanned it using my Canon flatbed. The result was…let’s say, not very mirror-like at all. In fact, the glass area was almost black.

So what happened? Where’s the shiny glass mirror we were hoping to see?

To understand why we got the result we did, we first need to look at how a scanner works.

There are many variations of this setup, but at its most basic, here’s what happens after you place a paper document on the glass bed and press Scan:

  1. A light source illuminates the document through the glass bed. The light source moves along a track as the document is being scanned.
  2. The document is reflected into an angled mirror, which also moves along a track at the same speed.
  3. The first mirror’s reflection is captured by a fixed mirror at the other end of the scanner.
  4. The image from the fixed mirror is captured by a CCD (charge-coupled device) and can then be saved to a computer hard-drive.

This is another way of looking at it, with a three-mirror setup.

Now here’s what happens when you replace the document with a mirror:

Everything works the same way as before, except that what the scanner’s movable mirror sees now is not a document, but a reflection of what is below. And what's below is the inside base of the scanner, which is black.

So what your scan will capture is essentially a dark reflection, and maybe some fingerprints or light scratches…but no shiny objects.

Note: Illustrations updated based on suggestions by Frank Heile. (Thanks, Frank!)

Added March 27: Comment worth noting made by Shriram Krishnamurthi, Professor of Computer Science at Brown University: My colleague John Hughes (of graphics book fame) agreed with this answer and added, "The only missing point is that there may be some optics that want to focus right about the scanning-surface plane, so that the reflected image of the inside of the scanner might well also be rather blurry, because it's way outside the depth-range at which the optics are focused."

What would happen if you put a mirror in a scanner?

What’s the best life lesson that you learnt in a book or in a movie?

What's the best life lesson that you learnt in a book or in a movie? by @NelaCanovic

Answer by Nela Canovic:

The book Mindset: The New Psychology of Success by Carol Dweck.

Why I thought it was important:

Such an interesting book, thoughtfully written, with a lot of research and diverse examples. In a nutshell, Dweck says that our understanding of success and failure, and our coping mechanisms to deal with challenges life throws at us, can define the way we see ourselves and dramatically impact the quality of our life. A lot of these concepts are picked up in the way we were raised and in the messages we received from our parents, our teachers, and the environment we grew up in.

There are 2 types of mindsets we identify with:

  • a fixed mindset: when we believe that our qualities are set in stone (either at birth or in early childhood), and that we can only have a certain level of intelligence, a certain type of personality, or a certain moral character. If we consider ourselves intelligent, we expect success at every step, and when we encounter an obstacle, we withdraw or give up entirely.
  • a growth mindset: when we believe that our genetic structure and our early years are merely the starting point in our development, and that we can improve on our qualities through continuous efforts. If we understand that there is always room for growth, we approach life as a continuum of learning and we treat obstacles as opportunities to better ourselves and improve our skills further.

Here are 3 steps to change your mindset for the better:

ONE. Change how you view success. Instead of thinking that success is being the best, think of success as doing your best, always learning new things and improving the way you do your work and manage your personal development. For example:

  • Take ownership of your day by planning it out so you have time to accomplish what you need to.
  • To get a head start, create a morning routine and wake up a bit earlier so that you can work out and tackle some analytical tasks that require your complete focus.
  • When you are working, remove all distractions and focus on what’s in front of you. Make a connection between what you’re doing right now and why you’re doing it, so that you always keep your goals top of mind.

TWO. Change how you view failure. Instead of seeing your failures as confirmation of your inability to do something, see a failure as a setback: it can be motivating, informative, even a wake-up call. It isn’t an excuse to give up entirely on something; it can even build character. For example:

  • When you fail an exam or get a lower grade than you expected, take stock of how you did: write down how much time you devoted to studying, which materials you used, even where you studied. Then think of how to improve and make changes so that you do better next time.
  • When you receive criticism of your work, don’t immediately get emotional. Closely examine what is the core of the message: did you overlook an important detail, was there a pattern of errors you’ve repeated from before, did you miss a deadline because you forgot? Then take some time to make the necessary changes, correct what needs to be done, and move on.
  • When you get frustrated at yourself for not making progress as quickly as you’d like, make an assessment of the path you are taking: is there someone more experienced you can ask who can advise you and give you shortcuts, are you using your resources wisely or maybe you’re not using the ones that are more practical, do you need to carve out more time in your day to devote to your practice? Then map out your next steps so that you can get to your goal faster.

THREE. Take charge of your success. When you succeed, don’t just sit back and expect it to last. Take concrete steps to maintain it, keep it in good shape, and make it last. For example:

  • If you’ve successfully completed your exams, don’t just waste away your summer watching TV or sitting in front of the computer surfing the Internet. Make a plan to improve on a skill that is important to your personal development (playing the guitar, getting fit for a marathon, learning more about the ancient worlds of Rome and Greece), then work on it daily.
  • If you turned in a big project and met the deadline, don’t just sit back and chat with coworkers for hours and watch YouTube videos when the boss is out of the office. Look for something else you can get strategic about: is there an upcoming big meeting you can plan for, a new tool your team just started using that you can familiarize yourself with, a professional milestone that you can prepare for and discuss with your manager? Then make some time in your schedule to work on it on a regular basis.
  • If you just mastered a skill that is important for school, work, or your personal interests, don’t just keep it to yourself. Find out who might also benefit from your expertise and knowledge, then teach it to others. When you share your success, your work will give you a greater sense of purpose, and you’ll feel more connected to what you’ve accomplished. In addition, you will be providing something of value to others and helping them on their path to success, making your own experience richer and more relevant.

What's the best life lesson that you learnt in a book or in a movie?

What are some computer tricks that a CS student must know?

What are some computer tricks that a CS student must know? by Kaushal Sengupta

Answer by Kaushal Sengupta:

1.Change windows password without knowing the existing password : We all know that to change password in windows we need to enter the existing password and then we can proceed to enter the new password.However there is a trick to change password without knowing the existing password. This trick comes handy when the system is logged in and we have forgotten the password or to pull a prank on your friend(do it at your own risk)

Step 1: Right click on computer and select manage

Step 2: click on Local users and Groups and click on users. On the right pane you will see list of users.

step 3: Right click on any user whose password you want to change and click on set password:

step 4: click on proceed(Don’t worry about the message)

step 5: Enter the new password

step 6: Click on ok and your password will change. You can even use the same method to change HOMEGROUP password.

(NOTE: This trick works on WIN 7, 8 , 8.1 ,10)

2.Block websites on your computer or someone else’s computer :

Press WIN+R

and type this %windir%\system32\drivers\etc

or navigate to C:\Windows\System32\drivers\etc

and now you will see the hosts file

Now open notepad from start menu by typing notepad and running it as an administrator.

Open the hosts file by navigating to C:\Windows\System32\drivers\etc.

Now if you want to block site say facebook and google then type these lines(Marked in red rectangle)

The next time you open google or facebook it will not open.(Note:This trick will work if your browser is not open.If your browser is open close the browser and restart it.)

Using this property you can do website redirecting . For example if someone wants to open facebook but you want them to be redirected to google. First we need to know the ip address of Google . To do that open cmd and type tracert in cmd and note down the ip address of Google as shown in the pic

Now Google ip address is . hence I will be typing this in notepad

Now the next time you try to open facebook you will be redirected to google.

To unblock websites open the hosts file in notepad and delete those lines

For linux users :

Open terminal and type these lines,

First create a backup of the hosts file given below :

sudo cp /etc/hosts /etc/hosts.bak

Suppose you want to block google website then type this

sudo sh -c 'echo "">>/etc/hosts'

or type this

sudo sh -c 'echo "">>/etc/hosts'

Just replace google with any other website to block that website

To unblock websites type this

sudo cat /etc/hosts.bak>/etc/hosts

3.Boost your broadband speed: While the broadband speed depends on several factors including the external factors like speed provided by the ISP , hardware used etc. We can certainly improve the internal factor through a technique known as TCP optimisation. Windows 7 and above has the ability to automatically change its own TCP Window auto-tuning behavior to a more conservative state regardless of any user settings. Now we can change the tcp parameters to increase throughput .

Open cmd in administrator mode and type this

netsh int tcp show global and press enter

Now we are going to change some TCP global parameters . Open notepad and type these commands


netsh int tcp show global

netsh int tcp set global chimney=enabled

netsh int tcp set heuristics disabled

netsh int tcp set global autotuninglevel=normal

netsh int tcp set global congestionprovider=ctcp

Now save the file as say Speedbooster.bat

Run the Speedbooster.bat in administrator mode

You will notice substantial increase of speed of about 30–35%.

Now to reset tcp global parameters to default values Type these in notepad


netsh int tcp show global

netsh int tcp set global chimney=default

netsh int tcp set heuristics enabled

netsh int tcp set global congestionprovider=none

and save it as say Reset.bat to reset the TCP global parameters to their respective default values. Run it as an administrator.

To know more on TCP tweaking click on the link Windows 8, 10, 2012 Server TCP/IP Tweaks

4.C program to print the map of India: This obfuscated piece of code prints the map of India.

#include <stdio.h>
 main(){ int a,b,c;int count = 1; for (b = c = 10; a = "- FIGURE?, UMKC,XYZHello Folks,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!"[b+++21]; )
for(; a-- >64 ; ) putchar ( ++c=='Z' ? c = c/ 9:33^b&1); return 0; }

Copy and save the file as say p1.c . On running it in console by typing

gcc p1.c

in powershell and in linux instead of ./a.exe replacing it with ./a.out we get the following output

Source: The International Obfuscated C Code Contest .To know the working of the code click on the link How does this code generate the map of India?

~Enjoy .

What are some computer tricks that a CS student must know?

How does Tomohiko Sakamoto’s Algorithm work?

How does Tomohiko Sakamoto's Algorithm work? by @razimantv

Answer by Raziman T.V.:

Let us start with the simple scenario in which leap years did not exist and every year had 365 days.

Knowing  what day January 1 falls on a certain year, it is easy to find which  day any other date falls. This is how you go about it : January has 31 =  7 × 4 + 3 days, so February 1 will fall on the day which follows three  days after January 1. Similarly, March 1 will fall on the day three days  after the day corresponding to January 1, April 1 will fall 6 days  after, and so on. Thus, the first days of each month are offset with  respect to January 1 by the array {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}.  This array is essentially what t[] is. Notice that it is slightly  different from the t[] given in the question, but that is due to leap  years and will be explained later. Once the day corresponding to the  first date of the month is known, finding the day for any other date is  just a matter of addition.

Since  365 = 7 × 52 + 1, the day corresponding to a given date will become  incremented by 1 every year. For example, July 14, 2014 is a Monday and  July 14, 2015 will be a Tuesday. Hence adding the difference between  year numbers allows us to switch from the day of a reference year to any  other year.

At this stage, the leap-year free dow function can be written as such:

int dow(int y, int m, int d){ 
  static int t[] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}; 
  return (y + t[m-1] + d + c) % 7;

Here  c is a constant which corresponds to setting the "origin" of the day  system : y, t[m] and d only tell us how many days to shift by; we need a  reference to start the shifting and which is provided by c.

Now  let us look at the real case when there are leap years. Every 4 years,  our calculation will gain one extra day. Except every 100 years when it  doesn't. Except every 400 years when it does (Seriously, what kind of  intelligent designer comes up with this stuff? Couldn't the duration of  the year have been an integer multiple of the synodic day?). How do we  put in these additional days? Well, just add y/4 – y/100 + y/400. Note  that all division is integer division. This adds exactly the required  number of leap days.

Except  there is a tiny problem. The leap day is not January 0, it is February  29. This means that the current year should not be counted for the leap  day calculation for the first two months.

How  do we do this? Well, there are probably many intuitive ways to go about  this. But this piece of code sacrifices intuition for brevity. Suppose  that if the month were January or February, we subtracted 1 from the  year. This means that during these months, the y/4 value would be that  of the previous year and would not be counted.

Smart,  right? Except for a tiny problem. We are subtracting 1 from the year  for January and February for non-leap years too. This means that there  would be a "blank" day between February 28 and March 1, that is, we have  made every non-leap year a leap year, and leap years double-leap years.  Hm, so what if we subtracted 1 from the t[] values of every month after  February? That would fill the gap, and the leap year problem is solved.  That is, we need to make the following changes:

  • t[] now becomes {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}
  • if m corresponds to Jan/Feb (that is, m<3) we decrement y by 1
  • the annual increment inside the modulus is now y + y/4 – y/100 + y/400 in place of y

That's it, we get the full solution

int dow(int y, int m, int d){ 
  static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; 
  y -= m < 3;
  return (y + y/4 - y/100 + y/400 + t[m-1] + d + c) % 7;

Coincidentially, c just happens to be 0 – this is an empirical fact and cannot be "derived" from anything we have done till now – and we get back the function in the question.

PS: If I were you, I would substitute this for something way simpler. Say, hardcode the day value of January 1, 2000 and propagate differences over years, months and days. If a 3 line code requires a 1 page explanation, it is not really "simple"

How does Tomohiko Sakamoto's Algorithm work?