Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CS 441 MIDTERM EXAMINATION SPRING 2009 NAME (IN CAPS) : ______________________ STUDENT ID : ______________________ SECTION : ______________________ DATE : ______________________ Notes: Please use the answer sheet provided at the end of this document. Mark the answer clearly, if it is not readable or if duplicate answers are given you will loose points. The exam is worth 15 points. Each question is worth 0.5 points. There are 30 questions. Topics are dispersed throughout the test and are not grouped as far as the order of questions is concerned. This examination is to be administered on March 9, 2009 during the scheduled class time (lasts 1 hour and 15 minutes maximum). ANSWERS SHOULD BE IN THE ANSWER SHEET AT THE END!!!!!!!!!!!!!!!!!! Choose the answer that makes the MOST sense. THIS TEST IS CLOSED BOOK AND CLOSED NOTES 1. Interface Definition Language (IDL) is used automatically by the RMI over IIOP framework to convert: a) The data types used by one language into remote objects that can be invoked by a client in the system. b) Java Language objects to another language’s objects thus standardizing all programming languages into one standard language. c) The data types of the requestor (client) of a remote service into standard data types (IDL). The receiver of the request converts the standard data types (IDL) back into its own language’s data types. d) The networking transport protocol of the client into a standard protocol called IIOP that the server can understand . 1 2. RMI Framework provides for automatic serialization of objects in RMI and RMI over IIOP by using SUN’s serialization algorithm unless the developer develops his/her own serialization mechanism called externalization. Answer true or false in answer sheet. 3. In RMI Framework the implementation of the networking functionality on the server side is done: a) By extending the implementation class to UnicastRemoteObject class. b) By extending the implementation class to Server class, instantiating an object “server” and use it like: server.accept () ; c) By having the programmer create the proper input and output streams to connect to the client. d) By extending the ServerClient class and creating the proper listener socket. 4. In deciding if servlets or JSP will be used for the generation of dynamically produced html we choose servlets if most of the code to be produced is HTML whereas we chooses JSP if very little of the code to be produced is HTML and the majority is Java. True or False? 5. When the Web Server receives a request from a client to execute a servlet the following sequence of events takes place: a) Web Server -> request object-> doPost servlet is discovered -> myservlet.class execution takes place->the container senses the end of execution and sends a message to the client that execution was accomplished. b) Web Server reads the HTTP request and uses its servlet container (engine) to activate the servlet’s service method which in turn activates the proper doPost or doGet method of the servlet based on the Http request’s specified method. c) Web Server activates the servlet, then it interrogates the servlet as to which method it has, either doPost or doGet, it then notifies its servlet engine to activate the proper service method of the servlet. d) WebServer-> servlet engine-> response to client as to which is the proper method to call-> client adjusts request to be either doGet or doPost ->WebServer-servlet execution. 6. The servlet’s Session object can be used to track a client’s session. In implementing session: a) You can have the Web Server worry about tracking the session without providing any programming instructions in the servlet. The 2 Web Server will store the proper data into a session object automatically. b) The WebServer automatically sends the servlet its session id number and the client includes that number in every request without any additional code since the Browser does that automatically.. c) All the programmer needs to do is to instantiate a session object when the servlet is first executed. The web Server does the rest. d) One possible implementation is to have the servlet create a session object the first time a client sends a request. The web server issues a session id for that client’s session object. The web server is responsible for keeping track of the session object’ s lifetime and maintaining the id number for requests coming from the same client. As long as the session object is kept alive for a specific client, the servlet can interrogate the session object for the id number and associate that number with particular requests, thus differentiating the requests from different clients. Specific data values can be stored as objects in the session object. 7. When an applet communicates with a servlet via GET, the applet can send the data as follows: Create a url and append the data after the servlet’s name and after the symbol ? in a name/value pair format for each parameter where the parameters are separated by &. b) Create a byte stream that is connected to the server where the servlet resides and a byte array with the data. Write the byte array on the stream. c) Can not send a GET. A Get type of request can only be sent by html forms where the action attribute points to the servlet. d) Create a url and have the url point to the servlet. After that send the url via a connection object to the servlet. Send data by writing on the proper stream but only primitive data types and Strings can be written on the stream. a) 8. A servelt communicates with the servlet engine in the web server via: a) A doPost or doGet default implementation that exists in the servlet engine. b) A Http protocol. c) A IIOP protocol. d) A request and a response object of the HttpServletRequest and HttpServletResponse classes respectively in the form of streams. 9. A servlet wants to communicate with another servlet: a) It can create an instance of the class of that other servlet and use the object to invoke the doGet or doPost method of servlet. 3 b) It can use the name of the class of the second servlet to invoke the doGet or doPost method of that serlet. c) It can call the method invokeServlet(String name_of_servlet) d) It can create a Dispatcher object and use it to pass to the other object the request or response objects in either include or forward manner. 10. The web server Tomcat uses the web.xml deployment descriptor. The descriptor is found in Tomcat‘s directory: a) b) c) d) RootContext/WEB-INF/ RootContext/WEB_INF/classes RootContext/ RootContext/WEB-INF/lib/ 11. GridBagLayout manager is used to create a GUI. There are 3 components placed horizontally with preferred widths : 100, 200, 200 pixels each. The third component is placed in gridx=60. The first component has gridwidth=20. How many columns is the total width of the GUI (assuming equal size for each column)? 12. Java Server Pages uses delimiters such as <% and % > to: a) include html code that gets interpreted by the Web server. b) include declarations of Java types only . c) include java code that the jsp engine in the Web Server converts to a servlet. d) include java code that the jsp engine in the Web Server converts directly to html code. 13. Bob wants to send a message to Alice. He creates a message digest and encrypts it with a secret key. Alice receives the digest and the encrypted message. She in turn decrypts the message with the same secret key and matches it to the digest sent. This communication: a) Is incomplete because Bob should had sent the original message together with the encrypted message and not the digest. b) Is complete, all Alice has to do is to compare the two digests after decryption. If they are equal then she can fully trust the message. c) Is called symmetric encryption and it is a safe way for Alice to trust the digest came from Bob. d) Is incomplete because Bob should had used a different key than Alice to encrypt the digest. 4 14. In digital signatures, Mary uses her private key to encrypt a message. Anybody who has Mary’s public key can decrypt the message, True or False? 15. In the Jakarta Tomcat Web Server the web.xml file associated with your root content has: a) The information about the client’ s IP address . b) The tag <servlet name> that identifies your servlet’ s class name or its alias name. c) The information about the protocol to be used to communicate with the client. d) The tag <servlet engine> that identifies the name and the type of the servlet engine used by the Web Server. 16. To create a simple trusted applet application you can issue a certificate. The certificate is: a) Normally sent by the creator of the code to anybody who wants to use it. That person has to store it in a keystore that he or she generates. b) Normally sent by a Certificate Authority and stored in keystore cacerts. c) Normally sent by a Certificate Authority and stored in the Browser. d) Normally stored by the creator in a keystore at the server side where the applet is located. It goes to the Browser automatically every time the applet is called and it is read by the Browser. The Browser then decides what resources to allocate to the applet. 17. We can implement a menu view in a JFrame by: a) Overriding the method actionPerformed of the ActionListener interface and instantiating a MenuBar object inside the method. b) Overriding the method actionPerformed of the EventListener interface and then we instantiate an object of the JMenu class inside the actionPerformed method. c) By creating a MenuBar object then a Menu object and then MenuItem objects. We add the MenuItem objects to the Menu object and the Menu object to the MenuBar object. d) We create MenuBar objects that get added to MenuItem objects which in turn get added to a Menu object. 5 18. An applet and a servlet get executed on the server side as opposed to a JSP program that gets executed on the client side. Answer True or False in the answering sheet. 19. In asymmetric encryption: a) The sender and the receiver use the same secret key. b) The sender and the receiver use two different public keys. c) The sender and the receiver use two different secret keys d) The sender and the receiver use two different hash functions to create two different hashed messages. 20. In 3 tier architecture the presentation layer can be handled by Java Faces. True or False. 21. In a revised 3 tier architecture where Enterprise Java Beans (EJBs) are used the business logic is handled by: a) By EJBs that reside in an Application Server like Tomcat. b) By EJBs that reside in an Application Server like Java Server. c) By Servlets or EJBs that reside in an Application Server like Java Server. d) By Servlets or EJBs that reside in Tomcat 22. In the same architecture as in question 21, the web tier can be handled by: a) A combination of servlets, jsp and html resources. b) A combination of servlet and EJB resources. c) A combination of applets, servlets and EJB resources. d) A combination of servlets , RMI servers and EJBs 23. A web tier server needs to have the RMI container. True or false? 24. The JDBC API provides a number of database drivers. Drivers are needed: a) In order to allow communication between a client application like an applet and a server application like a servlet. b) In order to allow communication between SQL statements and Java code. c) In order to allow communication between a servlet and a EJB component. d) In order to allow communication between the client of a Database and the Database due to disparity in SQL constructs between databases. 25. In using Prepared Statements 6 a) Parameters can be passed to the query in a compiled form (runtime). b) Parameters can be passed to the query but the query has to reside in the database server and be ready for execution. c) Parameters can be passes to the Java program and then to the query. The Java program will create the query, compile itself, and execute itself. d) The Prepared Statement is a query where Java code has been embedded in it. It does not need to be compiled every time we use it. 26. The ResultSet object returned after the execution of a query needs to be: a) Type casted to a ResultMetaData object in order to find out the type of data. b) Read row by row in order to recover the data returned by the database by invoking the method getData();. c) Invoking the method getColumnCount() in order to find out the number of columns in each row. d) Invoking the method next() until the invocation returns false, in order to find out the number of rows in the data. 27. Stored Procedures are: a) SQL statements that are stored in a database server and they are in an executable form ready to be called by a client process to execute a query on the database. b) General term for any programs stored in any server. c) Use the interface Call. d) Use the interface CallStatement. 28. ResultSet objects have attributes that can accommodate concurrency issues. Setting it to TYPE_SCROLL_INCENSITIVE: a) Prevents the ResultSet object from being able to invoke next() (cursor will not move);\ b) Prevents the ResultSet object from acquiring any data that has been changed. c) The cursor is scrollable and the data is not sensitive to changes made concurrently. d) The cursor is scrollable and it is sensitive to changes made concurrently. 29. The paint method is a method a) That gets called every time there is action due to an event. b) That can be re called by a call to repaint method. 7 c) That can be called only when the container is first constructed. d) That can not be overridden. 30. Every container needs a Layout Manager to have components placed in it. The GridBagLayout Manager uses constraints such as: a) widthpixels, heightpixels to define the width and height allocated to a component in terms of pixels. b) gridwidth and gridheight to define the width in pixels and the height in pixels. c) gridx and gridy in pixels. d) gridwidth and gridheight in terms of the number of columns and rows respectively. 8 ANSWER SHEETS NAME:_________________________________ 1. _______c___________________________ 2. _______True_____________________________ 3. __________a_________________________ 4. ____________False________________________ 5. _____________b_______________________ 6. _____________d_______________________ 7. _____________a________________________ 8. _____________d________________________ 9. ______________d_________________________ 10. ______________a_____________________________ 11. ______________100_________________________ 12. _______________c__________________________ 13. _______________a__________________________ 14. _______________True________________________ 15. _________________b_______________________ 16. _________________b_________________________ 17. __________________c_____________________ 18. _________________False________________________ 19. _________________c______________________________ 20. ___________________True______________________________ 9 21. _____________________c_____________________________ 22. ______________________a____________________________ 23. ______________________False_______________________________ 24. ______________________d_____________________________ 25. ______________________a_______________________________ 26. ______________________d_______________________ 27. _______________________a_____________________________ 28. _________________________c_______________________________ 29. ________________________b_________________________________ 30. _________________________d_________________________________ 10