NVIDIA
3.5 of 5 635 reviews
www.nvidia.com Santa Clara, CA 5000+ Employees

NVIDIA Senior Hardware Verification Engineer Interview Question

I interviewed in Santa Clara, CA and was asked:
"Describe a function to check if an integer is a power of 2."
Add Tags [?]
Answer Flag Question

Part of a Senior Hardware Verification Engineer Interview Review - one of 462 NVIDIA Interview Reviews

Answers & Comments

7
of 8
votes
For an integer n:

If n is less than 1, return false.
If the bitwise & of n and n-1 is 0, return true.
Otherwise, return false.
- Interview Candidate on Jan 29, 2010 Flag Response
2
of 2
votes
Write the number in binary and count the number of ones in that.If the number os ones is only 1 then it the number is indeed a power of 2
- Jo on Jul 26, 2011 Flag Response
0
of 0
votes
first check if no is 1 then return false else write the number in binary and then check number of ones in that.if only one 1 is there then its a power of 2
- Anonymous on Jul 26, 2011 Flag Response

To comment on this question, Sign In with Facebook or Sign Up


NVIDIA – Why Work for Us?

As a world leader in visual computing technology NVIDIA's objective remains solid: to be the most important 3D company in the world. We invest in our people and our technologies, support and fund industry research… Full Overview

Provided by employer [?]

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at NVIDIA interview questions and advice. All interview reviews posted anonymously by NVIDIA employees and interview candidates.