NVIDIA Interview Question for Software Engineer / Developers






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

int main()
{int n=1;
char *c=&n;
if(c)
printf("Little endian");
else
printf("Big endian ");
return 0;
}

- Captain Obvious March 15, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

#define BIG_ENDIAN 0
#define LITTLE_ENDIAN 1

int TestByteOrder(void)
{
short int word = 0x0001;
char *byte = (char *) &word;
return(byte[0] ? LITTLE_ENDIAN : BIG_ENDIAN);
}

- varun April 26, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

something like this:

bool findEndianness() {
  unsigned int x = 0xAABBCCDD;
  char *px = (char *) &x;
  char px0 = *px;
  char px3 = *(px + 3);
  if (px0 == (char) 0xDD && px3 == (char) 0xAA) {
    cout << "you're big endian!" << endl;
  } else if (px0 == (char) 0xAA && px3 == (char) 0xDD) {
    cout << "you're little endian!" << endl;
  } else {
    cout << "you're mixed" << endl;
  }
}

- M March 15, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

your definition of big-little endian seems incorrect

- adi June 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

{
short int word = 0x0001;
char *b = (char*) &word;
if(b[0])
  little endian
else
  big endian
}

- crackit March 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

does ppl literally mean jst code when there Question says wap..i mean u can always give a pseudo code n some explanation then code..coz code is not the important thing its the thought process...

- sriks March 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

+1 to sriks's comment. (I saw your comments elsewhere as well and I completely agree. I've made comments to this context also and gave up educating ppl about a year ago. Seems some guys just love copy-paste from other places.

- Nix April 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thought process is an East Coast originated rap/hip hop duet from Providence Rhode Island . Thought

process began as separate entities, Neumatic impact aka Mark Lorette and Mobius the shepherd. Lyrics

that show different perspectives on everyday topics from Religion to politics and everything in between.
The idea is centered around Peaceful coexistence (or, "Peaceful co-existence ).
Their are many ways of looking at current events. We know it's important to concider all direction and

Thought Processes. Hence the name, Thought Process

- Nate Dogg February 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thought process is an East Coast originated rap/hip hop duet from Providence Rhode Island . Thought

process began as separate entities, Neumatic impact aka Mark Lorette and Mobius the shepherd. Lyrics

that show different perspectives on everyday topics from Religion to politics and everything in between.
The idea is centered around Peaceful coexistence (or, "Peaceful co-existence ).
Their are many ways of looking at current events. We know it's important to concider all direction and

Thought Processes. Hence the name, Thought Process

- Nate Dogg February 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thought process is an East Coast originated rap/hip hop duet from Providence Rhode Island . Thought

process began as separate entities, Neumatic impact aka Mark Lorette and Mobius the shepherd. Lyrics

that show different perspectives on everyday topics from Religion to politics and everything in between.
The idea is centered around Peaceful coexistence (or, "Peaceful co-existence ).
Their are many ways of looking at current events. We know it's important to concider all direction and

Thought Processes. Hence the name, Thought Process

- Nate Dogg February 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Union
{
Int j;
Char c[4];
}x;

X.i = 1;
If(c[0] == 1)
Print little endian;
Else
Print big endian;

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

Instead of char c[4] it is better to make it generic as char c[szieof(int)];

union
{
int j;
char c[sizeof(int)];
}x;

x.j = 1;
If(x.c[0] == 1)
cout<<"little endian";
else
cout<<"big endian";

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

For this I think char c should be fine:

union
{
int j;
char c;
}x;

x.j = 1;
If(x.c == 1)
cout<<"little endian";
else
cout<<"big endian";

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

union TestEndian
{
int number;
char singlebyte;
}Test;

void tester()
{
Test t;
t.number=1;
if(t.singlebyte==1)
cout<<"Little Endian"<<endl;
else
cout<<"Big Endian"<<endl;

}

- Praveen Nagarajan March 17, 2015 | 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