Answer ADJ
Answer ADJ
Answer ADJ
SHREEYASHCOLLEGEOFENGINEERING&TECHNOLOGY(POLYTECHNIC), CHH.
SAMBHAJINAGAR
AcademicYear:- 2024-25
MSBTEClassTest-II
Program Name: Computer Engineering Program Group
Program Code: CO
Semester: Fifth
CourseTitle: Advanced Java Programming CourseCode:- 22517
MaxMarks: - 20 Time:- 1Hour
Instructions: -
1) Squarebracketindicatescourseoutcomes.
2) AllQuestionsareCompulsory.
3) Assumesuitabledata,if necessary.
Bloo
Course
Que.No. Questions ms
Outcome Level
1 What does TCP stand for? 22517.4 L1
a) Transmission Control Protocol b) Transfer Control Protocol
c)TransmissionConnectionProtocol d)TransferConnectionProtocol
2 Which of the following code snippets correctly creates a client socket 22517.4 L2
connected to localhost on port 8080?
a) Socket socket = new Socket("localhost", 80);
b) Socket socket = new ServerSocket("localhost", 8080);
c) Socket socket = new Socket("localhost", 8080);
d) ServerSocket socket = new Socket("localhost", 8080);
3 Which of the following code snippets establishes a JDBC connection? 22517.5 L3
Connection conn =
DriverManager.________("jdbc:mysql://localhost:3306/test", "user", "pass");
a) createConnection() b) getConnection()
c) openConnection() d) connect()
4 What protocol is typically used for connection less communication? 22517.4 L1
a) HTTP b) TCP c) UDP d) FTP
5 What is a servlet? 22517.6 L1
a)A client-side program b)A server-side program that handles requests and
responses c) A database connector d) A web browser component
6 Which method is called when a servlet is first loaded into memory? 22517.6 L1
a)doGet() b)init() c)service() d)destroy()
7 What object is used to read data sent by the client in a servlet? 22517.6 L2
a)HttpResponse b)HttpRequest c)ServletResponse d) ServletRequest
8 Which method is used to send a response back to the client? 22517.5 L2
a)sendResponse() b)writeResponse() c)printWriter() d)outputResponse()
9 Which method of ResultSet is used to retrieve data from a column named 22517.5 L2
"name" of type String?
a) getString("name") b) getData("name")
c) getColumn("name") d) retrieve("name")
10 How do you close a JDBC connection? 22517.5 L2
a)connection.end() b) connection.close()
c)connection.disconnect() d) connection.terminate()
11 Which method is used to retrieve metadata from a database? 22517.5 L2
a)getDatabaseMetaData() b)fetchMetaData()
c)retrieveMetaData() d)collectMetaData()
12 What type of JDBC driver is the JDBC-ODBC Bridge? 22517.5 L1
a)Type1 b) Type2 c)Type3 d)Type4
13 Which method in HttpServletResponse is used to send a redirect response? 22517.6 L2
a) sendRedirect() b) setRedirect() c) sendResponse() d) redirect()
14 What is the purpose of the commit() method in JDBC? 22517.5 L2
a)To cancel a transaction b) To finalize changes made in a transaction
c)To retrieve data from a database d)To open a connection
15 Which layer of the OSI model is responsible for data encryption? 22517.4 L2
a)Application Layer b)Presentation Layer
c)Session Layer d) Transport Layer
16 What is the purpose of the doGet()method in a servlet? 22517.5 L2
a)To handle POST requests b)To handle GET requests
c)To initialize the servlet d)To destroy the servlet
17 Which annotation is used to declare a servlet in the latest Java E versions? 22517.5 L3
a)@WebServlet b)@Servlet c)@HttpServlet d)@ServletMapping
18 Which of the following code snippets would correctly execute an SQL 22517.5 L3
SELECT query?
Statement stmt = conn.createStatement();
ResultSet rs = stmt.________("SELECT * FROM employees");
a) executeUpdate() b) executeQuery()
c) execute() d) runQuery()
19 In the following code, which method is used to close a client socket? 22517.4 L2
Socket socket = new Socket("localhost", 8080);
socket.________();
a) disconnect() b) shutdown() c) close() d) terminate()
20 Which port is commonly used for HTTPS? 22517.4 L1
a) 21 b) 80 c) 443 d) 110