Presentation is loading. Please wait.

Presentation is loading. Please wait.

PreAP Computer Science Quiz

Similar presentations


Presentation on theme: "PreAP Computer Science Quiz"— Presentation transcript:

1 PreAP Computer Science Quiz 06.05-10
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have between 30 and 60 seconds per question.

2 Title the quiz as shown below The quiz starts in ONE minute.
Name Period Date Quiz 1. 11. 2. 12. 3. 13. 4. 14. 5. 15. 6. 16. 7. 17. 8. 18. 9. 19. EC.

3 Question 01 Which method is used to output a string of
characters on a graphics display? displayString drawString graphicsString (d) showString (e) println

4 Question 02 There are 36 colors built into the Expo class.
Which Expo method lets you create new colors? (a) setColor (b) newColor (c) setRGB (d) createColor

5 Question 03 Creating a new font requires what piece(s) of information
The name of the font The style of the font The size of the font All of the above

6 Question 04 Which of these commands will have its output
affected by Expo.setFont? drawPixel drawLine drawCircle drawString I only II only III only IV only I, II and III only I, II, III and IV

7 Question 05 Which of these commands will have its output
affected by Expo.setColor? drawPixel drawLine drawCircle drawString I only II only III only IV only I, II and III only I, II, III and IV

8 Question 06 Which of the following is NOT a valid font style?
Font.PLAIN Font.BOLD Font.UNDERLINE Font.ITALIC Font.BOLD + Font.ITALIC

9 Question 07 Where are random numbers used outside your
computer science course? (a) Advertising (b) Political polling (c) Video games (d) All of the above

10 Question 08 Look at this display. Which command will create this exact
shade of red? (a) Expo.setColor(g,Expo.red); (b) Expo.setColor(g,1); (c) Expo.setColor(g,190,10,47); (d) Expo.setColor(g,232,216,94); (e) Expo.setColor(g,47,10,190);

11 Expo.setFont(g,“Qwerty”, Font.PLAIN, 12);
Question 09 Assume the Qwerty font does not exist on your computer. What will be the result of this statement? Expo.setFont(g,“Qwerty”, Font.PLAIN, 12); The program will not compile. The program will compile, but not execute. The program executes & substitutes the Arial Font. The program executes & automatically downloads the Qwerty font so it will execute properly.

12 Question 10 Expo.drawPolygon(g,100,300,200,100,300,300);
Which of these commands could create this shape on the graphics screen? Expo.drawPolygon(g,100,300,200,100,300,300); Expo.fillPolygon(g,100,300,200,100,300,300); Expo.drawPolygon(g,100,300,150,100,250,100,300,300); Expo.fillPolygon(g,100,300,150,100,250,100,300,300);

13 Question 11 Expo.drawPolygon(g,100,300,200,100,300,300);
Which of these commands could create this shape on the graphics screen? Expo.drawPolygon(g,100,300,200,100,300,300); Expo.fillPolygon(g,100,300,200,100,300,300); Expo.drawPolygon(g,100,300,150,100,250,100,300,300); Expo.fillPolygon(g,100,300,150,100,250,100,300,300);

14 Question 12 Which statement displays a random number from 1 to 9?
System.out.println(Expo.random(0,9)); System.out.println(Expo.random(1,10)); System.out.println(Expo.random(1,9)); System.out.println(Expo.random(9,1)); System.out.println(Expo.random(0,10));

15 Question 13 Which statement can display any random 3-digit number?
System.out.println(Expo.random(100,999)); System.out.println(Expo.random(101,998)); System.out.println(Expo.random(99,1000)); System.out.println(Expo.random(999,100)); System.out.println(Expo.random(100,1000));

16 Question 14 Which of these does NOT properly simulate flipping a coin? int x = Expo.random(0,1); if (x == 1) System.out.println(“Heads”); else System.out.println(“Tails”); A int x = Expo.random(1,2); if (x == 1) System.out.println(“Heads”); else System.out.println(“Tails”); C int x = Expo.random(1,3); if (x == 1) System.out.println(“Heads”); else System.out.println(“Tails”); B int x = Expo.random(0,1); if (x == 1) System.out.println(“Tails”); else System.out.println(“Heads”); D

17 Question 15 This program segment will display 1000 random circles.
for (int k = 1; k <= 1000; k++) { int x = Expo.random(0,1000); int y = Expo.random(0,650); Expo.setRandomColor(g); Expo.fillCircle(g,x,y,50); } Question 15 This program segment will display 1000 random circles. Which of the following is NOT random in the output? The location of each circle. The color of each circle. The size of each circle. In questions assume the dimensions of all applet windows are 1000 by 650.

18 Question 16 This program segment will display 1000 random stars.
for (int k = 1; k <= 1000; k++) { int x = Expo.random(0,1000); int y = Expo.random(0,650); int r = Expo.random(10,100); Expo.setRandomColor(g); Expo.fillStar(g,x,y,r,7); } Question 16 This program segment will display 1000 random stars. Which of the following is NOT random in the output? The location of each star The color of each star The size of each star The number of points each star has

19 Question 17 What is the output of this program? (a) (b) (c) (e) (f)
for (int k = 1; k <= 1000; k++) { int x1 = Expo.random(0,1000); int y1 = Expo.random(0,650); int x2 = Expo.random(0,1000); int y2 = Expo.random(0,650); Expo.drawLine(g,x1,y1,x2,y2); } Question 17 What is the output of this program? (a) (b) (c) (e) (f) (d)

20 Question 18 What is the output of this program? (a) (b) (c) (e) (f)
for (int k = 1; k <= 1000; k++) { int x1 = Expo.random(0,500); int y1 = Expo.random(0,650); int x2 = Expo.random(0,500); int y2 = Expo.random(0,650); Expo.drawLine(g,x1,y1,x2,y2); } Question 18 What is the output of this program? (a) (b) (c) (e) (f) (d)

21 Question 19 What is the output of this program? (a) (b) (c) (e) (f)
for (int k = 1; k <= 1000; k++) { int x1 = Expo.random(0,1000); int y1 = Expo.random(0,325); int x2 = Expo.random(0,1000); int y2 = Expo.random(0,325); Expo.drawLine(g,x1,y1,x2,y2); } Question 19 What is the output of this program? (a) (b) (c) (e) (f) (d)

22 Question 20 What is the output of this program? (a) (b) (c) (e) (f)
for (int k = 1; k <= 1000; k++) { int x1 = Expo.random(0,500); int y1 = Expo.random(0,325); int x2 = Expo.random(0,500); int y2 = Expo.random(0,325); Expo.drawLine(g,x1,y1,x2,y2); } Question 20 What is the output of this program? (a) (b) (c) (e) (f) (d)

23 Extra Credit Which statement displays a random negative
number from -50 to -100? System.out.println(Expo.random(50,100)); System.out.println(Expo.random(100,50)); System.out.println(Expo.random(-50,-100)); System.out.println(Expo.random(-100,-50)); System.out.println(Expo.random(-50,100));


Download ppt "PreAP Computer Science Quiz"

Similar presentations


Ads by Google