Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computer Certification > MCAD > Re: 70-316 : Question, the answer I'm not sure...

Reply
Thread Tools

Re: 70-316 : Question, the answer I'm not sure...

 
 
Hermit Dave
Guest
Posts: n/a
 
      12-28-2003
Think if the parent is trapping the exception... you dont need to do
anything.. cause if the current method encounters an exception and it is not
handled... it will be passed to calling function if that handles the
exception.. you are sorted...

so i would go with
A.
this.Validate();

--
Regards,

HD

"Christian Ista" <mailing-> wrote in message
news:...
> Hello,
>
> In a test, I have this question :
>
> You must ensure that any exceptions encountered by Validate are bubbled up
> to the parent form. The parent will be responsible fo handling the
> exceptions. Accomplish this goal by the minimum amount of code
>
> A.
> this.Validate();
>
> B.
> try{
> this.Validate
> }
> catch(Exception ex){
> throw ex;
> }
>
> C.
> try{
> this.Validate
> }
> catch(Exception ex){
> throw ("My Exception"ex);
> }
>
> D.
> public class MyException:ApplicationException{
> public MyException():base(){
> }
>
> public MyException(string message):base(message){
> }
>
> public MyException(string message, Exception inner):base(message,

inner){
> }
>
> }
>
>
> The right answer is B right ?
>
> Thanks,
>
>
>



 
Reply With Quote
 
 
 
 
john sermini
Guest
Posts: n/a
 
      12-28-2003
I think that you are both correct. It would be correct to say that if you
don't trap the exception that the parent would catch it. But the questions
states that you want the error to be bubbled up, so I think that implies
that you want to catch the exception, and then re-throw it. So I think that
B is the correct answer for the way that the question is worded.


"Hermit Dave" <> wrote in message
news:eqx$Z$...
> Think if the parent is trapping the exception... you dont need to do
> anything.. cause if the current method encounters an exception and it is

not
> handled... it will be passed to calling function if that handles the
> exception.. you are sorted...
>
> so i would go with
> A.
> this.Validate();
>
> --
> Regards,
>
> HD
>
> "Christian Ista" <mailing-> wrote in message
> news:...
> > Hello,
> >
> > In a test, I have this question :
> >
> > You must ensure that any exceptions encountered by Validate are bubbled

up
> > to the parent form. The parent will be responsible fo handling the
> > exceptions. Accomplish this goal by the minimum amount of code
> >
> > A.
> > this.Validate();
> >
> > B.
> > try{
> > this.Validate
> > }
> > catch(Exception ex){
> > throw ex;
> > }
> >
> > C.
> > try{
> > this.Validate
> > }
> > catch(Exception ex){
> > throw ("My Exception"ex);
> > }
> >
> > D.
> > public class MyException:ApplicationException{
> > public MyException():base(){
> > }
> >
> > public MyException(string message):base(message){
> > }
> >
> > public MyException(string message, Exception inner):base(message,

> inner){
> > }
> >
> > }
> >
> >
> > The right answer is B right ?
> >
> > Thanks,
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
 
Hermit Dave
Guest
Posts: n/a
 
      12-28-2003
Interesting... never thought of it that way... lol.... got my exam in 2
days... will have to be more careful...

--
Regards,

HD

"john sermini" <> wrote in message
news--dne7DZZQah3KiRVn-...
> I think that you are both correct. It would be correct to say that if you
> don't trap the exception that the parent would catch it. But the questions
> states that you want the error to be bubbled up, so I think that implies
> that you want to catch the exception, and then re-throw it. So I think

that
> B is the correct answer for the way that the question is worded.
>
>
> "Hermit Dave" <> wrote in message
> news:eqx$Z$...
> > Think if the parent is trapping the exception... you dont need to do
> > anything.. cause if the current method encounters an exception and it is

