Some c# interview questions

W

weird0

I heard of two c# interview questions that i still clearly don't know
and havent understood the concept. One reason is also that I havent
worked upon them

1. What is the difference between a reference and a pointer?
Allah.... I don't even know what a reference is...

2. What are function pointers?

3. What are JOINS?

Ok.... Operartor Overloading is easy... and i can make it through
elementary concepts of Operating
System....

Can anyone explain briefly what are these things and refer to some
clearly written and simple links
where I can learn them....... and get my interview done welll.......


One thing more.... there is something what we do to obtain
concurrency..... I studied that in O.S....
Semaphores...... to prevent collisions and deadlock ...... I guess...
Does anyone know what is that ? And refer me some good link to study
this?
 
E

Egghead

Hi here,

1 is parameter passing.
2 is the delegates, depend on .NET 1.0, 1.1,2.0,3.0, or 3.5. You give a
little different ans.
The conurrency is threading, I guess
hmm, you better learn some C++ concept for this developer job interview.
 
C

clintonG

My answer would be "The garbage collector and the compiler in the framework
does all that work for me so I can pay more attention to writing secure code
more efficiently so I can assist my colleagues to deploy our projects
faster, more reliably and at less expense. Am I hired?"
 
E

Egghead

YOU'RE FIRED!!!

--
cheers,
RL
clintonG said:
My answer would be "The garbage collector and the compiler in the
framework does all that work for me so I can pay more attention to writing
secure code more efficiently so I can assist my colleagues to deploy our
projects faster, more reliably and at less expense. Am I hired?"
 
M

Michael Weber

weird0 said:
I heard of two c# interview questions that i still clearly don't know
and havent understood the concept. One reason is also that I havent
worked upon them
[snip]

One thing more.... there is something what we do to obtain
concurrency..... I studied that in O.S....
Semaphores...... to prevent collisions and deadlock ...... I guess...
Does anyone know what is that ? And refer me some good link to study
this?

The Little Book of Semaphores -Second Edition,
availible as pdf ( code examples in the book is in Python/C, but somewhat
easily understandable ) here :
http://greenteapress.com/semaphores/

Threading in C# including Semaphores :
http://www.albahari.com/threading/index.html
http://www.albahari.com/threading/part2.html#_Semaphore

Common problems in concurrent programming :
http://en.wikipedia.org/wiki/Dining_philosophers_problem
http://en.wikipedia.org/wiki/Sleeping_barber_problem
http://en.wikipedia.org/wiki/Rendezvous_problem
http://en.wikipedia.org/wiki/Producers-consumers_problem
amongst others.

Best regards
Michael Weber
 
K

Kevin Spencer

1. What is the difference between a reference and a pointer?
Allah.... I don't even know what a reference is...

A reference is similar to a pointer, but not the same. A pointer is a
variable that contains the physical memory address of some data. It is a
number, and you can perform mathematical operations on the variable to make
it point to different memory locations. for example, if you have a pointer
to a byte, and add 1 to it, it points to the next physical byte in machine
memory. A reference, on the other hand, is a managed, object-oriented,
type-safe kind of "pointer" which "points" to the location of a class
instance, but can not be changed. It will always point to the class it is
assigned to.
2. What are function pointers?

A function pointer is a pointer that contains the memory address of a
function definition. By invoking the pointer, you invoke the function.
3. What are JOINS?

This is not a C# question (unless you're talking about LINQ, which I doubt
in this case), but a SQL question. A JOIN is a query that fetches results
from a combination of 2 or more database tables into a single tabular set of
results. In LINQ it is much the same, but applied more broadly to any
aggregate type, not confined to database tables.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
W

weird0

Thanks a lot for the reply...
Kevin

Why do I need a function pointer anyway?
Like you said, by invoking the pointer you invoke the function. Why
not just call the function directly?
 
J

Jon Skeet [C# MVP]

weird0 said:
Thanks a lot for the reply...
Kevin

Why do I need a function pointer anyway?
Like you said, by invoking the pointer you invoke the function. Why
not just call the function directly?

If the bit doing the calling knows which function to call, there's no
advantage - but the point of a function pointer is that you can pass
that function pointer to something else (e.g. adding an event handler).
 
R

Ravichandran J.V.

Semaphores can simply be understood as a boolean flag that indicates
whether an OS resource like a thread is available or not. It is a
synchronization mechanism that is commonly used in what is called race
conditions. A race condition is when a data is shared by two threads
simultaneously, modifying which, indiscriminately, can cause wrong data
to be used bye each thread.


It is a low level functionality that probably only serves theoretical
value today as modern runtimes provide for their own multithreading
libraries and synchronization mechanisms like monitors and locks.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
J

Jon Skeet [C# MVP]

Ravichandran J.V. said:
Semaphores can simply be understood as a boolean flag that indicates
whether an OS resource like a thread is available or not. It is a
synchronization mechanism that is commonly used in what is called race
conditions. A race condition is when a data is shared by two threads
simultaneously, modifying which, indiscriminately, can cause wrong data
to be used bye each thread.

That's more like a mutex or monitor. A semaphore is designed to be more
intelligent than that - it's not that there's one resource, either
available or unavailable; it allows for you to have many instances of
the same resource, and they can be used unless there are none left, at
which point you need to wait for some to be released.

See http://en.wikipedia.org/wiki/Semaphore_(programming) for more
information.

What you've described (a simple boolean flag) is a special case called
a *binary semaphore*.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top