Interview Question


Country: United States




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

since you are using %d specifier,you are trying to store 4 byte integer in 2 byte short integer.so output will be some garbage value.
to accept short int variable using scanf(),use %hd specifier.

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

is not writing a return statement at the end a reason for the error because the main function is defined as "int" ?

- Animesh Sinha July 03, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

no..it should not be a reason..even after writing return statement at the end output will be some garbage value.

- Abhishek July 03, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

input 10 10 10 10
output 10 20

so the value in variable c will be as same as variable b (dont know the reason yet)
and the value of variable f will be 20 (d+e)

- Rohan Tare July 04, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

b will override a by converting to INT.

- Bin December 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

THAT WAS ABSOLUTELY 20,20
ONCE EXECUTE THE CODE BY WRITING IN THE C COMPILER

- script7vineel December 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

beacause of two scan f function first will ocupppy the bufer so first w shld have to clear it by using fflush

- ankur sachan July 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

ans : 20, 20

- mahi July 07, 2012 | 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