Solved

20 questions A,B,C and D

Posted on 2009-04-14
16
2,000 Views
Last Modified: 2012-05-06
Hi,

I have some questions I need to have double checked. I have already done them but I need to see so it is the same answer I have before returning them.


MULTIPLE CHOICE
You can skip questions about interface and abstract classes!
1. When an "is a" relationship exists between objects, it means that the specialized object has
a.
some of the characteristics of the general class, but not all, plus additional characteristics.
b.
some of the characteristics of the general object, but not all.
c.
none of the characteristics of the general object.
d.
all the characteristics of the general object, plus additional characteristics.
ANS: _____


2. Which of the following statements declares Salaried as a derived class of PayType?
a.
public class Salaried : PayType
b.
public class Salaried :: PayType
c.
public class Salaried derivedFrom(Paytype)
d.
public class PayType : Salaried
ANS: _____


3. If ClassA is derived from ClassB, then
a.
public and private members of ClassB are public and private, respectively, in ClassA
b.
public members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA
c.
neither public or private members in ClassB can be directly accessed in ClassA
d.
private members in ClassB are changed to protected members in ClassA
ANS: _____



4. In UML diagrams, inheritance is shown
a.
With a line that has an open arrowhead at one end that points to the base class
b.
With a line that has an open arrowhead at one end that points to the derived class
c.
With a line that has a closed arrowhead at one end that points to the base class
d.
With a line that has a closed arrowhead at one end that points to the derived class
ANS: _____



5. If a derived class constructor does not explicitly call a base class constructor,
a.
it must include the code necessary to initialize the base class fields.
b.
the base class fields will be set to the default values for their data types.
c.
C# will automatically call the base class's default constructor immediately after the code in the derived class's constructor executes.
d.
C# will automatically call the base class's default constructor just before the code
in the derived class's constructor executes.
ANS: _____



6. A protected member of a class may be directly accessed by
a.
methods of the same class
b.
methods of a derived class
c.
methods in the same namespace
d.
All of the above.
ANS: _____



7. When declaring class data members, it is best to declare them as
a.
private members
b.
public members
c.
protected members
d.
restricted members
ANS: _____



8. If a class contains an abstract method,
a.
you cannot create an instance of the class
b.
the method will have only a header, but not a body, and end with a semicolon
c.
the method must be overridden in derived classes
d.
All of the above
ANS: _____


9. All fields declared in an interface
a.
are const and static
b.
have protected access
c.
must be initialized in the class implementing the interface
d.
have private access
ANS: _____



10. When one object is a specialized version of another object, there is this type of relationship between them.
a.
"has a"
b.
"is a"
c.
direct
d.
"contains a"
ANS: _____



11. A derived class can directly access
a.
all members of the base class
b.
only public and private members of the base class
c.
only protected and private members of the base class
d.
only public and protected members of the base class
ANS: _____



12. In the following statement, which is the base class?
public class ClassA : ClassB , ClassC
a.
ClassA
b.
ClassB
c.
ClassC
d.
Cannot tell
ANS: _____



13. In UML diagrams, inheritance is shown
a.
with a line that has an open arrowhead at one end that points to the base class.
b.
with a line that has an open arrowhead at one end that points to the derived class.
c.
with a line that has a closed arrowhead at one end that points to the base class.
d.
with a line that has a closed arrowhead at one end that points to the derived class.
ANS: _____



14. If a base class does not have a default constructor or a no-arg constructor,
a.
then a class that inherits from it, must initialize the base class values.
b.
then a class that inherits from it, must call one of the constructors that the base class does have.
c.
then a class that inherits from it, does not inherit the data member fields from the base class.
d.
then a class that inherits from it, must contain the default constructor for the base class.
ANS: _____



15. Protected members are
a.
not quite private
b.
not quite public
c.
Both A and B
d.
Neither A or B
ANS: _____



16. Protected class members are denoted in a UML diagram with the symbol
a.
*
b.
#
c.
+
d.
-
ANS: _____



17. In a class hierachy
a.
the more general classes are toward the bottom of the tree and the more specialized
are toward the top.
b.
the more general classes are toward the top of the tree and the more specialized are toward the bottom.
c.
the more general classes are toward the left of the tree and the more specialized are toward the right.
d.
the more general classes are toward the right of the tree and the more specialized are toward the left.
ANS: _____



