Chapter 4 Homework Name: Brian Harman Score: _______ Class Section: Q (I think) True/False Indicate whether the statement is true or false. f 1. Console applications require a Main( ) method, unlike Windows applications that do not require a Main( ) method. t 2. In order to indicate a value is constant and cannot be changed, the keyword const is added. t 3. In order to call a static method from another class, the class name must be used with the method name. f 4. The following are examples of the access modifiers available in C#: public, personal, protected. f 5. The accessibility modifier identifies what type of value is returned when the method is completed. t 6. If a method does not return a value, the void keyword is placed at the return type location in the method heading. t 7. A standard convention used by programmers for naming classes is to use an action verb phrase. t 8. The Console class is defined in the System namespace. t 9. The Read( ) method is different from the ReadLine( ) method in that the Read( ) returns an int and the ReadLine( ) returns a string argument. t 10. The Parse( ) method returns the number representation of its string argument. Multiple Choice Identify the choice that best completes the statement or answers the question. a a d d d 11. Constructors should be defined with a ____ access modifier. a. public c. protected b. private d. static 12. To add full functionality to your classes, ____. a. write more than one constructor b. write a default constructor c. write at least five constructors for each class d. omit writing a constructor so that the default one will be created for you 13. Which of the following is a user-defined method? a. Parse( ) c. Main( ) b. Write( ) d. Pow( ) 14. The first line of a method is called the ____ of the method. a. signature c. heading b. definition d. declaration 15. The most restrictive access modifier that offers accessibility only within the body of the class is ____. a. internal c. protected b. public d. private Console.WriteLine(“Final Grade = {0:N2}”, CalculateGrade(90, 75, 83)); b 16. The {0:N2} above indicates the ____. a. first argument should display no digits to the right of the decimal b. first argument should display two digits to the right of the decimal c. the argument should be displayed with 0 digits to the left of the decimal and two digits to the right of the decimal d. the argument should be displayed with 0 digits to the right of the decimal and two digits to the left of the decimal A(d-if you say that it is PART of a parameter for the WriteLine() method) 17. In the statement above, CalculateGrade(90, 75, 83) is ____. a. a method call c. an identifier for the class b. a method declaration d. a parameter for the WriteLine( ) method b 18. Calls to ____ methods use the class identifier with the method call instead of the object identifier. a. value returning c. private b. static d. predefined c 19. A method used to convert from one base type to another is ____. a. ChangeValue( ) c. ToDouble( ) b. Convert( ) d. ConvertToDouble( ) a 20. The following members of the Math class, (Min( ), Max( ), Round, and Log( )), must be called using the class name, because they are all ____. a. static methods c. predefined b. objects d. private methods c 21. Which method returns the largest whole number less than or equal to the specified number? a. Max( ) c. Floor( ) b. Ceiling( ) d. Largest( ) b 22. The ____ of an identifier is the region of the program in which that identifier is usable. a. access c. modifier b. scope d. declaration d 23. A class is normally associated with a(n) ____, which often describes a person, place, or thing and is normally a noun. a. method member c. data member b. behavior d. entity public static void Main( ) b c 24. The access modifier in the heading above is the keyword ____. a. public c. void b. static d. Main( ) 25. The return type for a the method above is ____. a. public c. void b. static d. Main( )