NVIDIA Interview Question for Software Engineer / Developers






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

volatile - By type qualifying a variable as volatile, we mean that the data in the variable is subjectable to change often. Usually, this qualifier is used in embedded programming. This tells the compiler that every time it has to look up the value of the variable as it can change any time. Example - a volatile pointer variable pointing to the system clock.

- Metallicatony September 04, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

pointer to the system clock.. ha-ha-ha
I'm curious how you get such a pointer and where you can use it ? You disassemble the timer interrupt handler to find the exact memory location of the counter and then write a device driver to access a privileged memory ? ;)

volatile is useful in multi-threaded programming to inform the compiler that a certain variable is pointed to, let's say, by several threads, and therefore can be subject to volatile changes. This is to prevent the compiler from optimizing out memory access to this variable.

- asm December 02, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Const - By type qualifying a variable as const we mean that the data in the variable is non modifiable. It should be initialized during its declaration. It cannot be reassigned with another value at a later time. By type qualifying this to a pointer, we mean that the pointer cannot be repointed to some other data, though the data can be changed. Meaning the address contained in the pointer variable cannot change at any time.

- Metallicatony September 04, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

static - This qualifier tells the compiler to retain the value of a variable for the lifetime of a program. But its scope exists only within the function where it is declared. The value of variable can change in the program (not like const). These variables retain their values even in between function calls.

- Metallicatony September 04, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Static is also used to limit the scope of a function to within the file. If there is a program containing multiple files, then a static function can be used only within that file. Functions with similar names may exist in different files in this fashion.

- Lokesh October 07, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Const - To avoid messing up with the data that has to be maintained as constant. Thereby we can secure the data from changes.
volatile - to point data that is subject to frequent changes eg. hardware clock.
static - to count the number of function calls. To count the number of objects instantiated from a class in a program.

- Metallicatony September 04, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

but what happen if static variable is called inside a member method of certain class..

- shoushou January 16, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In C++, a static member, is something that is global to all the objects of that class. It is like a shared variable between all objects of that class. A static member function, is a function that is class specific, but not object specific. The 'this' pointer does not exist within a static function. Thus it cannot refer to non static members of the class.

- Lokesh October 07, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i got a doubt..
Can i use a static function declaration in a .h file (say x.h) & use it through out the file (say i ve multiple .c files) where ever that .h file gets included ???

- sr.panigrahi October 13, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes, you can. Preceding the declaration with static defaults to internal linkage for the function which means function can only be accessed within the file in which it has been declared (i.e. those files where you are including your .h file). So, every file will have its own definition (allocated memory for) of your function and hence can be used in any number of files.

- ankit.batra11 April 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

when we include the file, assembler just replaces the #include line with actualy .h content of file.
try gcc -E file.c

- kim July 16, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Volatile variable: Certain variables maybe required by some outside processes, CPU makes an arrangement to make this happen. It basically doesn't optimize this variable when the memory of the process is optimized while rolling out and other such things.CPU keeps the volatile variable available for any process to use, and change! Same applies to threads.

Static : The static keyword can be used to declare variables, functions, class data members and class functions.By default, an object or variable that is defined outside all blocks has static duration and external linkage. Static duration means that the object or variable is allocated when the program starts and is deallocated when the program ends. External linkage means that the name of the variable is visible from outside the file in which the variable is declared. Conversely, internal linkage means that the name is not visible outside the file in which the variable is declared.

- technical_123 August 17, 2013 | 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