Study Guide for Exam II and Lab Quiz

Java Textbook Chapters 1-6



HTML for executing an Applet
ASCII, Unicode
bugs and debugging
Java:
	methods	(functions) void functions vs functions that return a value
	
	If you see a function called like this:	   double average=getAverage();
    Is getAverage() a void function or a function that returns a value?

	review reading in values of different types:
	  integers
	  doubles	
	  Strings

	random numbers

	graphics commands and layout managers

	events, listeners, and handlers

	strings and string functions (indexOf(), length(), substring(), toUpperCase() equals())

	arrays

	switch statement

The exam will consist of True/False and Multiple Choice Questions as well as a program to write.  
Be prepared to write a program involving string, arrays, void functions, and functions that
return a value.  Material from the first 5 weeks may be included on the test.

You may bring 1 page of notes, double sided provided that you:

Practice Questions:

1)What do these HTML tags do:
<applet> ... </applet>
<img>
<script> ...</script>

2)What do we call things like windows, textboxes and buttons in the
Java graphics window?

3a)What would you expect these graphics commands to do?
g.setColor(Color.pink);
g.fillOval(0,0,50,50);

3b)What do we call the values inside the parentheses?

3c)What would happen if we reversed the order of the two graphics
commands given above?

4)Given: 	char [ ] letters={'a','b','c','d'};      
        		System.out.println(letters[2]);

	What will be printed to the screen:

A.	ab
B.	c
C.	b
D.	2

5) 	How would you declare an array of Strings and assign it
	the values: Marsha, Tommy, Lee, and Trinh


6)  How would you declare an array of 100 ints.  (Assume they
	will be entered when the program executes.)


7)	How would you write a for loop to add up the values
	in the array below:

	double quiz_scores[]={5,9,8,4,10};
	
	//hints: declare a variable to store the sum
	//the loop should execute 5 times starting at ___
	//each time through the loop, add the current element
	//of the array to the sum
	
8)Which of the following are correct statements:
	i.	a mouse click is an example of an event
	ii.	code that responds to an event is called a "handler"
	iii.	a button is an example of a component
	iv.	a "listener" is code that detects events
A.	i and iii only
B.	ii and iv only
C.	ii, iii, and iv only
D.	i, ii, iii, and iv

 

Lab Quiz Be able to create a simple applet using the graphics commands we have covered. Practice: Create an applet that draws a blue circle and red rectangle in the middle of the screen. Add the commands to print "IT 108 Spring 2002" under the graphics, in a bold 14 point font.

Standard Disclaimer: This is a guide only and is not comprehensive.

Click here to return to the IT 108 page


Copyright © Anne Marchant, 1999-2002 All rights reserved.