18. If a class contains an abstract method,
a.
you must create an instance of the class
b.
the method will have only a header, but not a body, and end with a semicolon
c.
the method cannot be overridden in derived classes
d.
All of the above.
ANS: _____


19. In an interface all methods have
a.
private access
b.
protected access
c.
public access
d.
namespace access
ANS: _____



20. Which of the following statements correctly specifies three interfaces:
a.
public class ClassA : Interface1, Interface2, Interface3
b.
public class ClassA : [Interface1, Interface2, Interface3]
c.
public class ClassA : (Interface1, Interface2, Interface3)
d.
public class ClassA : Interface1 Interface2 Interface3
ANS: _____


TRUE/FALSE
1. It is not possible for a base class to call a derived class method.
ANS: _____

2. If a method in a derived class has the same signature as a method in the base class, the derived class method overloads the base class method.
ANS: _____

3. Every class is either directly or indirectly derived from the Object class.
ANS: _____

4. An abstract class is not instantiated, but serves as a base class for other classes.
ANS: _____

5. In an inheritance relationship, the derived class constructor always executes before the base class constructor.
ANS: _____

6. If two methods in the same class have the same name but different signatures, the second overrides the first.
ANS: _____

7. All methods in an abstract class must also be declared abstract.
ANS: _____

8. When an interface variable references an object, you can use the interface variable to call all the methods in the class implementing the interface.
ANS: _____
0
Comment
Question by:Mickeys
  • 7
  • 5
  • 3
16 Comments
 
LVL 39

Expert Comment

by:abel
Comment Utility
Sorry, this looks like an assignment for homework, and EE guidelines do not permit us doing your homework for you.
0
 

Author Comment

by:Mickeys
Comment Utility
???? It is a paper I have got and I am trying to figure out if I have answered them correctly. If I publish what I have answed it is then possible to get if it is correct or if something is wrong? Otherwise I dont understand how to get help with this kind of questions.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
yes, if you show your answers (and eventually some explanation about why you selected that particular answer), we can comment on them.
this will show that you put some effort on your homework/exam/paper/whatever, and basically, if you did the effort, most answers shall be correct (unless you fall into the traps of such multiple-choice questionaires)
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
@Mickeys: I see that you've been around here for a while (since 99), so I'm sure you know the way EE works. 20 questions is a lot, even if we just do it because we like it. And a sentence like "You can skip questions about interface and abstract classes!" on top doesn't help taking away the feeling of it being an assignment or online test. Btw, this style of multiple choice is typical for online tests, because it is very theoretical and there's very little room for ambiguity.

Tell us what questions you have trouble with or doubt your correct answer. If it is from an online test or paper, show the link to the test so we can look it up for easier reference.
0
 

Author Comment

by:Mickeys
Comment Utility
Godmorning,

Ah great. So I can get help. :-) Here is all the questions with my answers on it. Is something wrong?

abel: It is not an online test. This is a paper that we could use to study questions for coming tests....the stupied thing is that we dont get the correct answers with the paper. I dont want to learn the questions if they a wrong. :-)

1. When an "is a" relationship exists between objects, it means that the specialized object has
a.
some of the characteristics of the general class, but not all, plus additional characteristics.
b.
some of the characteristics of the general object, but not all.
c.
none of the characteristics of the general object.
d.
all the characteristics of the general object, plus additional characteristics.
ANS: ___B__


2. Which of the following statements declares Salaried as a derived class of PayType?
a.
public class Salaried : PayType
b.
public class Salaried :: PayType
c.
public class Salaried derivedFrom(Paytype)
d.
public class PayType : Salaried
ANS: __A___


3. If ClassA is derived from ClassB, then
a.
public and private members of ClassB are public and private, respectively, in ClassA
b.
public members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA
c.
neither public or private members in ClassB can be directly accessed in ClassA
d.
private members in ClassB are changed to protected members in ClassA
ANS: _B____



4. In UML diagrams, inheritance is shown
a.
With a line that has an open arrowhead at one end that points to the base class
b.
With a line that has an open arrowhead at one end that points to the derived class
c.
With a line that has a closed arrowhead at one end that points to the base class
d.
With a line that has a closed arrowhead at one end that points to the derived class
ANS: __C___



5. If a derived class constructor does not explicitly call a base class constructor,
a.
it must include the code necessary to initialize the base class fields.
b.
the base class fields will be set to the default values for their data types.
c.
C# will automatically call the base class's default constructor immediately after the code in the derived class's constructor executes.
d.
C# will automatically call the base class's default constructor just before the code
in the derived class's constructor executes.
ANS: _D____



