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

- Jack December 10, 2014 | Flag Reply
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.

- Khoa February 04, 2006 | Flag Reply
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.

- Jack February 04, 2006 | Flag Reply
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.

- Gayle L McDowell February 04, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ok. That makes a lot of sense.

- Jack February 04, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

yes

- adrawersdfd February 05, 2006 | Flag Reply
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'...

- Fantik April 23, 2006 | Flag Reply
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 :)

- Muhariz Jabeer May 23, 2006 | Flag Reply
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.

- SlickyWickyNicky November 24, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- gunner February 13, 2007 | Flag Reply
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

- Anonymous April 23, 2008 | Flag Reply
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

- Steazy December 01, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

'

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

and 1=

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' and 1=

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

\'

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

'''

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ookjk85h74

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1 OR 1=1

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1' OR '1'='1

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1'1

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' 1 AND 1=1

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1 AND 1=1

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1\'1

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

) or ('1'='1--

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' or 1=1/*

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' or 1=1--

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

order by 1000/*

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

order by 1000;--

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' order by 1000/*

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' order by 1000;--

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

' or 1=1--

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

" or 1=1--

- Anonymous July 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

') or ('a'='a

- Anonymous July 26, 2012 | Flag Reply
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

- Anonymous May 21, 2014 | Flag Reply
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

- Anonymous May 21, 2014 | Flag Reply
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 :

Quite contradictory to your name, you are a peace loving person.
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

- Anonymous May 21, 2014 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More