Download Midterm Exam - Software Engineering 2001 | SWE 642 and more Exams Software Engineering in PDF only on Docsity!
George Mason University Information and Software Engineering
SWE 642 Software Engineering on World Wide Web Y. Wu Fall 2001 Mid Term Exam October 18, 2001
This exam is closed book and notes. Be sure to print your name on the test. Allocate your time according to the points assigned for each question. Please show all work on the test.
You MUST put all answers to questions on this page. Answer question 2 and 3 on the pages provided; please answer on this paper if you can. If I cannot read your answer, I will mark it wrong.
You have until 6:00pm.
Question 1 a
PROBLEM ANSWER PROBLEM ANSWER PROBLEM ANSWER
Question 2 a
Question 3 a
NAME (please print):
Question 1 (60 points, 2 points each) For each question, select the only one correct answer from A,B,C,D and E. If you choose 2 and more choices, the question will be considered as wrong.
- Which of the following quality attribute has LEAST effects on users’ “site loyalty”?
A) Reliability B) Usability C) Security D) Availability E) Efficiency
- Which of the following statements about cookie are true? I. A small piece of textual information sent by the server to the client, stored on the client. II. A file that may spread virus. III. Sent back to the server every time the page loads.
A) I B) II C) III D) I and III E) All of the above
Which of the following statements about the URL http://hermes.gmu.edu:8080/fall64201/servlet/HelloWorld are true? I. To locate HelloWorld, the web container has to go to a directory called fall64201/servlet on hermes.gmu.edu. II. If there is no file called HelloWorld.html or HelloWorld.htm under the corresponding directory, the web server will return an error message. III. fall64201/servlet/HelloWorld is the URL path, and the web container will try to load the index.html under that directory. A) I B) II C) III D) None of the above E) All of the above
Given the section of HTML file below, what will be the layout of the table?
… … … … … …
A)
D)
B)
E)
C)
- If appears in your index.html file, what will happen when someone visit your homepage? A) After 10 minutes, the ISE homepage will automatically load. B) After 10 seconds, the ISE homepage will automatically load. C) When click refresh button on the web browser, the ISE homepage will appear.
- Which of the following statements about traditional CGI are true? I. Each request will initiate a new process II. Can not maintain user states even with the help of HTML III. CGI can be implemented through many different languages, such as perl, c, c++, the limitations of those languages will reduce the portability of the web applications.
A) I B) II C) Both I and II D) Both I and III E)All of the above
- Compared with 2-tier model, which of the following statements about 3-tier model are true: I. Has less net-work traffic II. More reliable III. Efficient data access
A) I B) II C) Both I and II D) Both II and III E)All of the above
- How many of the following statements about GET and POST are true: I. GET requests put form data on the URL as parameters. II. POST can carry more data then GET. III. The user can specify which method to use when specifying URL directly in a web browser. IV. When retrieving data from the server, you can use either method. A) 0 B) 1 C) 2 D) 3 E)
- Which of the following statements about serialization are true? I. Prevent conflict in a concurrent situation II. All objects can be serialized III. To serialize an object, the class has to extend from a serializable class. A) I B) II C) III D) I and II E)None of the above
- When utilize java reflection in a web application, which of the following is true: A) Java reflection can provide dynamic server information, such as server name and etc. B) Java reflection can provide dynamic client information, such as client user name and etc. C) Both A) and B) D) Java reflection can parameterize server configuration. E) Java reflection can optimize server execution, and improve the efficiency.
- What are the benefits of saving JavaScript program in a different file? I. More efficient II. Program reuse III. More maintainable IV. Better program structure A) I and II B)II and IV C) III and IV D) II, III and IV E)All of the above
- What can we do with CSS? A) Separate content from presentation B) Appearance control C) HTML file validate D) Both A) and B) E) All of the above
- Compared with the first type of JDBC driver(JDBC-ODBC bridge), how many of the following statements about type 4 JDBC driver is true: I. More efficient II. More portable III. More Powerful IV. Platform independent A) 0 B) 1 C) 2 D) 3 E)
- In JDBC, Preparedstatment is more efficient than Statement in which of the following scenarios? A) Many SQL statements will be sent to database server B) Many SQL statements with similar parameters will be sent to database server C) Transaction support is needed D) Database server is overloaded E) None of the above
- Which of the following is NOT true about web container? A) With web containers, web applications are more portable B) Web container will manage the lifecycle of a web application C) Web container can process requests more efficiently D) Web applications with the support of web container are easier to build. E) None of the above
- Servlet container can manage the concurrent requests via instance pooling, request serialization or both, in order to utilize these functionalities, A) Your servlets have to implement SingleThreadModel interface B) All of the methods in your servlet have to defined as synchronized C) Synchronizing only the statements that might interfere with each other D) Your servlets have to implement Serializable interface E) None of the above
- A servlet can be invoked by A) Another servlet or JSP page B) A form in a HTML file C) A user request from a web browser D) Both A) and B) E) All of the above
- We can use setAttribute and getAttribute methods to bind information with requests, sessions, or contexts. Which of the following statements is true: A) We can use sessions’ setAttribute, getAttribute methods, together with other APIs to substitute the functionalities of requests’ setAttribute and getAttribute methods. B) We can use contexts’ setAttribute, getAttribute methods, together with other APIs to substitute the functionalities of sessions’ setAttribute and getAttribute methods. C) We can use sessions’ setAttribute, getAttribute methods, together with other APIs to substitute the functionalities of context’ setAttribute and getAttribute methods. D) We can use requests’ setAttribute, getAttribute methods, together with other APIs to substitute the functionalities of sessions’ setAttribute and getAttribute methods. E) None of the above
- Which of the following is NOT suitable to be initialized in the init() method of a servlet.
A) Database Driver B) Database Connection C) Connection Pool D) Logging service E) Parameters associated with the applications
Question 2: (30 points, 6 points each) Answer the following question based on the program provided on the last page.
A) How do you invoke the function validate which is provided in the code to perform the input data validation before submit to the server?
B) Carefully analyze the code, and indicate what are the potential problems with the program.
C) Provide the code that will verify whether the table user contains a record that the ID and password fields match the given value.
Question 3 (10 points) The following code tries to perform a transaction which includes two SQL statements, add necessary code into the follow servlet that will make sure the integrity of the database. In addition, add necessary code to show user error messages when the transaction cannot be successfully processed. The error message is included in an html file called error.html , it locates at the root directory of the context where the servlet sits.
public class Process extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
Class.forName("org.gjt.mm.mysql.Driver"); Connection conn=DriverManager.getConnection( "jdbc:mysql://localhost/swe64201","swe64201","swe64201"); Statement statement = conn.createStatement();
Statement.executeUpdate(“update ……”);
Statement.executeUpdate(“update ……”);
ID: PASS:
public class Hello extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String name = req.getParameter(“NAME”); String password = req.getParameter(“PASSWORD”); Class.forName("org.gjt.mm.mysql.Driver"); Connection conn=DriverManager.getConnection( "jdbc:mysql://localhost/swe64201","swe64201","swe64201"); Statement statement = conn.createStatement();