PreAP Computer Science Quiz

Slides:



Advertisements
Similar presentations
Applets and Graphics.
Advertisements

Chapter 15 Graphics. To paint, you need to specify where to paint. Each component has its own coordinate system with the origin (0, 0) at the upper-left.
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Review of Math Class Methods abssqrt minmax powround ceilfloor.
Graphics You draw on a Graphics object The Graphics object cannot directly be created by your code, instead one is generated when the method paintComponent.
Graphics Chapter 16.  If you want to draw shapes such as a bar chart, a clock, or a stop sign, how do you do it?
PHY-102 SAPIntroductory GraphicsSlide 1 Introductory Graphics In this section we will learn how about how to draw graphics on the screen in Java:  Drawing.
Hand Trace and Output for: int digit = 0; int number = 1423; do { digit = number % 10; System.out.println(digit); number = number / 10; } while (number.
Applets Graphical Java programs Run inside web browser Platform-neutral Easy deployment--loads when needed Secure.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Java Graphics Section 1 - Multi-File Graphics Programs Section 2 - The Coordinate System and Graphics Context g Section 3 - The Java Drawing and Painting.
1 Home Tab Font Group 5 6 To change the font shape: 1- select the text you want to change 2- from font type drop down list choose any type.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Topics  Applets  Classes used for graphics Graphics Point Dimension.
Slides prepared by Rose Williams, Binghamton University Chapter 19 Swing II.
I.1 ii.2 iii.3 iv.4 1+1=. i.1 ii.2 iii.3 iv.4 1+1=
Graphical User Interface (GUI) Programming IV. Lecture Objectives Exploring more GUI programming elements in Java Using icons in GUIs Using scroll bars.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Java Graphics Applets.
I.1 ii.2 iii.3 iv.4 1+1=. i.1 ii.2 iii.3 iv.4 1+1=
PreAP Computer Science Quiz
PreAP Computer Science Quiz
PreAP Computer Science Quiz
COMMON APPLICATION FUNCTIONS Presentation. Bullets  Symbols used to organize data into a list.  This  Is  An  Example  Of  A  Bullet  List.
Object Oriented Programming one of the main reasons we now teach Java instead of C++. C++ was designed to be backwardly compatible with the original (non-OOP)
PreAP Computer Science Quiz
// Java0601.java // This program demonstrates that the methods of a class are not always // accessible, like they were with the class. In this case an.
Computer Science Reading Quiz 6.2 (Sections )
PreAP Computer Science Review Quiz 08 Key
Chapter 15Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 15 l Basic Figures l Colors l Fonts and Other Text Details.
Drawing and Filling Geometric Shapes. Java comes with more than just points and lines. Within the Graphics2D class, there are also methods for drawing.
Graphics & Java 2D Drawing Two Dimensional Shapes Controlling Fonts Controlling Colors.
PreAP Computer Science Quiz Key
Drawing rectangles and ovals in the Applet window Displaying Text in the Java Console Window Demo of the HelloAgain program Arithmetic expressions Examples.
Document Formatting © 2009 M and K Solutions, LLC -- All Rights Reserved.
PreAP Computer Science Quiz
AP Computer Science DYRT Quiz Key
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output.
Excel 2010 Formatting Cells. Formatting text To change the font:
PreAP Computer Science Quiz
PreAP Computer Science Quiz Key
Take out a piece of paper and PEN.
11 Writing Text Session 5.1. Session Overview  Show how fonts are managed in computers  Discover the difference between bitmap fonts and vector fonts.
PreAP Computer Science Quiz
Take out a piece of paper and PEN.
PreAP Computer Science Quiz Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 30 – 60 seconds.
AP Computer Science DYRT Quiz
Turtle Graphics Just keep swimming …. Fill Shapes turtle.fillcolor(“#color_code”) turtle.begin_fill() turtle.end_fill() ■You must tell turtle when to.
Chapter 7 Introduction to High-Level Language Programming.
Review of Math Class Methods abssqrt minmax powround ceilfloor.
(PART II) Graphics and Multimedia. Font Control Font s  After a Font is created, its properties cannot be modified  Programmers must create a new Font.
(PART II) Graphics and Multimedia 11/02/1437 Lect6 (Part 2)
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.
Lesson 2: Formatting Content
Section 6.2 Classes & Objects.
Pre-AP® Computer Science Quiz Key
Pre-AP® Computer Science Quiz
Take out a piece of paper and PEN.
PreAP Computer Science Review Quiz 08
Engineering Technical Writing
PreAP Computer Science Quiz Key
Take out a piece of paper and PEN.
Graphics and Multimedia
PreAP Computer Science Quiz
Take out a piece of paper and PEN.
Take out a piece of paper and PEN.
Final Exam Review CSE113.
Take out a piece of paper and PEN.
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
Turtle Graphics Just keep swimming ….
Pre-AP® Computer Science Quiz
Presentation transcript:

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.

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

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

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

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

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

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

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

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

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);

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.

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);

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);

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));

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));

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

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 15-20 assume the dimensions of all applet windows are 1000 by 650.

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

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)

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)

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)

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)

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));