28 Questions
Which method in the Student class is used to retrieve the gender of a student?
getGender()
What is the purpose of the setID method that takes a String as a parameter?
It converts the String parameter to an int and sets the ID.
If you wanted to change the name of a Student object, which method would you use?
setName(String n)
Which method would you use to get the course of a Student object?
getCourse()
What will happen if you call setID(555) on a Student object?
It will update the ID directly to 555.
If you wanted to obtain the year of a Student object, which method should be used?
getYr()
Which type of classes are suggested for reading and writing data other than text?
Classes descended from InputStream and OutputStream
What characteristic is advised when choosing a writer class for sending data?
Auto flush option
Which of the following is a sample class that can be used for reading data?
BufferedReader
What should you explore to find a full list of Java classes for reading and writing data?
Java API documentation
Why is it advised to choose buffered classes for reading and writing?
To improve performance by reducing I/O operations
In the provided code snippet, what is the purpose of the 'streamWtr.println(input);' statement?
Sending client input to the server
What does the 'streamRdr.readLine()' method in the code snippet do?
Reads a line of text from the server
Which Java class is used for reading input in the provided code snippet?
Scanner
What will be printed by the line 'System.out.println(streamRdr.readLine());' in the code snippet?
'You can vote'
In the context of the code snippet, what is the purpose of the 'try' block?
Handling exceptions
What is the purpose of using the Comparator in the provided server program?
To establish the basis of sorting for a list of students
Which method is used to compare two Student objects in the provided server program?
compare(Student s1, Student s2)
What type of list is being sorted in the provided server program?
ArrayList
In the provided server program, what happens inside the try block?
Reading data from the client and processing it
What port number is the ServerSocket initialized with in the provided server program?
1234
What is the role of ObjectOutputStream in the provided server program?
Writing the result of processing to the client
What is required for the list of student objects to be written into a file according to the text?
The objects must implement the Serializable interface
What is the consequence of not having the objects implement the Serializable interface?
The list of objects cannot be written into a file
Which method is used for converting a file containing student information into a list of student objects?
Deserialization method
What is the purpose of tagging or marking interfaces like the Serializable interface?
To mark classes so that specific actions can be taken at runtime
Why is it important for both client and server programs to be running before attempting to connect according to the text?
To ensure the correct outcome of the program
In the context of the program described, what is the purpose of using an object stream in the client program?
To serialize and write student objects into a file
This quiz covers topics related to a copyright notice for document usage and ensuring client-server program functionality by running both programs successfully before establishing a connection.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free