0% found this document useful (0 votes)
63 views

Advance Java Unit 4 MCQ

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Advance Java Unit 4 MCQ

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Advance Java Programming

Unit 4

1. What is the RMI server responsible for?


a) Exporting remote object
b) Creating an instance of the remote object

c) Binding an instance of the remote object to the RMI registry


d) All of the above (Correct)

Explanation:D) The RMI server is responsible for all these tasks—exporting the remote object,
creating instances of it, and binding it to the RMI registry to make it available for clients to call
methods remotely.

2. Identify the Microsoft solution for providing dynamic web content:


a) ASP
b) JSP
c) Both A and B
d) None of the above
Explanation: A)ASP (Active Server Pages) is Microsoft's solution for creating dynamic web pages.

3. In which file is database table configuration stored?


a) .sql
b) .ora
c) .hbm
d) .dbm
Explanation: :C ) Database table configuration file is stored in .hbm

4. RMI stands for:


a) Remote Memory Interface
b) Remote Method Invocation
c) Random Method Invocation
d) None of the above
Explanation: : B) RMI stands for Remote Method Invocation.
5. TCP, FTP, SMTP, Telnet are examples of:
a) IP address
b) Protocol (Correct)
c) Socket
d) MAC address
Explanation: B) TCP FTP Telnet, SMTP are examples of protocols.

6. The total JDBC product components in Java software ……...


a) 1
b) 2
c) 3
d) 4
Explanation: C) The total JDBC product components in Java software provides is 3
7. The total number of techniques used in session tracking is …...
a) 1
b) 2
c) 3
d) 4
Explanation: D) Total 4 techniques used in session tracking.
8. Total JDBC drivers available are …...

a) 1
b) 7
c) 6
d) 4
Explanation: D) Total JDBC drivers available is 4.
9.Total TCP/IP ports reserved for specific protocols is …….
a) 1024
b) 2048
c) 512
d) 32
Explanation: A) Total TCP/IP ports reserved for specific protocol is 1024.

10. The major components of JDBC are:


a) DriverManager

b) Connection

c) Statement
d) ResultSet

Explanation: A)The major components of JDBC are - DriverManager

11. What decides the priority of the thread?


a) Thread
b) Process scheduler
c) Process
d) Thread scheduler
Explanation: D) Thread scheduler will decide the priority of the thread.

12. What is built on top of socket programming?


a) RMI
b) EJB
c) Both A and B
d) None of the above
Explanation:A) RMI is built on top of socket programming

13. What is the difference between servlet and JSP?


a) Compilation
b) Translation
c) Syntax
d) Both A and B
Explanation:C) The major difference between servlet and JSP is syntax.

14. Identify the method which is used to start a server thread.


a) start thread()
b) run()
c) runthread()
d) start()
Explanation: B)run() is used to start a server thread.
15. What is the total number of bits in a single IP address?
a) 4
b) 8
c) 16
d) 32
Explanation: D)The total number of bits in a single IP address is 32.

16. What is the total number of ResultSet available with the JDBC 2.0 core API?
a) 2
b) 3
c) 4
d) 5
Explanation: B) The total number of ResultSet available with the JDBC 2.0 core API is 3.

17. Where can BLOB, CLOB, ARRAY, and REF type columns be updated?
a) JDBC 1.0
b) JDBC 2.0

c) JDBC 3.0
d) JDBC 4.0

Explanation: C) BLOB, CLOB, ARRAY, and REF type columns be updated in JDBC 3.0

18. Which driver is known as the thin driver in JDBC?


a) Type 1 driver
b) Type 2 driver

c) Type 3 driver
d) Type 4 driver

Explanation: D) Type 4 driver is known as the thin driver in JDBC.

19. Which is responsible for getting a connection to the database?


a) Connection
b) Statement

c) ResultSet
d) Driver

Explanation: D) Driver is responsible for getting a connection to the database.

20. Which of the following are examples of application servers?


a) JBoss

b) Tomcat

c) Apache
d) WebLogic

Explanation: A) JBoss is an example of an application server

21. Which of the following option leads to the portability and security of Java?
a) Dynamic binding between objects
b) Use of exception handling

c) Bytecode is executed by JVM


d) The applet makes the Java code secure and portable

Explanation:: C) Bytecode is executed by JVM is the correct answer

22. Which of the following requires fewer resources?


a) Process
b) Thread

c) Both Thread and Process


d) Neither thread nor process

Explanation:: B) Thread requires fewer resources.

23. Which of the following tags does the JSP page contain?
a) JSP tags
b) HTML tags

c) Both A and C
d) None of the above

Explanation: : C) JSP page contains both JSP tags and HTML tags.

24. Which of the following ways is used to communicate from an applet to servlet?
a) HTTP communication
b) Socket communication

c) RMI communication
d) All of the above

Explanation: D) All of the above is used to communicate from an applet to the servlet.