6. A protected member of a class may be directly accessed by
a.
methods of the same class
b.
methods of a derived class
c.
methods in the same namespace
d.
All of the above.
ANS: ___D__



7. When declaring class data members, it is best to declare them as
a.
private members
b.
public members
c.
protected members
d.
restricted members
ANS: ___A__



8. If a class contains an abstract method,
a.
you cannot create an instance of the class
b.
the method will have only a header, but not a body, and end with a semicolon
c.
the method must be overridden in derived classes
d.
All of the above
ANS: __D___


9. All fields declared in an interface
a.
are const and static
b.
have protected access
c.
must be initialized in the class implementing the interface
d.
have private access
ANS: __C___



10. When one object is a specialized version of another object, there is this type of relationship between them.
a.
"has a"
b.
"is a"
c.
direct
d.
"contains a"
ANS: __A___



11. A derived class can directly access
a.
all members of the base class
b.
only public and private members of the base class
c.
only protected and private members of the base class
d.
only public and protected members of the base class
ANS: __D___



12. In the following statement, which is the base class?
public class ClassA : ClassB , ClassC
a.
ClassA
b.
ClassB
c.
ClassC
d.
Cannot tell
ANS: __B___



13. In UML diagrams, inheritance is shown
a.
with a line that has an open arrowhead at one end that points to the base class.
b.
with a line that has an open arrowhead at one end that points to the derived class.
c.
with a line that has a closed arrowhead at one end that points to the base class.
d.
with a line that has a closed arrowhead at one end that points to the derived class.
ANS: ___C__



14. If a base class does not have a default constructor or a no-arg constructor,
a.
then a class that inherits from it, must initialize the base class values.
b.
then a class that inherits from it, must call one of the constructors that the base class does have.
c.
then a class that inherits from it, does not inherit the data member fields from the base class.
d.
then a class that inherits from it, must contain the default constructor for the base class.
ANS: __C___



15. Protected members are
a.
not quite private
b.
not quite public
c.
Both A and B
d.
Neither A or B
ANS: __C___



16. Protected class members are denoted in a UML diagram with the symbol
a.
*
b.
#
c.
+
d.
-
ANS: __D___



17. In a class hierachy
a.
the more general classes are toward the bottom of the tree and the more specialized
are toward the top.
b.
the more general classes are toward the top of the tree and the more specialized are toward the bottom.
c.
the more general classes are toward the left of the tree and the more specialized are toward the right.
d.
the more general classes are toward the right of the tree and the more specialized are toward the left.
ANS: __C___



18. If a class contains an abstract method,
a.
you must create an instance of the class
b.
the method will have only a header, but not a body, and end with a semicolon
c.
the method cannot be overridden in derived classes
d.
All of the above.
ANS: __A___


19. In an interface all methods have
a.
private access
b.
protected access
c.
public access
d.
namespace access
ANS: ___C__



20. Which of the following statements correctly specifies three interfaces:
a.
public class ClassA : Interface1, Interface2, Interface3
b.
public class ClassA : [Interface1, Interface2, Interface3]
c.
public class ClassA : (Interface1, Interface2, Interface3)
d.
public class ClassA : Interface1 Interface2 Interface3
ANS: __A___


TRUE/FALSE
1. It is not possible for a base class to call a derived class method.
ANS: __T___

2. If a method in a derived class has the same signature as a method in the base class, the derived class method overloads the base class method.
ANS: __F___

3. Every class is either directly or indirectly derived from the Object class.
ANS: ___T__

4. An abstract class is not instantiated, but serves as a base class for other classes.
ANS: __T___

5. In an inheritance relationship, the derived class constructor always executes before the base class constructor.
ANS: ___F__

6. If two methods in the same class have the same name but different signatures, the second overrides the first.
ANS: __T___

7. All methods in an abstract class must also be declared abstract.
ANS: ___T__

8. When an interface variable references an object, you can use the interface variable to call all the methods in the class implementing the interface.
ANS: __F___
0
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
Comment Utility
To the best of my knowledge and by the absence of knowing what language used (assumed C#, you posted there) and the absence of pictures (closed vs open arrow can be interpreted differently...) here you go:

you had:

1B should be 1D
2A
3B
4C should be 4A (depends on what asker means by "open", picture of uml inheritance)
5D... impossible to answer, answers (c,d) do not match question and (a,b) are wrong, however, D is closest to correct imo...
6D, not correct, but there's no correct answer. Both A and B are good.
7A depends on your school of thought... the term for "data members" should be "fields"
8D no correct answer exists, both A and C are correct, however, a class cannot only have an abstract member, it must also be declared an abstract class, hence the question is wrong (again)
9C this is total rubbish! Interfaces cannot contain fields (try it, you get a CS0525 in C#)
10A i think should be B, but "specialized version of" is not an OO term and hence this this is a guessing game (inheritance? aggregation?)....
11D
12B, should be D, because the statement is illegal with classes
13C should be 13A (same as q. 4)
14C should be B
15C q. is total rubbish, there's no reasonable answer
16D should be B (the minus symbol is for private accessor)
17C should be B (ridiculous question without a context (UML?), and even then, depends, your answer can also be good)
18A is wrong, but there are no correct answers
19C
20A

that was more work then I thought, because there were very few correct questions/answers (that has all to do with the questionnaire, nothing with the answers you tried to give, you couldn't know), some talk even total nonsense... Now on with the true/false, see if those questions are better:

1T should be F. This depends on what the question means by "calling a method". There are many ways to call a derived classes method, though not through the inheritance tree...

2F should be T, but this process is called shadowing or hiding in C#. Not "overriding". The question is not correct here and will give a compiler warning. Use the override or new modifiers.

3T

4T

5F

6T should be F (this is called overloading)

7T should be F (abstract classes can contain concrete methods)

8F question is total rubbish, there's no such thing as an interface variable.


Conclusion:
Very strange questionnaire, could've been made by somebody who only read an introductory chapter on C# and UML. Most questions are unanswerable and some are even total rubbish. Sorry to be so harsh, but it's the first time I see a questionnaire so bad as this, most of the times there's still some sense in them somehow or at least the questions are somehow correct.... but not here.

I suggest you try to contact the creator of these questions and have him contact me for attending a course or something :)

-- Abel --
0
 

Author Closing Comment

by:Mickeys
Comment Utility
Thank you so much for helping me out. I will sit down and read throw everytning and learn from a real teacher (you) :-)
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 39

Expert Comment

by:abel
Comment Utility
>  I will sit down and read throw everytning and learn from a real teacher (you) :-)

:)
Glad I could've been of some help.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
>1B should be 1D
indeed


>5D... impossible to answer, answers (c,d) do not match question and (a,b) are wrong, however, D is closest to correct imo...
actually, 5D is correct AFAIK

>6D, not correct, but there's no correct answer. Both A and B are good.
actually, option C is good also, so 6D is correct for me

>7A depends on your school of thought... the term for "data members" should be "fields"
I do agree on 7A, as by default, data members should not be visible to "outside world" unless you need to have a different behavior

>8D no correct answer exists, ...
actually, 8D is correct!

>9C this is total rubbish! Interfaces cannot contain fields (try it, you get a CS0525 in C#)
well, you have to remember that you are answering a microsoft-style questionaire.
I am not sure if it will raise a compile error or not, but from the docs, I would deduct that the fields have private access (and hence are completely useless, actually) http://msdn.microsoft.com/en-us/library/87d83y5b(VS.80).aspx
my choice would hence by 9D.

>10A i think should be B, but "specialized version of" is not an OO term and hence this this is a guessing game (inheritance? aggregation?)....
10B indeed.

>12B, should be D, because the statement is illegal with classes
12B is correct. the name ClassB does not make it a class (remember, it's ms trapping :)
same link: http://msdn.microsoft.com/en-us/library/87d83y5b(VS.80).aspx
>>When a base type list contains a base class and interfaces, the base class must come first in the list.


>15C q. is total rubbish, there's no reasonable answer
15C is correct, IMHO.
private = nobody else can see/use the method/property
public = everybody else can see/use the method/property
protected = some specific code can see/use the method
not rocket science question, I do agree !


>18A is wrong, but there are no correct answers
18B is correct. only a abstract class can have abstract methods, hence the description of B is correct.
anyhow, A and C are definitively wrong, so B would have been my choice by exclusion

>1T should be F. This depends on what the question means by "calling a method". There are many ways to call a derived classes method, though not through the inheritance tree...
I disagree here. the base class (A) cannot call a method of a class (B) that inherits (A), as (A) has to be compiled "before" (B) in order to have the "interface" ready. trying to do this would be a cyclic reference problem.

>2F should be T,
agreed

>6T should be F (this is called overloading)
agreed

>7T should be F (abstract classes can contain concrete methods)
Agreed.
http://msdn.microsoft.com/en-us/library/aa664435(VS.71).aspx
>Abstract method declarations are only permitted in abstract classes
does not exclude that abstract classes have non-abstract methods

>8F question is total rubbish, there's no such thing as an interface variable.
8F would be my choice.
I presume what is meant is a variable that is declared with the data type of the interface.
which does not allow you to directly call the derived class methods (at least not without casting)
aka:
IInterface var = new ClassImplementingIInterface();
var.MethodofClassImplementingIInterface();  // does not work -> answer to question
(ClassImplementingIInterface var).MethodofClassImplementingIInterface(); // would work


0
 

Author Comment

by:Mickeys
Comment Utility
Thanks for your feedback. I will compare it to abel:s answers.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Hi Angel, though you make some very good critical observations, I can't resist entering the discussion at some points here (the ones where we disagreed, of course)   ;-)

@5 you say: actually, 5D is correct AFAIK

I said: "does not match the question". Because a default constructor is a private constructor in C#, unless you make it explicitly public or protected. So, it depends on the code and the question needs tweaking. The following example will not compile:

    public class TestBase
    {
        public TestBase(string bla) { }
    }
    public class TestChild : TestBase
    {
        public TestChild(int someInt) { }   // error CS1729
    }

@6 you say: actually, option C is good also, so 6D is correct for me

and I said that only a and b are good. C says "protected member is accessible to any class in the namespace". There is no access modifier that restricts to a namespace:

   public: no restriction
   protected: restricted to containing class and derived classes
   internal: restricted to classes in assembly (note that this is different from "namespace")
   protected internal: restricted to any class in assembly and any derived classes
   private: only containing class

See also: http://msdn.microsoft.com/en-us/library/ba0a1yw2.aspx

@7 you say: I do agree on 7A, as by default, data members should not be visible to "outside world" unless you need to have a different behavior

and I said it depends on your school of thought. I take that back. It depends onmany things: whether you use constant fields or constant statics, which can and should be public (see Uri, String and Int class). Non-constant fields can also be internal or even protected, depending on your design (see Int (m_value) and TimeSpan (ticks)). Where internal will often have the preference (it is impossible to access by people having your assembly, even if they derive from your class).

@8: you say: actually, 8D is correct!

and I said: no correct answer exists, but A & C are correct. That was wrong. C is only partially correct: you can have derived classes that do not overload the abstract methods.

And B is partially correct also: "a class cannot contain an abstract method, unless the class itself is called abstract", which is not what is said in the question: "if a class contains an abstract method ...": it will not compile. Q.E.D.  ;-)

@9 you refer to http://msdn.microsoft.com/en-us/library/87d83y5b(VS.80).aspx, which says:
An interface can be a member of a namespace or a class and can contain signatures of the following members:    Methods, Properties, Indexers, Events.
if you try to add a field, the interface will not compile. Hence, the only correct answer to "All fields declared in an interface" is: it cannot be done. Not even static fields (which works in Java), as this will not compile:

    interface SomeInterface
    {
        public static const string bla = "";   // CS0525 "Interfaces cannot contain fields"
    }

@12 you say: 12B is correct. the name ClassB does not make it a class (remember, it's ms trapping :)

I agree, but if you "trap" like that... You are serious about that MS questionnaires contain silly things like that? It's an insult to your intelligence, that's what it is!

@15 you think C (not quite public/private).

I said: this is rubbish. There's no definition for "not quite". Does it mean more private or less private? If this definition is correct, then "internal" is also "not quite public/private". Deduction then gives us "internal == protected"???? Anyway, I stick to mine "it's rubbish" lol

@18 you say: 18B is correct. only a abstract class can have abstract methods, hence the description of B is correct.

I think you mean here: "hence the description of B is incorrect", because there's no mention of an abstract class in the question, hence "a class cannot have an abstract method", only "an abstract class can have zero or more abstract methods/properties etc".

If you have to answer the question, I agree that B i most likely meant as correct answer...

//// TRUE / FALSE questions \\\\

@1 amongst more, you say "trying to do this would be a cyclic reference problem."
in my answer, I say "it depends on what you mean by calling a method". Consider this example, it will compile and run and there's no cyclic reference problem; the base class can call a method of a derived class:

    public class TestBase
    {
        public TestBase() { }
        public void DoSomethingWithChild(TestChild someChild) {
            someChild.someProp = "test";
        }
    }
    public class TestChild : TestBase
    {
        public string someProp { get; set; }
        public void DoSomething()
        {
            DoSomethingWithChild(this);
        }
    }

@8 you have a different reading of the question. I said there's no such thing as in interface variable, and you say that it is a variable declared with the type of an interface, which of course is possible.

Making matters worse: in the Java world, an interface variable is a constant that is declared on an interface (as I noted earlier, in Java you can have constants and statics on an interface). In C# that is not possible, which is why I said there's no such thing.

I like your reading of that last question, though I still consider it a poor question that requires out-of-band thinking beyond the question definition, which is something that half of all the questions here required.... :S



-- Abel --
0
 

Author Comment

by:Mickeys
Comment Utility
*hehe* Great comments. I do learn alot by all this. :-) One thing I am sure of is that it is a really bad quiz. :-) to learn C#.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
indeed it is :)
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
@5: actually, the scope of a constructor does not matter, as it called implicitly!

