Presentation is loading. Please wait.

Presentation is loading. Please wait.

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. Exposure Java 2014 for.

Similar presentations


Presentation on theme: "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. Exposure Java 2014 for."— Presentation transcript:

1 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. Exposure Java 2014 for Teaching AP ® Computer Science DYRT Quiz 06.01-05

2 Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Quiz 06.01-05 1.9. 2.10. 3.11. 4.12. 5.13. 6.14. 7.15. 8.EC.

3 Question 01 In the statement int x; What is int ? (a)a variable (b)a data type (c)a class (d)an object

4 Question 02 In the statement int x; What is x ? (a)a variable (b)a data type (c)a class (d)an object

5 Question 03 In the statement Bank tom = new Bank(5000.0); Which is the class? (a)Bank (b)tom (c)new (d)5000.0

6 Question 04 In the statement Bank tom = new Bank(5000.0); Which is the object? (a)Bank (b)tom (c)new (d)5000.0

7 Question 05 How many classes are being shown in this example? (a)1 (b)2 (c)3 (d)4 (e)5 (f)10 (g)13

8 Question 06 How many objects are being shown in this example? (a)1 (b)2 (c)3 (d)4 (e)5 (f)10 (g)13

9 Question 07 Which of these statements will cause a different set of random numbers to be generated every time the program is executed? (a)Random rand = new Random(); (b)Random rand = new Random(40); (c)Random rand = new Random(12345); (d)All of the above

10 Question 08 Assume rand is an object of the Random class. What is the output of this statement? System.out.println(rand.nextInt(1000)); (a)1000 (b)a random number from 1 to 1000 (c)a random number from 0 to 1000 (d)a random number from 1 to 999 (e)a random number from 0 to 999

11 Question 09 Assume rand is an object of the Random class. What is the output of this statement? System.out.println(rand.nextInt(1001)); (a)1001 (b)a random number from 1 to 1000 (c)a random number from 0 to 1000 (d)a random number from 1 to 999 (e)a random number from 0 to 999

12 Question 10 Assume rand is an object of the Random class. What is the output of this program segment? int x = rand.nextInt(1000) + 1; System.out.println(x); (a)1001 (b)a random number from 1 to 1000 (c)a random number from 0 to 1000 (d)a random number from 1 to 999 (e)a random number from 0 to 999

13 Question 11 Which of the following are methods of the Random class? (a)nextInt (b)nextDouble (c)setSeed (d)All of the above

14 Question 12 The random method of the Math class behaves Just like the _____ method of the _____ class. (a)nextRnd Random (b)nextDouble Random (c)nextRandomDice (d)nextIntInteger

15 Question 13 The Math.random() method generates a random number x, such that (a)0 < x < 1 (b)0 <= x < 1 (c)0 <= x <= 1 (d)0 < x <= 1

16 Question 14 What is the output of the following statement? System.out.println( (int) (100 * Math.random() ); (a)An integer in the [1..100] range (b)An integer in the [0..100] range (c)An integer in the [1..99] range (d)An integer in the [0..99] range

17 Question 15 Assume rand is an object of the Random class. Which of the following statements will cause x to have a random value between 100 and 500? (a) int x = rand.nextInt(500) + 100; (b) int x = rand.nextInt(100) + 500; (c) int x = rand.nextInt(400) + 100; (d) int x = rand.nextInt(401) + 100; (e) int x = rand.nextInt(100) + 401;

18 Extra Credit Assume rand is an object of the Random class. Which of the following statements will cause x to have a random value in the same range as this statement: int x = rand.nextInt(1001) + 500; (a) int x = Math.random(1001) + 500; (b) int x = (int) (Math.random() * 1001 + 500); (c) int x = Math.random(1600) + 500; (d) int x = Math.random() * 1001 + 500; (e) int x = (int) (Math.random() * 500 + 1001);


Download ppt "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. Exposure Java 2014 for."

Similar presentations


Ads by Google