C# Workshop - Week 5 Review Questions

Started by
6 comments, last by foolios 16 years, 8 months ago
Chapters 12, 16, and 17 Review Questions Greetings everyone. Each week I will post review questions and exercises in the weekly thread. Please try and answer them by yourself; either as you're reading over the chapters, or afterwards if you prefer. Once you've done so, feel free to look over the answers provided by others and submit your own answers if you've not yet seen them posted. Discussion about the quiz questions and answers is encouraged for clarification. Finally, experienced C# programmers may feel free to post quiz-like questions and exercises of their own.
  1. Do exception occur at compile-time or run-time?
  2. Where are most of the basic exception classes found in the .NET Framework Library
  3. You include your code in a ???-block in order to indicate you wish to handle exceptions locally rather than letting the CLR handle it.
  4. A ???-block is where you handle exceptions thrown.
  5. True or False, variables declared inside of a Try-block are also available in a Catch-Block?
  6. If no exceptions are thrown in a try block, execution continues where?
  7. If a method with a return value throws an exception, what is true of the return value?
  8. If a catch clause does not specify a type to catch, it is referred to as...?
  9. If you specify a catch clause with type "Exception", which types of exceptions can it catch?
  10. If you have a try-block with multiple-catch blocks, in which order are the catch blocks evaluated? Are all of them evaluated?
  11. If you're attempting to catch individual types of exceptions you should always put what type of catch as the last one?
  12. Where does a Finally clause go?
  13. True or false, finally clauses are guaranteed to be executed following a try clause (after a catch), even if no catch clause is called.
  14. If you put a return statement in your try or catch clause, will the finally clause be called?
  15. Is it possible to have a finally clause without ANY catch clauses?
  16. A simple 'throw;' statement, without any exception objects listed, is valid only in what type of a block?
  17. True or false, after an exception is thrown, the remaining code in a method will be executed, then the execution will move to the catch statement?
  18. True or false, the equality operator returns true if both operands are equal, and the inequality operator returns true if the operands are different?
  19. What method, defined by the System.Object class is part of every other struct and class and is used for computer equality?
  20. What must be true in order for two structs of the same type to be "Equal" to each other?
  21. True or false, comparing two user-defined objects of the same type will return true by default if all the fields have the same values?
  22. What is the difference between bitwise equality and reference equality?
  23. True or false, when an array is passed to a method, the method can change the value of the individual elements in the array?
  24. If the type copied into a method is a value-type, what type of copy is made? What if it's a reference type?
  25. True or False, whether you send a value-type or a reference-type as a parameter to a method, without special modifiers a COPY *something* is made and passed.
  26. If you don’t want the fields in a class to be accessible/changeable by programs using the class, you should declare the fields as....?
  27. What is the default accessibility of fields in classes and structs?
  28. True or false, the readonly flag is usable only on fields?
  29. After the constructor finishes running, readonly fields can only be modified when?
  30. What does it mean for an object to be immutable?
  31. Traditionally, methods designed to allow users of a class to get and set field values had names which began with?
  32. To users, properties look and feel exactly like...what?
  33. According to the C# style guidelines, and according to the text, Property names are often...
  34. Often, public properties are associated with....what? Is this required.
  35. Is it possible for Properties to be static? What would this imply about any associated private fields?
  36. If only a 'get' method is provided for a property, the property is said to be...What?
  37. In spite of the fact that 'set' and 'get' are used in property declarations, they are not considered keywords by the C# language. Why is this?
  38. In the 'set' function of a property, the special identifier "value" refers to what?
  39. What must be present at the end of all 'get' methods?
  40. True or False. Properties are not part of the Common Language Specification, and are thus not truly implemented in Intermediate Language?
  41. What are the method names created in Intermediate Language to accommodate C#'s properties?
  42. True or False, methods of a class cannot access the class's properties, and instead must use the private fields?
  43. What's one easy way to tell whether code should be part of a property or a method?
  44. If the code requires a parameter in order to return a value, then it must be implemented as a property...or a method?
  45. Indexers are a type of property intended for use by classes and structures that store what?
  46. True or False, a class can have only a single indexer.
  47. True or False, an indexer doesn’t' have to take integers, and can perform indexing on any declared type.
  48. What is the name of the property, in which the .NET documentation uses to identify an indexer?
  49. What is the name the C# Compiler generates in Intermediate Language for the methods that represent an indexer?
Good luck! [Edited by - JWalsh on August 6, 2007 12:15:03 PM]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Advertisement
No-one wants to take a stab at this week's review questions?
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
To be honest with you I about a week behind after working on the project, I've still to read the relevant chapters for this week and answer last weeks questions as well.
How about them apples?
I actually already answered them all. I really didn't have any questions. I found this weeks questions pretty easy.

Chad

Feel free to post some for other's to review.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Mine are here!
I just finished with the questions so I'll post a few to look over, not sure about number 7 if someone could help me out.

Although I haven't had any questions to post I appreciate all the work that you've put into the workshop JWalsh and others answering questions. Reading other peoples questions and answers is a great way to learn too.

  1. Do exception occur at compile-time or run-time?
      run-time


  2. Where are most of the basic exception classes found in the .NET Framework Library
      In the System namespace


  3. You include your code in a ???-block in order to indicate you wish to handle exceptions locally rather than letting the CLR handle it.
      In a try-block


  4. A ???-block is where you handle exceptions thrown.
      A catch-block


  5. True or False, variables declared inside of a Try-block are also available in a Catch-Block?
      False


  6. If no exceptions are thrown in a try block, execution continues where?
      After the catch block, without executing catch block


  7. If a method with a return value throws an exception, what is true of the
    return value?
      Not sure on this one???


  8. If a catch clause does not specify a type to catch, it is referred to as...?
      A general catch clause


  9. If you specify a catch clause with type "Exception", which types of exceptions can it catch?
      All exception types


  10. If you have a try-block with multiple-catch blocks, in which order are the catch blocks evaluated? Are all of them evaluated?
      They are evaluated sequentially, they are evaluated until one matches the exceptoin


  11. If you're attempting to catch individual types of exceptions you should always put what type of catch as the last one?
      A general catch clause or catch(Exception exc)


  12. Where does a Finally clause go?
      After the catch clause


  13. True or false, finally clauses are guaranteed to be executed following a try clause (after a catch), even if no catch clause is called.
      True


  14. If you put a return statement in your try or catch clause, will the finally clause be called?
      Yes


  15. Is it possible to have a finally clause without ANY catch clauses?
      Yes


  16. A simple 'throw;' statement, without any exception objects listed, is valid only in what type of a block?
      Catch block to rethrow exception


  17. True or false, after an exception is thrown, the remaining code in a method will be executed, then the execution will move to the catch statement?
      False


  18. True or false, the equality operator returns true if both operands are equal, and the inequality operator returns true if the operands are different?
      True


  19. What method, defined by the System.Object class is part of every other struct and class and is used for computer equality?
      Equals


  20. What must be true in order for two structs of the same type to be "Equal" to each other?
      All fields in both structs must be equal

For #7 that you were wondering about. Could it be that it doesn't exist since there was an exception preventing the method from reaching it's completion?
I rate users. Its just not having much impact as my rating is low...

This topic is closed to new replies.

Advertisement