@6: the issue is the understanding of the question and it's answers.
the "protected" does not "limit" to the namespace, actually. however, all classes that are in the namespace have access. there might be other classes in other namepaces, but that case is not excluded by answer C... so, 6C is good also (at least, it's not wrong)

@8: as for @6: as long as a "answer" is not wrong, it has to be considered correct. you might name it "partially correct"...

@9: I am not sure if it compiles or not, maybe that behavior has changed between versions.


@12 you say: 12B is correct. the name ClassB does not make it a class (remember, it's ms trapping :)
>I agree, but if you "trap" like that... You are serious about that MS questionnaires contain silly things >like that? It's an insult to your intelligence, that's what it is!
call it trap if you wish, the issue is that the questionnaires are built that way. also, to exclude people that do just learn brain-dumps trying to pass the exams without understanding the material.
only by having understood the concepts that you can pass those questions


@18 I will rephrase to "hence the description of B can be applied


T/F@1: interesting example... I wonder how that could be compiled, from the point of view of a compiler
I presume the compiler would first build up the interface of TestBase (pass), then TestChild (pass), and the compiles each method code, which will also pass.
I really doubt any real-life implementation scenario for this...

T/F@8: resp all the comments:
as I have taken plenty of MS (and other software exams, check my profile to see which status I got, not all individual exams though), and I managed to pass them all on the first "try" except 2, where I was send before I finished my preparations, I think I am kind of an expert of understanding how the exams "work".
it does not mean that I am 200% sure of all the answers I give here, but at least, I can answer plenty of the question by cross-checking some knowledge from all my different preparations, along with a good basic understanding of general programming concepts.
I don't (and won't) agree on all being correct. but at least, I am aware of both the concept and the issues around them.

regards,
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Angel, I value your knowledge and your long-standing status as #1, and I like it that you know a way to interpret these questions. It explains to me why I stepped away once I had my couple of dozens of certificates, because I was done with it (though I must say that some of the brainbench.com tests are really good, maybe they are an exception).

But apart from knowing what the possible answer should be, I think it is also good to step aside and look at the questions. Some of them just talk nonsense (in the light of C#, I mean) and maybe that's on purpose, but still... Anyway, discussing them is good and reveals some of the misunderstandings that are around coding in C#.

Mainly the first one above (@5): I wouldn't have said what I said if I hadn't tested and verified it. Even though it is called implicitly, the compiler will complain (with an error, not a warning) and you cannot compile.

Another thing on @6: I agree to your reading of the question (though I do not agree to the question, it is still plain wrong imo), but don't mix things up: "all classes in the namespace have access to protected members" is just not true:

public classA {
     protected void doSomething() {}
}
public classB {
     private void callDoSomething{
          classA clsa = new classA();
          clsa.doSomething();                     // compile error
     }
 }
 
I will leave it now to that. To the other points I second your thoughts, anyway.

You seem to have one question yourself though, on T/F nr 1: the circular reference. Yet it is quite common, consider this DOM example, which works in most OO languages, and contains loads of circular references:

XmlDocument doc = new XmlDocument();
doc.Load("some.xml");
XmlNode node = doc.DocumentElement.FirstChild.FirstChild.Parent.Parent;

which will return the document element :)

Regards,
-- Abel --
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now