> not
> > handled... it will be passed to calling function if that handles the
> > exception.. you are sorted...
> >
> > so i would go with
> > A.
> > this.Validate();
> >
> > --
> > Regards,
> >
> > HD
> >
> > "Christian Ista" <mailing-> wrote in message
> > news:...
> > > Hello,
> > >
> > > In a test, I have this question :
> > >
> > > You must ensure that any exceptions encountered by Validate are

bubbled
> up
> > > to the parent form. The parent will be responsible fo handling the
> > > exceptions. Accomplish this goal by the minimum amount of code
> > >
> > > A.
> > > this.Validate();
> > >
> > > B.
> > > try{
> > > this.Validate
> > > }
> > > catch(Exception ex){
> > > throw ex;
> > > }
> > >
> > > C.
> > > try{
> > > this.Validate
> > > }
> > > catch(Exception ex){
> > > throw ("My Exception"ex);
> > > }
> > >
> > > D.
> > > public class MyException:ApplicationException{
> > > public MyException():base(){
> > > }
> > >
> > > public MyException(string message):base(message){
> > > }
> > >
> > > public MyException(string message, Exception inner):base(message,

> > inner){
> > > }
> > >
> > > }
> > >
> > >
> > > The right answer is B right ?
> > >
> > > Thanks,
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      12-28-2003
I answered the same question before in a previous
post..Anyway let me type it again...

You do not have to do anything to bubble up an exception
to the calling code, which is the parent form in this
case. Think it this way, When you get an exception in your
code, and you do not handle it, CLR gives a message saying
that there is an exception and what do you want to do with
it, (i.e; Abort, Retry, Continue options). Here CLR is the
parent code which invoked the assembly (exe in many
cases) of your program, and your program caused an
exception and it is never handled anywhere int he
heirarchy of caling, so eventually the control comes to
CLR which handles by showing that message to us..

So the answer for the question is this.validate().. What
you are doing in the second case is, you are handling the
exception and then throwing it explicitly, even in this
case the exception is bubbled up to parent form, but you
are making it in two steps, which is unnecessary..

You can also test with a code similar to the following,

