How C# are you? [modified]
-
C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]
73
modified on Tuesday, July 7, 2009 7:49 AM
-
C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]
73
modified on Tuesday, July 7, 2009 7:49 AM
I've choosen a) because ToLower() returns a copy of the string X| a) (your answer) String = string.ToLower(string); b) ToLower(string); c) string.ToLower(); - correct answer d) string.ToLower(string);
-
a) True - correct answer b) (your answer) False I've only used C++/CLI and if I declare a method as abstract and omit the abstract keyword behind the class I get a warning, but I can also declare a class as abstract without even any abstract methods. Is this not true for C#?
-
I've choosen a) because ToLower() returns a copy of the string X| a) (your answer) String = string.ToLower(string); b) ToLower(string); c) string.ToLower(); - correct answer d) string.ToLower(string);
The correct answer is "none of the above". Normally, I'd use newstring = oldstring.ToLower(); The optional parameter is a CultureInfo string, if you want formatting for a particular culture setting. However, using "String" or "string" as variable names is going to throw up compile errors. PS - that quiz is an abomination which should be removed before anybody gets the wrong impression of C# :)
There are three kinds of people in the world - those who can count and those who can't...
-
a) True - correct answer b) (your answer) False I've only used C++/CLI and if I declare a method as abstract and omit the abstract keyword behind the class I get a warning, but I can also declare a class as abstract without even any abstract methods. Is this not true for C#?
All methods in an abstract base class do not have to be declared abstract. You can't instantiate an abstract base class, but you can provide default functionality. What you must do, is provide an implementation of abstract functionality in any derived classes. You, also, can't declare a method as abstract if it's not in an abstract class. Honestly, this test is rubbish.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
The correct answer is "none of the above". Normally, I'd use newstring = oldstring.ToLower(); The optional parameter is a CultureInfo string, if you want formatting for a particular culture setting. However, using "String" or "string" as variable names is going to throw up compile errors. PS - that quiz is an abomination which should be removed before anybody gets the wrong impression of C# :)
There are three kinds of people in the world - those who can count and those who can't...
molesworth wrote:
However, using "String" or "string" as variable names is going to throw up compile errors.
I know, but I thought the questioner wanted to see if we know that ToLower() returns a copy, but obviously that was not his intention X|
-
C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]
73
modified on Tuesday, July 7, 2009 7:49 AM
"70% = C" I wish that GCSEs were graded on that scale. Seems to me you only need to turn up to get a C.
I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
-
All methods in an abstract base class do not have to be declared abstract. You can't instantiate an abstract base class, but you can provide default functionality. What you must do, is provide an implementation of abstract functionality in any derived classes. You, also, can't declare a method as abstract if it's not in an abstract class. Honestly, this test is rubbish.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
Pete O'Hanlon wrote:
You, also, can't declare a method as abstract if it's not in an abstract class.
Ok, so Harold was wrong with his answer. In C++/CLI
ref class A
{
virtual foo() = 0;
};gives a warning because of the missing abstract behind the class. But in C++ you can also provide a default implementation of a method AND declare it as abstract (pure virtual).
class A
{
virtual foo() = 0
{
doSomething();
}
}If C# does not force me to declare every method as abstract, the test is wrong here again.
-
C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]
73
modified on Tuesday, July 7, 2009 7:49 AM
Most ambiguous set of questions I have ever to set my poor eyes on.
Software Kinetics (requires SL3 beta) - Moving software
-
molesworth wrote:
However, using "String" or "string" as variable names is going to throw up compile errors.
I know, but I thought the questioner wanted to see if we know that ToLower() returns a copy, but obviously that was not his intention X|
I'm not sure what his intention was. To confuse and babmoozle perhaps? :)
There are three kinds of people in the world - those who can count and those who can't...
-
C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]
73
modified on Tuesday, July 7, 2009 7:49 AM
A multiple choice question should not allow more than one correct answer unless the answers include the choices below: A) answer 1 B) answer 2 C) answer 3 D) All of the above E) None of the above F) The test is crap
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
Pete O'Hanlon wrote:
You, also, can't declare a method as abstract if it's not in an abstract class.
Ok, so Harold was wrong with his answer. In C++/CLI
ref class A
{
virtual foo() = 0;
};gives a warning because of the missing abstract behind the class. But in C++ you can also provide a default implementation of a method AND declare it as abstract (pure virtual).
class A
{
virtual foo() = 0
{
doSomething();
}
}If C# does not force me to declare every method as abstract, the test is wrong here again.
Andre xxxxxxx wrote:
If C# does not force me to declare every method as abstract, the test is wrong here again.
Correct. The following class is perfectly legal:
public abstract class MyClass
{
private int _myValue;
public void SetMyValue(int myValue)
{
_myValue = myValue;
}protected int MyValue
{
get { return _myValue; }
}public abstract int GetMyValueAfterSomeOperation();
}This would then be used as:
public class MyMultClass
{
private int _myMult;
public MyMultClass(int myMult)
{
_myMult = myMult;
}public override int GetMyValueAfterSomeOperation()
{
return MyValue * _myMult;
}
}"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
A multiple choice question should not allow more than one correct answer unless the answers include the choices below: A) answer 1 B) answer 2 C) answer 3 D) All of the above E) None of the above F) The test is crap
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001Are you sure you didn't right this test ;) Honestly it begs that pople who create this shit are allow to type at the fucking keyboard.
Software Kinetics (requires SL3 beta) - Moving software
-
A multiple choice question should not allow more than one correct answer unless the answers include the choices below: A) answer 1 B) answer 2 C) answer 3 D) All of the above E) None of the above F) The test is crap
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001John Simmons / outlaw programmer wrote:
A) answer 1 B) answer 2 C) answer 3 D) All of the above E) None of the above F) (your answer) The test is crap - correct answer
-
John Simmons / outlaw programmer wrote:
A) answer 1 B) answer 2 C) answer 3 D) All of the above E) None of the above F) (your answer) The test is crap - correct answer
Forgot to annotate it with FTFY
Software Kinetics (requires SL3 beta) - Moving software
-
Are you sure you didn't right this test ;) Honestly it begs that pople who create this shit are allow to type at the fucking keyboard.
Software Kinetics (requires SL3 beta) - Moving software
Norm .net wrote:
Honestly it begs that pople who create this sh*t are allow to type at the f***ing keyboard.
They didn't. It was scrawled on a bar napkin and handed to a near illiterate secretary.
-
"70% = C" I wish that GCSEs were graded on that scale. Seems to me you only need to turn up to get a C.
I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
I worked very hard for my GCSEs. I would appreciate it if you didn't deride the work I put in by claiming that I would have got a C if I had just turned up, instead of spending two years learning a syllabus
Between the idea And the reality Between the motion And the act Falls the Shadow
-
I worked very hard for my GCSEs. I would appreciate it if you didn't deride the work I put in by claiming that I would have got a C if I had just turned up, instead of spending two years learning a syllabus
Between the idea And the reality Between the motion And the act Falls the Shadow