25. Which tag is used to execute Java source code in JSP?


a) Expression tag
b) Scriptlet tag

c) Declaration tag
d) None of the above

Explanation: B) Scriptlet tag is used to execute Java source code in JSP.

26. Choose whether true or false: JDBC is a Java API that is used to connect and execute
queries to the database.
a) True

b) False

Explanation: A) The above statement is true.

27. Among the following, identify the packages which represent interfaces and classes for the
servlet API.
a) javax.servlet.http
b) javax.servlet

c) Both A and B
d) None of the above

Explanation: C) Both a and b are correct.

28. Among the following methods, which of the following returns a proxy object?
a) getDatabase()
b) get()

c) load()
d) loadDatabase()

Explanation: C) load() Is the method that returns a proxy object.


29. Among the following options, choose the one which shows the advantage of using the JDBC
connection pool:
a) Using less memory
b) Better performance

c) Slower performance
d) Using more memory

Explanation: B) The advantage of using a JDBC connection pool is better performance.

30. Among the following protocols are used for splitting and sending packets to an address
across a network:
a) SMTP
b) TCP/IP

c) UDP
d) FTP

Explanation: B) TCP/IP .is used for splitting and sending packets to an address across a network.

31. Among the following, which attribute is used to specify the class name of the bean:
a) id
b) class

c) name
d) constructor-args

Explanation: B) class is used to specify the class name of the pin.

32: Among the following which contains date information?


a) java.sql.timestamp

b) java.io.time

c) java.io.timestamp
d) java.sql.time

Explanation: A) java.sql timestamp contains date information.

33: What is the purpose of the finally block in a Java try-catch-finally construct?
a) To catch and handle exceptions thrown in the try block
b) To execute code regardless of whether an exception is thrown or not

c) To define the conditions for handling exceptions


d) To provide an alternate code path when an exception occurs

Explanation: B) To execute code regardless of whether an exception is thrown or not.

34: Which of the following access modifiers provides the widest scope of visibility for a class
member in Java?
a) private
b) protected

c) default
d) public

Explanation: D) public

35: Among the following which is a type of multitasking?


a) Thread based
b) Process-based

c) Both A and B
d) None of the above

Explanation: C) Both A and B are types of multitasking

36: Among the following which is not a directive?


a) Page
b) Include

c) Tag
d) Export

Explanation: D) Export is not the directive

37: Among the following which method is used to know the host of an URL?
a) findhost()
b) gethost()

c) locatehost()
d) host()

Explanation: B) gethost() is used to know the host of an URL.


38: Choose the instance variable of class httpd among the following.
a) Cache
b) Port

c) Log
d) All of the above

Explanation: D) All of the above are instances variable of class httpd.

39: Total ways to perform exception handling in JSP is


a) 2

b) 3

c) 4
d) 5

Explanation: A) There are 2 Ways to perform exception handling in JSP.

40: Choose whether true or false: The JDBC API is what allows access to a data source from a
Java middle tier.
a) True

b) False

Explanation: A)The above statement is true.

41: Choose whether true or false: The ResultSet.next method is used to move to the next row of
the ResultSet, making the current row
a) True

b) False

Explanation: A)The above statement is true.

42: Choose whether true or false: The web server is used for loading the init() method of the
servlet.
a) True

b) False

Explanation:A) The above statement is true.


43: For resolving Facelet views, which of the following is configured?
a) View_Resolver
b) View-resolver

c) ViewResolver
d) View Facelets

Explanation: C) ViewResolver is configured for resolving Facelet views.

44: Full form of JDBC is


a) Java database Communications
b) Java database concept

c) Java database connectivity


d) None of the above

Explanation: C) JDBC stands for Java database connectivity

45: How constructor can be used for a servlet?


a) Initialization and Constructor function

b) Setup() method

c) Initialization
d) Constructor function

Explanation: A) Constructor can be used for a servlet by Initialization and a Constructor function.

46: Identify among the following which follows the connectionless service.
a) HTTP
b) TCP/IP

c) TCP
d) UDP

Explanation: D) UDP follows the connectionless service.

47: Identify the class used for connection-less socket programming.


a) Datagram packet
b) Datagram socket

c) Both A and B
d) None of the above

Explanation:C) Both datagram packet and datagram socket is used for connection-less socket
programming

48: Identify the HTTP request method which is non-idempotent.


a) POST
b) GET

c) Both A and B
d) None of the above

Explanation: C) Both POST and GET are non-idempotent.

49: Identify the method of the JDBC process among the following options.
a) remove()
b) deletebatch()

c) setbatch()
d) addbatch()

Explanation: D) addbatch() Is the method of JDBC.

50: Identify the method which is used to find the URL from the cache of httpd.
a) getfromcache()
b) findfromcache()

c) findcache()
d) servefromcache()

Explanation: D) servefromcache() is used to find the URL from the cache of httpd.

You might also like