Take out a piece of paper and PEN. Exposure Java 2015 for Teaching AP® Computer Science DYRT Quiz 11.06-09 Key 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 11.06-09 1. 9. 2. 10. 3. 11. 4. 12. 5. 13. 6. 14. 15. 8. 16.
Question 01 What is the output of the following program segment? int[ ] list = {1,2,3,4,5,6,7,8,9}; for (int number : list) { number++; System.out.print(number + " "); } 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 10 Runtime exception error
Question 02 What is the output of the following program segment? int[ ] list = {1,2,3,4,5,6,7,8,9}; for (int number : list) number++; for (int number : list) System.out.print(number + " "); 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 10 Runtime exception error
Question 03 What is the output of the following Program segment and method? int p = 10; int q = 20; swap(p,q); System.out.println(p + " " + q); public static void swap (int x, int y) { int temp = x; x = y; y = temp; } 10 20 20 10 10 10 20 20 10 20 20 10
Question 04 What is the output of the following Program segment and method? int p = 10; int q = 20; swap(p,q); public static void swap (int x, int y) { int temp = x; x = y; y = temp; System.out.println(x + " " + y); } 10 20 20 10 10 10 20 20 10 20 20 10
Question 05 What is the output of the following Program segment and method? int[ ] list = {111,222,333,444,555}; swap(list,3,4); System.out.println(list[2]+" "+list[3]); public static void swap(int[ ] x, int p, int q) { int temp = x[p]; x[p] = x[q]; x[q] = temp; } 333 444 444 333 555 333 333 555 Runtime Exception error
Question 06 What is the output of the following Program segment and method? int[ ] list = {111,222,333,444,555}; swap(list,1,5); System.out.println(list[2]+" "+list[4]); public static void swap(int[ ] x, int p, int q) { int temp = x[p]; x[p] = x[q]; x[q] = temp; } 111 555 555 111 222 444 444 222 Runtime Exception error
Question 07 “Shallow” values are used by simple, primitive data types only. objects only. simple data only when passing parameters. objects only when passing parameters. both simple data types and objects.
Question 08 “Deep” values are used by simple, primitive data types only. objects only. simple data only when passing parameters. objects only when passing parameters. both simple data types and objects.
Question 09 The Card class stores information about the number of cards in a deck. its location in a deck. its suit, rank and value. its suit color. all of the above.
Question 10 The toString method in the Card class is used for constructing a Card object. for displaying any String attribute values. for displaying the three attribute values. in place of the println method for output. for all of the above.
Question 11 The Card class and the Deck class have class interaction with composition. class interaction with inheritance no class interaction only class interaction between Card objects.
Question 12 In any of the Deck class program examples the call to construct a Card object is located in the Deck class only. the DeckTester class only. either the Deck or DeckTester classes. none of the above.
Question 13 In any of the Deck class program examples the call to construct a cards array object is located in the Deck class only. the DeckTester class only. either the Deck or DeckTester classes. none of the above.
Question 14 In any of the Deck class program examples the call to construct a Deck object is located in the Deck class only. the DeckTester class only. either the Deck or DeckTester classes. none of the above.
Question 15 The toString method of the Deck class uses the toString method of the Card class. displays all the cards in the Deck object. returns a concatenated string of Card objects. does all of the above.
Question 16 The size value of a Deck object Is fixed at 1. is not an attribute of the Deck class. is between 0 and 52.