NVIDIA Interview Question for Interns


Country: United States
Interview Type: Phone Interview




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

You can find an answer to this question in stack overflow with this topic/heading- warning: format not a string literal and no format arguments

- San January 15, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

The related problem is about format strings. If the user can control de string used as first argument of printf() could dump memory regions or even execute arbitrary code.

- Felipe Cerqueira January 07, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

what is arbitary code

- vinod.dannuri June 20, 2014 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Actually, when we assigns
char * s= "Hello".
's' starts pointing in read only segement where the "Hello" is.And when you do printf(s), IMO printf alwyas sees first argument as format string which it can change. And as he tries to change or format that argument you will get an access vilolation as you are writing to read only segment.

- void January 08, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Another thread could have modified the string.

- Yola June 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Because we should use a string literal instead of string variable.

- akshaycj47 November 09, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Answer based on http://stackoverflow.com/questions/4419293/warning-format-not-a-string-literal-and-no-format-arguments

Here, you are taking a string generated at runtime and trying to print it. Say for s is "bad%sdata" then the runtime will try to access a non-existent argument to match the %s. This will cause program to crash.

- bharath.vegito May 01, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It won't ever crash. There's no semicolon after the second printf so it won' compile. If that was literally the question posed.

- Greg Stull May 09, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

& % are should not use

- Anonymous January 16, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Where did you get this question from? Be honest now.

- IDIOT CHECKER February 24, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

something something read-only memory.

- HowCodeDoI March 20, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

WRONG QUESTIONS

- SUBHA January 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

in codeblock it work fine

- Anonymous January 22, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

for both printf it print hello;

- Anonymous September 25, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.


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