



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Introduction to Computing - Java; Subject: Computer Science; University: North Carolina State University; Term: Spring 2005;
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




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