473,394 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Some Interview questions

Why did u use stringbuilder instead of string for appending?

I told him it is more efficient. He did not seem very convinced. So
what should have been the exact answer.

How many objects will be formed in the operation a=b+c; ? (a,b and c
are objects)

What is the difference between a pointer and reference ?

a ptr can be null but a ref cannot be null... please elaborate .. i
cant understand thru some code examples to clear my concept...
Unemployed

Jul 12 '07 #1
6 1283
On Jul 12, 7:31 am, weird0 <amiredi...@gmail.comwrote:
Why did u use stringbuilder instead of string for appending?

I told him it is more efficient. He did not seem very convinced. So
what should have been the exact answer.
Could you say what your code actually was? Sometimes StringBuilder is
more efficient - sometimes it isn't.

See http://pobox.com/~skeet/csharp/stringbuilder.html for more
information.
How many objects will be formed in the operation a=b+c; ? (a,b and c
are objects)
It will depend on what the objects actually are.
What is the difference between a pointer and reference ?

a ptr can be null but a ref cannot be null... please elaborate .. i
cant understand thru some code examples to clear my concept...
A reference certainly can be null - in C#, at least. In C#, pointers
are only used in unsafe code.

Jon

Jul 12 '07 #2

Suppose if the objects a,b and c are (three cases):-
1.int
2.float
3.belong to user-defined class like Date

Jul 12 '07 #3
On Jul 12, 2:39 pm, weird0 <amiredi...@gmail.comwrote:
Suppose if the objects a,b and c are (three cases):-
1.int
2.float
3.belong to user-defined class like Date
If they're all ints, no objects will be created.
If they're all floats, no objects will be created.
Not sure what you mean by Date - if you mean DateTime, it's a struct
and you'd get a compile-time error because you can't add two DateTimes
together.

Jon

Jul 12 '07 #4
PS

"weird0" <am********@gmail.comwrote in message
news:11**********************@n60g2000hse.googlegr oups.com...
Why did u use stringbuilder instead of string for appending?

I told him it is more efficient. He did not seem very convinced. So
what should have been the exact answer.
If that is YOUR reason to use a StringBuilder then it is the correct answer
in some respects. I use a StringBuilder if it makes the code cleaner and
easier to understand what is happening. Performance (if improved) is an
added benefit but it is not my primary reason to use it.
>
How many objects will be formed in the operation a=b+c; ? (a,b and c
are objects)

What is the difference between a pointer and reference ?

a ptr can be null but a ref cannot be null... please elaborate .. i
cant understand thru some code examples to clear my concept...
These last 2 questions seem pointless to me. I really don't know what they
are trying to ascertain from asking questions like this. At least the first
one finds out something of your rationale about your coding style.

The first question I like to ask is "Have you read Design Patterns?"

PS
>
Unemployed

Jul 12 '07 #5

We always ask about design patterns too but it's amazing how many
people can explain exactly what they are and give textbook responses
of their impelmentation, but then 2 seconds later choose not to use
them in an example where they obviously apply.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Thu, 12 Jul 2007 10:15:08 -0400, "PS" <ec***********@hotmail.com>
wrote:
>
"weird0" <am********@gmail.comwrote in message
news:11**********************@n60g2000hse.googleg roups.com...
>Why did u use stringbuilder instead of string for appending?

I told him it is more efficient. He did not seem very convinced. So
what should have been the exact answer.

If that is YOUR reason to use a StringBuilder then it is the correct answer
in some respects. I use a StringBuilder if it makes the code cleaner and
easier to understand what is happening. Performance (if improved) is an
added benefit but it is not my primary reason to use it.
>>
How many objects will be formed in the operation a=b+c; ? (a,b and c
are objects)

What is the difference between a pointer and reference ?

a ptr can be null but a ref cannot be null... please elaborate .. i
cant understand thru some code examples to clear my concept...

These last 2 questions seem pointless to me. I really don't know what they
are trying to ascertain from asking questions like this. At least the first
one finds out something of your rationale about your coding style.

The first question I like to ask is "Have you read Design Patterns?"

PS
>>
Unemployed
Jul 13 '07 #6
Samuel R. Neff skrev:
We always ask about design patterns too but it's amazing how many
people can explain exactly what they are and give textbook responses
of their impelmentation, but then 2 seconds later choose not to use
them in an example where they obviously apply.
Or use them where they are obviously overengineered solutions to
problems that aren't there :)

--
Helge
Jul 16 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jobs | last post by:
What is application object ? Application object can used in situation where we want data to be shared across users globally. What's the difference between Cache object and application object...
0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: Jobs | last post by:
All answers to the below interview questions are at http://www.geocities.com/dotnetinterviews/ or you can download the complete answer zip file from...
0
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if...
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
0
by: freesoftwarepdfs | last post by:
Ultimate list of Interview question website.....Do not miss it http://www.questpond.com http://msdotnetsupport.blogspot.com/2007/01/net-interview-questions-by-dutt-part-2.html...
0
by: Free PDF | last post by:
..NET , SQL Server interview questions websites.... http://www.questpond.com http://www.geocities.com/dotnetinterviews/...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.