Exam 2 for Introduction to Computing -Java | CSC 116, Exams of Java Programming

Material Type: Exam; Class: Introduction to Computing - Java; Subject: Computer Science; University: North Carolina State University; Term: Spring 2005;

Typology: Exams

Pre 2010

Uploaded on 03/10/2009

koofers-user-xgw
koofers-user-xgw 🇺🇸

5

(1)

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSC 116 – 002 Exam 2 Spring 2005
This is the final exam review sheet. The final exam will be held on May 4
th
from 1pm to
4pm in Withers 218. You will have the full three hours to complete the exam. You may
being your book and your notes, however I would suggest that you answer all of the
questions in this study guide and use this primarily to help you on your exam.
Part 1: Vocabulary (10 questions at 2 points each)
All of the possible vocabulary words that will be on the exam appear in this list. There
are more words here to define than will be on the exam. All of the vocabulary words
come from the 2
nd
half of the semester.
1. StringTokenizer
2. Formal Parameters
3. Actual Parameters
4. File Input
5. File Output
6. File Access
7. char
8. Exception
9. throw
10. catch
11. Unchecked Exceptions
12. Checked Exceptions
13. Accessor Methods
14. Mutator Methods
15. Static Methods
16. Static Variables
17. Scope
pf3
pf4
pf5

Partial preview of the text

Download Exam 2 for Introduction to Computing -Java | CSC 116 and more Exams Java Programming in PDF only on Docsity!

CSC 116 – 002 Exam 2 Spring 2005

This is the final exam review sheet. The final exam will be held on May 4th^ from 1pm to 4pm in Withers 218.being your book and your notes, however I would suggest that you answer all of the You will have the full three hours to complete the exam. You may questions in this study guide and use this primarily to help you on your exam. Part 1: Vocabulary (10 questions at 2 points each) All of the possible vocabulary words that will be on the exam appear in this list.are more words here to define than will be on the exam. All of the vocabulary words There come from the 2nd^ half of the semester.

  1. StringTokenizer
  2. Formal Parameters
  3. Actual Parameters
  4. File Input
  5. File Output
  6. File Access
  7. char
  8. Exception
  9. throw
  10. catch
  11. Unchecked Exceptions
  12. Checked Exceptions
  13. Accessor Methods
  14. Mutator Methods
  15. Static Methods
  16. Static Variables
  17. Scope
  1. Shadowing
  2. Javadoc
  3. Arrays
  4. Command Line Options
  5. Parallel Arrays
  6. Object Arrays
  7. Container Class
  8. Partially Filled Arrays
  9. Vectors
  10. Compile Errors
  11. Runtime Errors
  12. Verification
  13. Validation
  14. Black Box Testing
  15. White Box Testing
  16. Testing
  17. Equivalence Partitioning
  18. Boundary Value Analysis
  19. Unit Testing
  20. Integration Testing
  21. GUI
  22. Window
  23. Jpanel

Create a two-dimensional array with length 5 and height 7. Write a for loop to print out each element in the array. (Don’t worry about populating the array, just make sure that you initialize it!) What is the difference between arrays and Vectors? Create a Vector called statResults that contains 50 elements. Write a method that accepts a vector as a parameter.String objects. Print out the contents of the Vector. Assume the vector contains

What must you do when you get an element out of an array? Assume in the code below that Vector vec has been initialized and contains Card objects. You want to retrieve the first Card object in the Vector vec. What goes in the blank below? Card c = __________ vec.get(0); Part 3: File I/O and String Manipulations What class(es) are used to read text from a file one character at a time? What class(es) are used to write text to a file one character at a time? What class(es) are used to read binary data from a file one byte at a time? What class(es) are used to write binary data to a file one byte at a time? What class(es) are used to read text data from a file one line at a time? What class(es) are used to write text data to a file one line at a time? What method is used to close file readers, file writers, and files? Assume you have a file called zoo.txt. Write a method, which opens the file zoo.txt. You will want to read each line of the file until you reach the end of file. Each line in the file will contain either Z or O. Maintain a count of the number of times you find Z and the number of times you find O. Write a method which opens a file, out.txt, for writing. Write your name and lab section to the file. Write a method which accepts a String as a parameter. Tokenize the String, using StringTokenizer, using white-space as the delimiter (Hint: white-space isthe default delimiter). Write a loop to print out each token.

Write a method which accepts a String as a parameter. Tokenize the String, using StringTokenizer, using white-space as the delimiter (Hint: white-space is the default delimiter). Return the count of the tokens in the string. Write a method which accepts a String as a parameter. Tokenize the String, using StringTokenizer, using | as the delimiter (Hint: white-space is the default delimiter). Write a loop to print out each token. What are the methods that StringTokenizer has? What does each one do? What is a String method that we can use to split a line up using regular expressions? What is the regular expression that represents white space? Part 4: Objects and Partially Filled Arrays (20 points) There are 10 blanks to fill in at 2 points each. I would suggest that you look at the SongCollection example and the CSC116Section002 in-class exercise solution. Create a class called VideoStore.objects as an instance variable. This will be a partially filled array so you will need toThe VideoStore class will contain an array of Movie create a count object to maintain the number of Movies that are in the collection. Write a Constructor for your VideoStore class. Initialize you movie array to contain 100 movies. Initialize your count to 0. Write a method which accepts a Movie object as a parameter. Add the movie to the array and increment the counter. Write a main method.Create a Movie object. Add the Movie object to the VideoStore. The main method will declare and initialize a VideoStore object.

Part 5: GUIs (10 points) Know the different GUI objects and how to recognize them. What class must you extend when you create a GUI? What method must you override when you implement ActionListener (Hint: This is a method where you check to see what button has been pressed in all of your programs) Part 6: Extra Credit (5 points) What method do you use to refresh an Applet? Count the number of times a loop executes.