## NVIDIA Interview Question for Software Engineer / Developers

Comment hidden because of low score. Click to expand.
2
of 2 vote

here is nice post on this question
campuscoke.blogspot.in/2014/12/explain-n-n-1-0.html

Comment hidden because of low score. Click to expand.
1
of 1 vote

No! This code reveals whether the integer is a Power of 2.

Comment hidden because of low score. Click to expand.
0
of 0 vote

Suppose you have the following...

1st case(positive integer):
8=01000 <= n
7=00111 <= n-1

So 8 & 7 = 0000 = 0

2nd case(0):
0=0000
-1=1111

So 0& (-1)=0000=0

3rd case(neg):
-2^31= 100...0

Boundary check #2:
-1: 111...111
-2: 111...110

2^31-1=0111...111
2^31-2=0111...110

This code reveals if n is -2^31 or ^2^31-1. In english, is it the smallest/greatest integer.

Comment hidden because of low score. Click to expand.
0
of 0 vote

What Khoa said makes sense. If you think of it this way, when you substract 1 from n, it'll read right to left, changing every zero to a 1 and stopping once it hits a 1.

If n&(n-1) equals zero, then it must've inverted n's left most '1', which means that everything before that must been a 0. That means that n is in the form 1000.., making it a power of two.

Comment hidden because of low score. Click to expand.
0
of 0 vote

Ok. That makes a lot of sense.

Comment hidden because of low score. Click to expand.
0
of 0 vote

yes

Comment hidden because of low score. Click to expand.
0
of 0 vote

In other words, it says whether the number in binary representation has more than one binary digit '1'...

Comment hidden because of low score. Click to expand.
0
of 0 vote

This is the answer to one of most annoying programming questions asked from C/C++ programmers. Give a 1 line way with no loops to determine whether an integer is a power of 2 :)

Comment hidden because of low score. Click to expand.
0
of 0 vote

There's one number that this test fails for finding out if n is a power of two. It fails when n = 0.

Comment hidden because of low score. Click to expand.
0
of 0 vote

but 0 is not a power or 2... so no worries

Comment hidden because of low score. Click to expand.
0
of 0 vote

@slickwickynicky, ur name says that u r a gr8 asshole....so plz dont comment when u dont know anything...ok..kick ur asssss

Comment hidden because of low score. Click to expand.
0
of 0 vote

gunner: 0 is not a power of two so the fact that this statement returns true for n=0 means it fails in that case

(0 & n) == 0 for all n

Comment hidden because of low score. Click to expand.
0
of 0 vote

'

Comment hidden because of low score. Click to expand.
0
of 0 vote

and 1=

Comment hidden because of low score. Click to expand.
0
of 0 vote

' and 1=

Comment hidden because of low score. Click to expand.
0
of 0 vote

\'

Comment hidden because of low score. Click to expand.
0
of 0 vote

