Novell Interview Question for Software Engineer / Developers


Country: India




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

empty string i.e nothing will be printed as pointer b is also advanced to point to end of string i.e null

- Anonymous August 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i think this will print 3 'characters that correspond to 0' and then some garbage or not

- Anonymous August 25, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Should it instead print garbage value? Because the null is assigned to b, b gets incremented and then the while loop fails. So it now points to memory location "after" the null.

- axecapone August 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

no output since 'b' is advanced to reach to the null value.

- Psycho August 28, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

It is C, you can assign, the compiler just shows a warning... Don't compile C code with C++ compiler.

- Selmeczy, Péter September 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

axecapone is right on it, b is advanced after the terminating 0-character! So the output is garbage or even a segmentation fault (reading memory that does not belong to the program)

- Selmeczy, Péter September 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

It wont print garbage value, as b is memset with 0 initially.

- Mahesh September 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 3 vote

b=malloc(10*sizeof(char));


a value of type "void *" cannot be assigned to an entity of type "char *"

- jayram singh August 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What is the output??

- sushilk.1991 August 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

no output bcz b is pointing to '\0' i.e. NULL

- anurag August 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

aaa

- jayram singh August 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

a value of type "void *" cannot be assigned to an entity of type "char *"

- jayram singh August 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

An assignment expression has the value of the left operand after the assignment therefore

*b++=*a++

returns the value of *b++ which takes the value of *a++.
Thus the loop breaks when 'a' reach the null value.
however the code will print nothing since 'b' is advanced to reach the null value.

- selvio October 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

there will be compilation error in it.
while loop doesn't have a condition but an assignment in it..
also the loop is terminated there onli so if it compiles..acc. to me the printf will execute just once printing a garbage value

- saurabh August 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

infinite loop as while loop will never be false

- Anonymous August 26, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

a value of type "void *" cannot be assigned to an entity of type "char *"

- jayram singh August 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
-2
of 2 vote

infinite loop as while loop will never be false

- alien August 28, 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