Presentation is loading. Please wait.

Presentation is loading. Please wait.

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. PreAP Computer.

Similar presentations


Presentation on theme: "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. PreAP Computer."— Presentation transcript:

1 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. PreAP Computer Science Quiz

2 Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Quiz EC.

3 Question 01 Which method is used to output a string of characters on a graphics display? (a)displayString (b)drawString (c)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 (a)The name of the font (b)The style of the font (c)The size of the font (d)All of the above

6 Question 04 Which of these commands will have its output affected by Expo.setFont? I.drawPixel II.drawLine III.drawCircle IV.drawString (a)I only (b)II only (c)III only (d)IV only (e)I, II and III only (f)I, II, III and IV

7 Question 05 Which of these commands will have its output affected by Expo.setColor? I.drawPixel II.drawLine III.drawCircle IV.drawString (a)I only (b)II only (c)III only (d)IV only (e)I, II and III only (f)I, II, III and IV

8 Question 06 Which of the following is NOT a valid font style? (a)Font.PLAIN (b)Font.BOLD (c)Font.UNDERLINE (d)Font.ITALIC (e)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 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); (a)The program will not compile. (b)The program will compile, but not execute. (c)The program executes & substitutes the Arial Font. (d)The program executes & automatically downloads the Qwerty font so it will execute properly. Question 09

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

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

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

15 Question 13 Which statement can display any random 3-digit number? (a)System.out.println(Expo.random(100,999)); (b)System.out.println(Expo.random(101,998)); (c)System.out.println(Expo.random(99,1000)); (d)System.out.println(Expo.random(999,100)); (e)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”); int x = Expo.random(1,2); if (x == 1) System.out.println(“Heads”); else System.out.println(“Tails”); int x = Expo.random(1,3); if (x == 1) System.out.println(“Heads”); else System.out.println(“Tails”); int x = Expo.random(0,1); if (x == 1) System.out.println(“Tails”); else System.out.println(“Heads”); AC BD

17 Question 15 This program segment will display 1000 random circles. Which of the following is NOT random in the output? (a)The location of each circle. (b)The color of each circle. (c)The size of each circle. 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); } In questions assume the dimensions of all applet windows are 1000 by 650.

18 Question 16 This program segment will display 1000 random stars. Which of the following is NOT random in the output? (a)The location of each star (b)The color of each star (c)The size of each star (d)The number of points each star has 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); }

19 Question 17 What is the output of this program? 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); } (a)(b)(c) (f) (e) (d)

20 Question 18 What is the output of this program? 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); } (a)(b)(c) (f) (e) (d)

21 Question 19 What is the output of this program? 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); } (a)(b)(c) (f) (e) (d)

22 Question 20 What is the output of this program? 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); } (a)(b)(c) (f) (e) (d)

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


Download ppt "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. PreAP Computer."

Similar presentations


Ads by Google