'''

Comment hidden because of low score. Click to expand.
0
of 0 vote

ookjk85h74

Comment hidden because of low score. Click to expand.
0
of 0 vote

1 OR 1=1

Comment hidden because of low score. Click to expand.
0
of 0 vote

1' OR '1'='1

Comment hidden because of low score. Click to expand.
0
of 0 vote

1'1

Comment hidden because of low score. Click to expand.
0
of 0 vote

' 1 AND 1=1

Comment hidden because of low score. Click to expand.
0
of 0 vote

1 AND 1=1

Comment hidden because of low score. Click to expand.
0
of 0 vote

1\'1

Comment hidden because of low score. Click to expand.
0
of 0 vote

) or ('1'='1--

Comment hidden because of low score. Click to expand.
0
of 0 vote

' or 1=1/*

Comment hidden because of low score. Click to expand.
0
of 0 vote

' or 1=1--

Comment hidden because of low score. Click to expand.
0
of 0 vote

order by 1000/*

Comment hidden because of low score. Click to expand.
0
of 0 vote

order by 1000;--

Comment hidden because of low score. Click to expand.
0
of 0 vote

' order by 1000/*

Comment hidden because of low score. Click to expand.
0
of 0 vote

' order by 1000;--

Comment hidden because of low score. Click to expand.
0
of 0 vote

' or 1=1--

Comment hidden because of low score. Click to expand.
0
of 0 vote

" or 1=1--

Comment hidden because of low score. Click to expand.
0
of 0 vote

') or ('a'='a

Comment hidden because of low score. Click to expand.
0
of 0 vote

It simply resets the lowest bit that is set. Say n was 0111, it resets lowest bit and resultant will be 0110. This expression is typically used to count number of bits set in a value

Comment hidden because of low score. Click to expand.
0
of 0 vote

It simply resets the lowest bit that is set. Say n was 0111, it resets lowest bit and resultant will be 0110. This expression is typically used to count number of bits set in a value

Comment hidden because of low score. Click to expand.
0
of 0 vote

Look Up Your Birthday And See What You Are..!!
*********
January 01 - 09 ~ Dog
January 10 - 24 ~ Mouse
January 25 - 31 ~ Lion
*
February 01 - 05 ~ Cat
February 06 - 14 ~ Dove
February 15 - 21 ~ Turtle
February 22 - 28 ~ Panther
*
March 01 - 12 ~ Monkey
March 13 - 15 ~ Lion
March 16 - 23 ~ Mouse
March 24 - 31 ~ Cat
*
April 01 - 03 ~ Dog
April 04 - 14 ~ Panther
April 15 - 26 ~ Mouse
April 27 - 30 ~ Turtle
*
May 01 - 13 ~ Monkey
May 14 - 21 ~ Dove
May 22 - 31 ~ Lion
*
June 01 - 03 ~ Mouse
June 04 - 14 ~ Turtle
June 15 - 20 ~ Dog
June 21 - 24 ~ Monkey
June 25 - 30 ~ Cat
*
July 01 - 09 ~ Mouse
July 10 - 15 ~ Dog
July 16 - 26 ~ Dove
July 27 - 31 ~ Cat
*
August 01 - 15 ~ Lion
August 16 - 25 ~ Mouse
August 26 - 31 ~ Turtle
*
September 01 - 14 ~ Dove
September 15 - 27 ~ Cat
September 28 - 30 ~ Dog
*
October 01 - 15 ~ Monkey
October 16 - 27 ~ Turtle
October 28 - 31 ~ Panther
*
November 01 - 16 ~ Lion
November 17 - 30 ~ Cat
*
December 01 - 16 ~ Dog
December 17 - 25 ~ Monkey
December 26 - 31 ~ Dove.
*****

If you are a DOG :

A very loyal and sweet person.
Your loyalty can never be doubted. You are quite honest and sincere when it comes to your attitude towards working. You are a very simple person, indeed.
Absolutely hassle free, humble and down-to-earth. That explains the reason why your friends cling on to you.
You have a good taste for clothes.
If your wardrobe is not updated with what is trendy, you sure are depressed. Popular and easy-going.
You have a little group of dignified friends, all of them being quality-personified...! Repost This If It's True For You.!! 4 years of bad luck if you do not share this post.
*****

If you are a MOUSE:

Always up to some sort of a mischief. The mischievous gleam in your eyes is what makes you so cute and attractive to everyone.
You are an extremely fun-to-be-with kind of person.
No wonder people seek for your company and look forward to include you for all get-together's. However, you are sensitive which is a drawback. People need to select their words while talking to you.
If someone tries to fiddle around and play with words while dealing with you, it is enough to invite your wrath. God bless the person then..! Repost This If It's True For You.!! 3 years of bad luck if you do not share this post.
*****

If you are a LION :

You best try to avoid a situation wherein you are required to fight. An outdoor person, you dislike sitting at one place for a long duration. Popular and easy-going. you're extremly hot and passionate lover. you're loyal and honest and expect reciprocation from your lover.
You are a born leader, and have it in you how to tactfully derive work from people. People love the way you always treat them.
You love being loved, and when you receive your share of limelight from someone, you are all theirs.Repost This If It's True For You.!! 5 years of bad luck if you do not share this post.
******

If you are a CAT :

An extremely lovable, passionate, adorable person, sometimes shy, with a passion for quick wit.
At times, you prefer quietness. You love exploring various things and going into depth of each thing. you love being honest and loyal and expect reciprocation from your lover. you're full of energy in whole life.
Under normal circumstances you're cool but when given a reason to, you are like a volcano waiting to erupt. You're a fashion bird.
People look forward to you as an icon associated with fashion. Basically, you mingle along freely but don't like talking much to strangers.
People feel very easy in your company.
You observe care in choosing your friends.
Repost This If It's True For You.!! 2 years of bad luck if you do not share this post.
*****

If you are a TURTLE :

You are near to perfect and nice at heart.
The examples of your kindness are always circulated in groups of people. You too love peace. You wouldn't like to retaliate even to a person who is in the wrong. You are loved due to this.
You do not wish to talk behind one's back.
People love the way you always treat them.
You

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.