Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How C# are you? [modified]

How C# are you? [modified]

Scheduled Pinned Locked Moved The Lounge
csharpquestion
30 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V VE2

    C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]

    73

    modified on Tuesday, July 7, 2009 7:49 AM

    A Offline
    A Offline
    Andre xxxxxxx
    wrote on last edited by
    #14

    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);

    M 1 Reply Last reply
    0
    • A Andre xxxxxxx

      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#?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #15

      You don't even get a warning.

      1 Reply Last reply
      0
      • A Andre xxxxxxx

        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);

        M Offline
        M Offline
        molesworth
        wrote on last edited by
        #16

        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 1 Reply Last reply
        0
        • A Andre xxxxxxx

          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#?

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #17

          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.

          My blog | My articles | MoXAML PowerToys | Onyx

          A 1 Reply Last reply
          0
          • M molesworth

            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 Offline
            A Offline
            Andre xxxxxxx
            wrote on last edited by
            #18

            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|

            M 1 Reply Last reply
            0
            • V VE2

              C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]

              73

              modified on Tuesday, July 7, 2009 7:49 AM

              H Offline
              H Offline
              hairy_hats
              wrote on last edited by
              #19

              "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

              0 1 Reply Last reply
              0
              • P Pete OHanlon

                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.

                My blog | My articles | MoXAML PowerToys | Onyx

                A Offline
                A Offline
                Andre xxxxxxx
                wrote on last edited by
                #20

                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.

                P 1 Reply Last reply
                0
                • V VE2

                  C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]

                  73

                  modified on Tuesday, July 7, 2009 7:49 AM

                  N Offline
                  N Offline
                  NormDroid
                  wrote on last edited by
                  #21

                  Most ambiguous set of questions I have ever to set my poor eyes on.

                  Software Kinetics (requires SL3 beta) - Moving software

                  1 Reply Last reply
                  0
                  • A Andre xxxxxxx

                    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|

                    M Offline
                    M Offline
                    molesworth
                    wrote on last edited by
                    #22

                    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...

                    1 Reply Last reply
                    0
                    • V VE2

                      C# quiz...:confused: http://www.ex-designz.net/test_page.asp?tid=48[^]

                      73

                      modified on Tuesday, July 7, 2009 7:49 AM

                      realJSOPR Offline
                      realJSOPR Offline
                      realJSOP
                      wrote on last edited by
                      #23

                      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

                      N A 2 Replies Last reply
                      0
                      • A Andre xxxxxxx

                        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.

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #24

                        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.

                        My blog | My articles | MoXAML PowerToys | Onyx

                        1 Reply Last reply
                        0
                        • realJSOPR realJSOP

                          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

                          N Offline
                          N Offline
                          NormDroid
                          wrote on last edited by
                          #25

                          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

                          R 1 Reply Last reply
                          0
                          • realJSOPR realJSOP

                            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

                            A Offline
                            A Offline
                            Andre xxxxxxx
                            wrote on last edited by
                            #26

                            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

                            N 1 Reply Last reply
                            0
                            • A Andre xxxxxxx

                              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

                              N Offline
                              N Offline
                              NormDroid
                              wrote on last edited by
                              #27

                              Forgot to annotate it with FTFY

                              Software Kinetics (requires SL3 beta) - Moving software

                              1 Reply Last reply
                              0
                              • N NormDroid

                                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

                                R Offline
                                R Offline
                                Rob Graham
                                wrote on last edited by
                                #28

                                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.

                                1 Reply Last reply
                                0
                                • H hairy_hats

                                  "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

                                  0 Offline
                                  0 Offline
                                  0x3c0
                                  wrote on last edited by
                                  #29

                                  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

                                  L 1 Reply Last reply
                                  0
                                  • 0 0x3c0

                                    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

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #30

                                    We'll never know, though, will we?

                                    ___________________________________________ .\\axxx (That's an 'M')

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups