## NVIDIA Interview Questions

- 3of 3 votes
A plumber working for a company as a contractor. His job is attend services and submit the bill to get his salary on basis of daily work including his service charge 500 rupees. For a typical plumbing work he need pipes with different lengths. But in market he will get new pipe with standard size 100m of cost 100 rupees. (no small or large sized pipes available) Now , he need 10 , 40 , 60, 70 lengths of pipes for a jobwork.

Generally company gives him (4 pipes * 100 rupees) + 500rupees as service charge = 900 rupees.

but plumber bought only 2 pipes cut as follows and get his job done...

1st pipe => 40+60

2nd pipe => 10+70 + extra left(20)

By buying only 2 pipes he get his job done. remaining 2 pipes money saved.

write an efficient algorithm to calculate minimum number of standard size pipes required for given number of different pipes lengths:

Input:

N => total pipes for jobwork

arr[N] => lengths of pipes. (for simplicity, pipe size will be either smaller or equal to standard size)

outpud:

minimum statdard sized(100m) pipes required

constraint: you can only cut them can not join them back as follows

say he need 10 95 95,

with two pipes 100 100 = > 95+5 95+5 => 95 95 (5+5)// this is not accepted

EX:

Input:

5

20 30 50 60 80

output:

3

Input:

5

10 10 10 15 20 35 55 60 70 75 75 80

output:

6

- 1of 3 votes
Write a function in C to create a new BST which is the mirror image of a given tree.

- 3of 5 votes
Consider the statement

result = a ? b : c;

Implement the above statement without using any conditional statements.

- 0of 0 votes
Write a multi threaded C code with one thread printing all even numbers and the other all odd numbers. The output should always be in sequence

ie. 0,1,2,3,4....etc

- 0of 0 votes
Write a piece of code to find out if the system is x86 architecure of Sparc

- 0of 0 votes
Write a function in C to create a new BST which is the mirror image of a given tree.

- 0of 0 votes
Write a piece of code to find out if the system is x86 architecture of Sparc

- 0of 0 votes
Write multi threaded code in C so that one thread prints all even numbers and other all odd numbers with the output always in sequence ie. 0,1,2,3...etc

- 0of 0 votes
Write a piece of code to find out if a system is x86 architecture or Sparc?

- 0of 0 votes
In Linux, we use virtual address.So each process will think it has 4 GB

memory space even if the real memory is only 2GB. Now suppose we do not have

MMU and programmer use real physical address in their program. We only have

small size of physical memory. How can we design the system?

- 0of 0 votes
We run two video game benchmarks on our new designed SOC. The two

benchmarks have the same instruction set. The benchmark with higher power

consumption always work well while the other one always get stuck. What can

be the problems?

- 0of 0 votes
In the new mobile phone, we can either choose to use a 1GHz solo core or

500MHz duo core processor. What tradeoffs should we consider?

- 0of 0 votes
This is a hardware design problem. I can not figure it out. Suppose we have 2 pipelined hardware multipliers(or something). One is working at 1GHz with 2 operations executed in parallel at the same time. The other one is at 500GHz with 4 operations. Suppose we have transistors of 3 types(low leaky(30%),middle leaky(50%) and high leaky(70%)) and here leaky means leakage power of the transistor. Which multiplier should we use considering the 3 types of transistors.

- 0of 0 votes
How will you implement run-time polymorphism in C? There are two structs. There is a common function receiving only one argument(only one). The function should accept both base struct and derived struct objects and do corresponding actions. i.e if base struct object is passed, do base struct's task and vice versa

- 2of 2 votes
The interviewer asked the following question.

`char *s = "Hello"; printf("%s",s); printf(s)`

The second print statement crashes sometimes. Why

- 2of 2 votes
Given an int, write code to return the number of bits that are 1 in O(m) time, where m is the number of bits that are 1.

- 0of 0 votes
Create the mirror image of a binary tree.

- 0of 0 votes
For a given US based phone number, write a function to return all possible alphanumberic words that can be formed with that number, based on the keypad of a standard phone.

For example, one possible value for 1-800-623-6537 could be 1-800-MCDNLDS

- 0of 0 votes
Given set of N threads generate sum of all numbers in an array of known size M

- 0of 2 votes
What is high dynamic range rendering and why is it important for realistic rendering?

- 1of 1 vote
Write a function to generate a second array of numbers containing running average of N elements from the original array

So for instance if the original array is,

2,6,4,2,3 and N=3

result = 2,4,3,4,3

you can assume the corner elements can be filled with original elements where there are not enough elements to take avg of N elements

- 4of 4 votes
You have written a memory manager and after using it your coworker complains that he is facing severe issues of fragmentation. What could be the reason(s) and how can you fix it

- 0of 0 votes
What is mip-maps and why are they used

- 0of 0 votes
Why we use 4X4 matrix for representing and calculations in transformation of 3D points when that can be done only with 3X3 matrix.

(the concept of homogenization of matrices and how they help including translation operation)

- 0of 0 votes
What the different shaders(vetex, geomtery, pixel) describe their roles and the order in which they are executed in graphics pipeline

- 2of 2 votes
given y bytes and you can transfer only x bytes at once..give a mathematical expression having only + - / * which gives the number of iterations to copy y bytes. ( dont try giving modulo operator answers )

- 1of 1 vote
Sequence of steps that happen in CPU, cache, TLB, VM, HDD leading to execution of “x = 7” which isn’t present in cache or sysmem nor translation in TLB. Also specify if any intrs, exceptions or faults are generated.

- 0of 0 votes
Assuming you have three N bit unsigned integers a, b and c, what is the min number of bits you would need to store the result of a * b + c?

- 0of 0 votes
Given a char array find possible soln like :

eg for "abc"

ans: {a,ab,abc.b,bc,c}

char[] function(char[])

- 0of 0 votes
Given an integer array find the longest subarray cantaining consequitive nos.

eg {4,5,34,33,32,11,10,31}

ans is {31,32,33,34}

int[] function(int[])