preparing for an exam and have a question

T

Tony Johansson

Hi!

I'm prepering for an 70-536 exam and in this book is the question below.
I asked this question before but didn't include all the alternatives and the
book motivation so this is the complete question
with the books motivation.

You need to create a simple class or structure that contains only value
types. You must create the class or structure so that it runs as efficiently
as
possible. You must be able to pass the class or structure to a procedure
without concern
that the procedure will modify it. Which of the following should you choose
?

A. A reference class
B. A reference structure
C. A value class
D. A value structure

The right answer is alternative D.
The book write the following comment about all the four alternatives.
A..Incorrect. You could create a reference class; however, it could be
modified when passed to a procedure.
B. Incorrect. You cannot create a reference structure
C. Incorrect. You could create a value class; however structure tend to be
more efficient.
D. Correct. Value structure are typical the most efficient

I have some question here.
The first question is: The book says the following about alternative B as
you can see above. "You cannot create a reference structure" but a reference
structure is as I assume when you add the keyword ref ???
I'm I right or wrong

My second question is: A value class is what ?????. I have never heard that
it can exist a value class but the book says
the following " You could create a value class; however structure tend to be
more efficient"
Can somebody give a comment if these exist a value class ?


When I try to figure what the correct answer might be I get into some
trouble.
The word efficiently exist in the question so if I take that into account
that would speak for selecting a reference before a value type because
passing a reference is more efficient than passing a value So according to
the word efficiently alternative A world be a good candidate.

The next thing is that I don't understand the english sentence You must be
able to pass the class or structure to a procedure without concern that the
procedure will modify it ?
If I did understand this fully I would probably have a better change to
select the correct answer.
That is this sentence that bother me because I don't know it means ?
Does it mean that the original passed argument is not allowed to be changed
or does it mean that it doesn't matter
if the original passed argument has been changed.

I hope that somebody can explain why the book is choosing alternative D
because questions like this will come
on the exam and I want to be fully prepared!

//Tony
 
K

Konrad Neitzel

Hi Tony,


Tony Johansson said:
I'm prepering for an 70-536 exam and in this book is the question below.
I asked this question before but didn't include all the alternatives and
the book motivation so this is the complete question
with the books motivation.

Good luck with that. I would recommend you to read the self-paced training
kit from MSPress. That book is quite good and explains a lot.
You must be able to pass the class or structure to a procedure without
concern
that the procedure will modify it. Which of the following should you
choose ?

The question means: You want to pass it to a procedure and it must be the
same afterwards. (So it doesn't matter what the procedure is doing.

So the answer must be something where you pass it as value instead passing a
reference (which is more or less a pointer!).
A. A reference class
That would mean, that you have the instance somewhere in memory and you only
pass a pointer to it. That is very fast but if something inside the instance
is changed, then the change is permanent,
B. A reference structure
Hmm ... I think that simply means "a Reference to a structure". A Structure
is a value type. Can be found in MSDN easily in
C# Reference / C# Keywords / Types / Value Types
C. A value class
This does not really make sense to me, because a class is (per definition) a
reference type.
D. A value structure
That is the correct answer, because with a structure, you have the data
somewhere. When you call the procedure, the value is copied to the procedure
so when the values are changed inside the procedure, it is simply changed
inside the copy so the original location remains unchanged.
The right answer is alternative D.
The first question is: The book says the following about alternative B as
you can see above. "You cannot create a reference structure" but a
reference structure is as I assume when you add the keyword ref ???
I'm I right or wrong

The ref keyword causes arguments to be passed by reference. The description
can be fully found in MSDN.
My second question is: A value class is what ?????. I have never heard
that it can exist a value class but the book says
the following " You could create a value class; however structure tend to
be more efficient"
Can somebody give a comment if these exist a value class ?
Is there anything else given in the book? It does not really make sense to
me. Some classes define a "copy" or "clone" method to create a copy of
themself but at least I don't know anything about a "value class".

Hopefully I was able to help you a little.

Konrad
 
P

Peter Duniho

Tony said:
[...]
I hope that somebody can explain why the book is choosing alternative D
because questions like this will come
on the exam and I want to be fully prepared!

You have received good advice in your previous discussion thread
regarding this type of question, including how to deal with a
poorly-written test.

That said, either this book is not an English-language book and
something is being lost in translation, or this book is a really
poorly-written book.

If the latter, I recommend you get a better reference to help you
prepare for the exame. If the former, you need a better translator, or
you need to ask these questions to someone who is fluent in the language
of the book.

Also, I will point out that as far as exams go, if you are not yet
experienced enough in the topic of the exam to figure out these kinds of
questions on your own, you probably are not ready to take the exam.
There's nothing we can tell you about any individual question intended
to discriminate knowledge about reference and value types that would
actually affect your actual qualifications enough to significantly
change your performance on the exam.

You can try, and of course there is some educational value in taking an
exam even if you know you won't succeed. But it seems to me that your
questions would be more productive if you were focusing more on the
underlying concepts, than on the specific wording of the question and
answers.

Pete
 
K

Konrad Neitzel

Hi,

regarding the exam, I just want to explain, what I did to get ready for this
exam 070-536. Maybe it helps Tony a little.

The most important documentation is the MSDN Library. If you didn't install
that localy on your system: Go and download it / install it. It is also
available online, but to check Classes and Methods, the offline version is
much better in my eyes (simply faster and the index makes finding the right
spots very very easy!) This is so important in my eyes, that I simply put it
on top!

To prepare myself for the exam, I did the following steps:

- MS Press has a series of "Self paced training kits". I read the 070-536
2nd Edition one. That gives a good overview of the important chapters. In my
eyes it is very important, that you also play around with the learned stuff.
That way, you lean most out of it and you directly get some experience with
the learned stuff.

- Because it is the first exam on my MCPD way, I got the practice test of
measureup.com (selftestsoftware.com is the other vendor I know). My "best
practice" with the tests there is:
a) When I do a question, I am not just giving the right answer. I always
think of reasons, why the other given solutions are wrong.
b) If I was unable to find the right solution / reasons, I am not only
reading the explanation (the given explanation is quite short and does not
explain much. Follow the Links! Look up stuff in MSDN!
c) In areas where I had problems: Write small samples. Doing some practice
will help you to understand, how everything works. And then you simply know,
what all these classes and tools are for. (Simply extend the examples of the
book or think of any new small tests!)

So in your example, I would simply try to write some code that is doing:
- defining a struct which has one element (just an integer test or so!)
- defining a class which has one element (also an integer test).
- defining TestMethods, that either take a struct or a class, play around
with "ref". Find out, where you can put it ... All the function will do is a
simple param.test = 1.
- A small main function, that creates 2 instances, setting test=0 in both.
Then a call to TestMethod and displaying the element after the call.
==> You will see, when the element is changed (Parameter was a value type)
and when not (Parameter was a reference).

That is just the way, I go. My main target is: I simply want to be a better
developer. So I have to learn a lot about the stuff, I am working with. The
certification is only a small "goodie" that I will (hopefully!) get. A MCPD
would be nice and of course I am heading towards that, but my main interest
is my knowledge and not some kind of paper I can stick at the wall. (Ok,
certificates are no longer send in paper form, i know :) But I hope I could
express my opinion.)

And when I am writing that much about my way: I have one big question:
Is Remoting part of the 070-536 Exam? The Self-Paced Training Kit does not
tell me one single word about remoting but I got a few questions in the
measureup tests. So should I spend some more time in that topic or can I
simply forget it? I wouldn't waste my time, because thanks WCF there is no
longer a need for that in my eyes (at least we use WCF in our enterprise
solutions for areas, where I think that remoting could be used, too. I am
not that sure about that topic, because I never read much about remoting so
far!).

I think that is all, that I can give you as hints. Hopefully it was of any
help for anybody out there.
English is not my native language but I hope that it is good enough for all
to understand me.
Hopefully I will get a voucher from my employer in the next days so that I
can do the exam this or next week :).

BTW: Thank you to all the people writing all the helpfull stuff in here
(Esp. Peter and Arne. You two are simply great!). I think I learned
something from you in the past, too. Hopefully I can give something back to
the community in the future, too.

With kind regards,

Konrad
 

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