void parent_method()
{

try
{
childMethod();
}

catch(Exception e)
{
Console.WrtieLine("Child Exception caught);
}

}


void childMethod()
{
this.Validate();
}

You would get the "Child exception caught" if this.Validate
() generates an exception.. that means exception bubbled
up automatically to the calling code..

I hope i am clear enough..



>-----Original Message-----
>Interesting... never thought of it that way... lol....

got my exam in 2
>days... will have to be more careful...
>
>--
>Regards,
>
>HD
>
>"john sermini" <> wrote in message
>news--dne7DZZQah3KiRVn-...
>> I think that you are both correct. It would be correct

to say that if you
>> don't trap the exception that the parent would catch

it. But the questions
>> states that you want the error to be bubbled up, so I

think that implies
>> that you want to catch the exception, and then re-throw

it. So I think
>that
>> B is the correct answer for the way that the question

is worded.
>>
>>
>> "Hermit Dave"

<> wrote in message
>> news:eqx$Z$...
>> > Think if the parent is trapping the exception... you

dont need to do
>> > anything.. cause if the current method encounters an

exception and it is
>> not
>> > handled... it will be passed to calling function if

that handles the
>> > exception.. you are sorted...
>> >
>> > so i would go with
>> > A.
>> > this.Validate();
>> >
>> > --
>> > Regards,
>> >
>> > HD
>> >
>> > "Christian Ista" <mailing-> wrote

in message
>> > news:...
>> > > Hello,
>> > >
>> > > In a test, I have this question :
>> > >
>> > > You must ensure that any exceptions encountered by

Validate are
>bubbled
>> up
>> > > to the parent form. The parent will be responsible

fo handling the
>> > > exceptions. Accomplish this goal by the minimum

amount of code
>> > >
>> > > A.
>> > > this.Validate();
>> > >
>> > > B.
>> > > try{
>> > > this.Validate
>> > > }
>> > > catch(Exception ex){
>> > > throw ex;
>> > > }
>> > >
>> > > C.
>> > > try{
>> > > this.Validate
>> > > }
>> > > catch(Exception ex){
>> > > throw ("My Exception"ex);
>> > > }
>> > >
>> > > D.
>> > > public class MyException:ApplicationException{
>> > > public MyException():base(){
>> > > }
>> > >
>> > > public MyException(string message):base(message){
>> > > }
>> > >
>> > > public MyException(string message, Exception

inner):base(message,
>> > inner){
>> > > }
>> > >
>> > > }
>> > >
>> > >
>> > > The right answer is B right ?
>> > >
>> > > Thanks,
>> > >
>> > >
>> > >
>> >
>> >

>>
>>

>
>
>.
>

 
Reply With Quote
 
JM
Guest
Posts: n/a
 
      12-28-2003
Indeed and to add a point to anonomuus' post the question required the
answer with the least amount of code. Therefore B is ruled out as long as A
is correct...and it is.

--
Joe


<> wrote in message
news:00ea01c3cd88$083f0520$...
> I answered the same question before in a previous
> post..Anyway let me type it again...
>
> You do not have to do anything to bubble up an exception
> to the calling code, which is the parent form in this
> case. Think it this way, When you get an exception in your
> code, and you do not handle it, CLR gives a message saying
> that there is an exception and what do you want to do with
> it, (i.e; Abort, Retry, Continue options). Here CLR is the
> parent code which invoked the assembly (exe in many
> cases) of your program, and your program caused an
> exception and it is never handled anywhere int he
> heirarchy of caling, so eventually the control comes to
> CLR which handles by showing that message to us..
>
> So the answer for the question is this.validate().. What
> you are doing in the second case is, you are handling the
> exception and then throwing it explicitly, even in this
> case the exception is bubbled up to parent form, but you
> are making it in two steps, which is unnecessary..
>
> You can also test with a code similar to the following,
>
> void parent_method()
> {
>
> try
> {
> childMethod();
> }
>
> catch(Exception e)
> {
> Console.WrtieLine("Child Exception caught);
> }
>
> }
>
>
> void childMethod()
> {
> this.Validate();
> }
>
> You would get the "Child exception caught" if this.Validate
> () generates an exception.. that means exception bubbled
> up automatically to the calling code..
>
> I hope i am clear enough..
>
>
>
> >-----Original Message-----
> >Interesting... never thought of it that way... lol....

> got my exam in 2
> >days... will have to be more careful...
> >
> >--
> >Regards,
> >
> >HD
> >
> >"john sermini" <> wrote in message
> >news--dne7DZZQah3KiRVn-...
> >> I think that you are both correct. It would be correct

> to say that if you
> >> don't trap the exception that the parent would catch

> it. But the questions
> >> states that you want the error to be bubbled up, so I

> think that implies
> >> that you want to catch the exception, and then re-throw

> it. So I think
> >that
> >> B is the correct answer for the way that the question

> is worded.
> >>
> >>
> >> "Hermit Dave"

> <> wrote in message
> >> news:eqx$Z$...
> >> > Think if the parent is trapping the exception... you

> dont need to do
> >> > anything.. cause if the current method encounters an

> exception and it is
> >> not
> >> > handled... it will be passed to calling function if

> that handles the
> >> > exception.. you are sorted...
> >> >
> >> > so i would go with
> >> > A.
> >> > this.Validate();
> >> >
> >> > --
> >> > Regards,
> >> >
> >> > HD
> >> >
> >> > "Christian Ista" <mailing-> wrote

> in message
> >> > news:...
> >> > > Hello,
> >> > >
> >> > > In a test, I have this question :
> >> > >
> >> > > You must ensure that any exceptions encountered by

> Validate are
> >bubbled
> >> up
> >> > > to the parent form. The parent will be responsible

> fo handling the
> >> > > exceptions. Accomplish this goal by the minimum

> amount of code
> >> > >
> >> > > A.
> >> > > this.Validate();
> >> > >
> >> > > B.
> >> > > try{
> >> > > this.Validate
> >> > > }
> >> > > catch(Exception ex){
> >> > > throw ex;
> >> > > }
> >> > >
> >> > > C.
> >> > > try{
> >> > > this.Validate
> >> > > }
> >> > > catch(Exception ex){
> >> > > throw ("My Exception"ex);
> >> > > }
> >> > >
> >> > > D.
> >> > > public class MyException:ApplicationException{
> >> > > public MyException():base(){
> >> > > }
> >> > >
> >> > > public MyException(string message):base(message){
> >> > > }
> >> > >
> >> > > public MyException(string message, Exception

> inner):base(message,
> >> > inner){
> >> > > }
> >> > >
> >> > > }
> >> > >
> >> > >
> >> > > The right answer is B right ?
> >> > >
> >> > > Thanks,
> >> > >
> >> > >
> >> > >
> >> >
> >> >
> >>
> >>

> >
> >
> >.
> >



 
Reply With Quote
 
Hermit Dave
Guest
Posts: n/a
 
      12-28-2003
Thanks guys... cleared a confusion in my mind...

--
Regards,

HD

"JM" <> wrote in message
news:...
> Indeed and to add a point to anonomuus' post the question required the
> answer with the least amount of code. Therefore B is ruled out as long as

A
> is correct...and it is.
>
> --
> Joe
>
>
> <> wrote in message
> news:00ea01c3cd88$083f0520$...
> > I answered the same question before in a previous
> > post..Anyway let me type it again...
> >
> > You do not have to do anything to bubble up an exception
> > to the calling code, which is the parent form in this
> > case. Think it this way, When you get an exception in your
> > code, and you do not handle it, CLR gives a message saying
> > that there is an exception and what do you want to do with
> > it, (i.e; Abort, Retry, Continue options). Here CLR is the
> > parent code which invoked the assembly (exe in many
> > cases) of your program, and your program caused an
> > exception and it is never handled anywhere int he
> > heirarchy of caling, so eventually the control comes to
> > CLR which handles by showing that message to us..
> >
> > So the answer for the question is this.validate().. What
> > you are doing in the second case is, you are handling the
> > exception and then throwing it explicitly, even in this
> > case the exception is bubbled up to parent form, but you
> > are making it in two steps, which is unnecessary..
> >
> > You can also test with a code similar to the following,
> >
> > void parent_method()
> > {
> >
> > try
> > {
> > childMethod();
> > }
> >
> > catch(Exception e)
> > {
> > Console.WrtieLine("Child Exception caught);
> > }
> >
> > }
> >
> >
> > void childMethod()
> > {
> > this.Validate();
> > }
> >
> > You would get the "Child exception caught" if this.Validate
> > () generates an exception.. that means exception bubbled
> > up automatically to the calling code..
> >
> > I hope i am clear enough..
> >
> >
> >
> > >-----Original Message-----
> > >Interesting... never thought of it that way... lol....

> > got my exam in 2
> > >days... will have to be more careful...
> > >
> > >--
> > >Regards,
> > >
> > >HD
> > >
> > >"john sermini" <> wrote in message
> > >news--dne7DZZQah3KiRVn-...
> > >> I think that you are both correct. It would be correct

> > to say that if you
> > >> don't trap the exception that the parent would catch

> > it. But the questions
> > >> states that you want the error to be bubbled up, so I

> > think that implies
> > >> that you want to catch the exception, and then re-throw

> > it. So I think
> > >that
> > >> B is the correct answer for the way that the question

> > is worded.
> > >>
> > >>
> > >> "Hermit Dave"

> > <> wrote in message
> > >> news:eqx$Z$...
> > >> > Think if the parent is trapping the exception... you

> > dont need to do
> > >> > anything.. cause if the current method encounters an

> > exception and it is
> > >> not
> > >> > handled... it will be passed to calling function if

> > that handles the
> > >> > exception.. you are sorted...
> > >> >
> > >> > so i would go with
> > >> > A.
> > >> > this.Validate();
> > >> >
> > >> > --
> > >> > Regards,
> > >> >
> > >> > HD
> > >> >
> > >> > "Christian Ista" <mailing-> wrote

> > in message
> > >> > news:...
> > >> > > Hello,
> > >> > >
> > >> > > In a test, I have this question :
> > >> > >
> > >> > > You must ensure that any exceptions encountered by

> > Validate are
> > >bubbled
> > >> up
> > >> > > to the parent form. The parent will be responsible

> > fo handling the
> > >> > > exceptions. Accomplish this goal by the minimum

> > amount of code
> > >> > >
> > >> > > A.
> > >> > > this.Validate();
> > >> > >
> > >> > > B.
> > >> > > try{
> > >> > > this.Validate
> > >> > > }
> > >> > > catch(Exception ex){
> > >> > > throw ex;
> > >> > > }
> > >> > >
> > >> > > C.
> > >> > > try{
> > >> > > this.Validate
> > >> > > }
> > >> > > catch(Exception ex){
> > >> > > throw ("My Exception"ex);
> > >> > > }
> > >> > >
> > >> > > D.
> > >> > > public class MyException:ApplicationException{
> > >> > > public MyException():base(){
> > >> > > }
> > >> > >
> > >> > > public MyException(string message):base(message){
> > >> > > }
> > >> > >
> > >> > > public MyException(string message, Exception

> > inner):base(message,
> > >> > inner){
> > >> > > }
> > >> > >
> > >> > > }
> > >> > >
> > >> > >
> > >> > > The right answer is B right ?
> > >> > >
> > >> > > Thanks,
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >> >
> > >>
> > >>
> > >
> > >
> > >.
> > >

>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      12-28-2003
You are welcome.. glad to be help

kumar
>-----Original Message-----
>Thanks guys... cleared a confusion in my mind...
>
>--
>Regards,
>
>HD
>
>"JM" <> wrote in message
>news:...
>> Indeed and to add a point to anonomuus' post the

question required the
>> answer with the least amount of code. Therefore B is

ruled out as long as
>A
>> is correct...and it is.
>>
>> --
>> Joe
>>
>>
>> <> wrote in message
>> news:00ea01c3cd88$083f0520$...
>> > I answered the same question before in a previous
>> > post..Anyway let me type it again...
>> >
>> > You do not have to do anything to bubble up an

exception
>> > to the calling code, which is the parent form in this
>> > case. Think it this way, When you get an exception in

your
>> > code, and you do not handle it, CLR gives a message

saying
>> > that there is an exception and what do you want to do

with
>> > it, (i.e; Abort, Retry, Continue options). Here CLR

is the
>> > parent code which invoked the assembly (exe in many
>> > cases) of your program, and your program caused an
>> > exception and it is never handled anywhere int he
>> > heirarchy of caling, so eventually the control comes

to
>> > CLR which handles by showing that message to us..
>> >
>> > So the answer for the question is this.validate()..

What
>> > you are doing in the second case is, you are handling

the
>> > exception and then throwing it explicitly, even in

this
>> > case the exception is bubbled up to parent form, but

you
>> > are making it in two steps, which is unnecessary..
>> >
>> > You can also test with a code similar to the

following,
>> >
>> > void parent_method()
>> > {
>> >
>> > try
>> > {
>> > childMethod();
>> > }
>> >
>> > catch(Exception e)
>> > {
>> > Console.WrtieLine("Child Exception caught);
>> > }
>> >
>> > }
>> >
>> >
>> > void childMethod()
>> > {
>> > this.Validate();
>> > }
>> >
>> > You would get the "Child exception caught" if

this.Validate
>> > () generates an exception.. that means exception

bubbled
>> > up automatically to the calling code..
>> >
>> > I hope i am clear enough..
>> >
>> >
>> >
>> > >-----Original Message-----
>> > >Interesting... never thought of it that way...

lol....
>> > got my exam in 2
>> > >days... will have to be more careful...
>> > >
>> > >--
>> > >Regards,
>> > >
>> > >HD
>> > >
>> > >"john sermini" <> wrote in

message
>> > >news--dne7DZZQah3KiRVn-...
>> > >> I think that you are both correct. It would be

correct
>> > to say that if you
>> > >> don't trap the exception that the parent would

catch
>> > it. But the questions
>> > >> states that you want the error to be bubbled up,

so I
>> > think that implies
>> > >> that you want to catch the exception, and then re-

throw
>> > it. So I think
>> > >that
>> > >> B is the correct answer for the way that the

question
>> > is worded.
>> > >>
>> > >>
>> > >> "Hermit Dave"
>> > <> wrote in

message
>> > >> news:eqx$Z$...
>> > >> > Think if the parent is trapping the exception...

you
>> > dont need to do
>> > >> > anything.. cause if the current method

encounters an
>> > exception and it is
>> > >> not
>> > >> > handled... it will be passed to calling function

if
>> > that handles the
>> > >> > exception.. you are sorted...
>> > >> >
>> > >> > so i would go with
>> > >> > A.
>> > >> > this.Validate();
>> > >> >
>> > >> > --
>> > >> > Regards,
>> > >> >
>> > >> > HD
>> > >> >
>> > >> > "Christian Ista" <mailing->

wrote
>> > in message
>> > >> > news:...
>> > >> > > Hello,
>> > >> > >
>> > >> > > In a test, I have this question :
>> > >> > >
>> > >> > > You must ensure that any exceptions

encountered by
>> > Validate are
>> > >bubbled
>> > >> up
>> > >> > > to the parent form. The parent will be

responsible
>> > fo handling the
>> > >> > > exceptions. Accomplish this goal by the minimum
>> > amount of code
>> > >> > >
>> > >> > > A.
>> > >> > > this.Validate();
>> > >> > >
>> > >> > > B.
>> > >> > > try{
>> > >> > > this.Validate
>> > >> > > }
>> > >> > > catch(Exception ex){
>> > >> > > throw ex;
>> > >> > > }
>> > >> > >
>> > >> > > C.
>> > >> > > try{
>> > >> > > this.Validate
>> > >> > > }
>> > >> > > catch(Exception ex){
>> > >> > > throw ("My Exception"ex);
>> > >> > > }
>> > >> > >
>> > >> > > D.
>> > >> > > public class MyException:ApplicationException{
>> > >> > > public MyException():base(){
>> > >> > > }
>> > >> > >
>> > >> > > public MyException(string message):base

(message){
>> > >> > > }
>> > >> > >
>> > >> > > public MyException(string message, Exception
>> > inner):base(message,
>> > >> > inner){
>> > >> > > }
>> > >> > >
>> > >> > > }
>> > >> > >
>> > >> > >
>> > >> > > The right answer is B right ?
>> > >> > >
>> > >> > > Thanks,
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> >
>> > >> >
>> > >>
>> > >>
>> > >
>> > >
>> > >.
>> > >

>>
>>

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CIS Masters Program - Not a Cisco question so please skip if you do not want to answer - thanks KDawg44 Cisco 1 02-20-2007 03:04 AM
Wrong answer equals to a blank answer or not? Zadkin Microsoft Certification 8 06-27-2006 01:51 PM
Wrong answer equals to a blank answer or not? Zadkin Microsoft Certification 0 06-23-2006 09:17 PM
To style or not to style ? (was erroneously reported to comp.text before, no answer yet) Rolf Kemper XML 0 10-15-2004 04:53 AM
Possible to set up WinFaxPro 10 to answer faxes but not voice calls? Jimmy Dean Computer Support 1 10-13-2004 05:42 AM



Advertisments