Take out a piece of paper and PEN. Exposure Java 2015 for Teaching AP® Computer Science DYRT Quiz 07.06-12 Take out a piece of paper and PEN. The quiz starts TWO minutes after the tardy bell rings. You will have 30 seconds per question.
Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Quiz 07.06-12 1. 11. 2. 12. 3. 13. 4. 14. 5. 15. 6. 16. 7. 17. 8. 18. 9. 19. 10. 20.
Question 01 double number = 6.25; double result = Math.sqrt(number); What type of parameter is number in this program segment? double number = 6.25; double result = Math.sqrt(number); actual parameter formal parameter class parameter receiving parameter
Question 02 public static void sum(int n1, int n2) What type of parameters are n1 and n2 ? public static void sum(int n1, int n2) actual parameters formal parameters class parameters receiving parameters
Question 03 Return methods always calculate some mathematical formula. display a value. return a value. use numerical values.
Question 04 What type of method is written below? public static void add(int n1, int n2) { System.out.println(n1 + n2); } return method add method void method print method
Question 05 What type of method is written below? public static int add(int n1, int n2) { return n1 + n2; } return method add method void method print method
Question 06 What type of method is the main method? return method add method void method print method
Question 07 Java’s Math class contains __________ methods. void class void object return class return object
Question 08 Java’s Graphics class contains __________ methods. class math object String
Question 09 Which of the following is wrong with the first stage of the Payroll Case Study? There is no readable program format. The variable identifiers make no sense. All the program statements are in one module. All of the above
Question 10 The first stage, and very poorly written, Payroll Case Study program does not compile. compiles, but executes incorrectly. compiles and executes. cannot be improved.
Question 11 Which of the following is an example of a good self-commenting identifier? qwerty k netPay public
Question 12 Which of the following is/are true about designing a program? Use self-commenting identifiers. Use consistent indentation style. Don't place many program statements in the main method. Specific tasks should be placed in modules called methods. Similar methods accessing the same data should be placed in their own class. All of the above
Question 13 What kind of variable is x? local variable class variable public class Quiz7613 { static String z = "Bob"; public static void main(String args[]) int x = 7; . . . . } public static void qwerty() char y = '?'; Question 13 What kind of variable is x? local variable class variable final variable
Question 14 What kind of variable is y? local variable class variable public class Quiz7614 { static String z = "Bob"; public static void main(String args[]) int x = 7; . . . . } public static void qwerty() char y = '?'; Question 14 What kind of variable is y? local variable class variable final variable
Question 15 What kind of variable is z? local variable class variable public class Quiz7615 { static String z = "Bob"; public static void main(String args[]) int x = 7; . . . . } public static void qwerty() char y = '?'; Question 15 What kind of variable is z? local variable class variable final variable
Question 16 Where can the variable x be used? the main method public class Quiz7616 { static String z = "Bob"; public static void main(String args[]) int x = 7; . . . . } public static void qwerty() char y = '?'; Question 16 Where can the variable x be used? the main method the qwerty method entire Quiz7612 class
Question 17 Where can the variable y be used? the main method public class Quiz7617 { static String z; public static void main(String args[]) int x = 7; . . . . } public static void qwerty() char y = '?'; Question 17 Where can the variable y be used? the main method the qwerty method entire Quiz7612 class
Question 18 Where can the variable z be used? the main method public class Quiz7618 { static String z; public static void main(String args[]) int x = 7; . . . . } public static void qwerty() char y = '?'; Question 18 Where can the variable z be used? the main method the qwerty method entire Quiz7612 class
Question 19 When a program has multiple classes, which one is called the Driving Class? The class with the same name as the file. The class with the most methods. The class with the least number of methods. The class with the main method.
Question 20 Which of these is a synonym for Class Variable? attribute final variable local variable parameter