Advance Java MCQ
Java, originally evolved from the Oak language, was born in early 1996 with its major version as Java 1 or JDK 1.0. Java was initially designed and developed by Sir James Gosling at Sun Microsystems. Java 8 or JDK 8.0 is one of the major releases of the Java programming language in 2014.
Java is divided into two parts
- Core Java(J3SE)
- Advanced Java(JEE)
The Core Java consists of all the fundamentals of Java programming language such as data types, functions, loops, threads, etc.
Why is Advanced Java used?
- Advance java simplifies the complexity of building an n-tier application.
- JEE application server and containers provide Framework services.
Advantages
- It provides the concept of client-server architecture.
- There are many Advanced Java frameworks such as spring Hibernate states that helped secure transaction-based web applications.
- There are many web application servers such as Apache Tomcat and glassfish
- it provides various services of API and protocols
AWT
- AWT stands for abstract window Toolkit.
- It is a collection of classes and interfaces
- AWTpackage contains a large number of classes which help to include various graphical components in the Java program
- it provides a platform Independent and device-independent interface to develop graphic programs that run on all platforms including Windows, Mac OS, and Unix.
Servlet
Servlets in Java programs that run on the java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request and produce the response and then send the response back to the server.
Properties of Servlet
- It works on the server-side
- It is capable of handling Complex requests obtained from a webserver
- It came to solve the problem due to common Gateway interface implementation
Types of servlets
- Generic servlet
- HTTP servlet
JSP
JSP is used to create web applications but it is an extension to servlet because it provides more functionality than servlet such as expression language, JSTL.
- A JSP page consists of HTML tags and JSP tags.
- It is easier to maintain
- More functionality is available in JSP
- Fast development
The life cycle of a JSP
- Translation
- Compilation
- Classloading
- Instance creation
- Initialization
- Request processing
- Destroy
MVC
MVC stands for model view and controller. It is a design pattern that separates the business logic presentation logic and data.
Advance Java MCQs
What is the RMI server responsible for?
Exporting remote object
Creating an instance of the remote of
Binding an instance of the remote object building to the RMI registry.
All of the above
Identify the Microsoft solution for providing dynamic web content.
ASP
JSP
Both A and B
None of the above
In which file database table configuration is stored?
.sql
.ora
.hbm
.dbm
RMI stands for __________
Remote Memory Interface
Remote Method Invocation
Random Method Invocation
None of the above
TCP, FTP, SMTP, Telnet are examples of?
IP address
Protocol
Socket
MAC address
The total JDBC product components in Java software provides is ___________
2
3
4
5
The total number of techniques used in session tracking is ________
3
4
5
6
Total JDBC drivers available is _____________
2
3
4
5
Total TCP/IP ports reserved for specific protocol is._______
1024
2048
512
32
What are the major components of the JDBC?
DriverManager, Statement, and ResultSet
DriverManager, Driver, Connection, Statement, and ResultSet
DriverManager, Connection, Statement, and ResultSet
DriverManager, Driver, Connection, and Statement
What decides the priority of the thread?
Thread
Process scheduler
Process
Thread scheduler
What is built on top of socket programming?
RMI
EJB
Both A and B
None of the above
What is the difference between servlet and JSP?
Compilation
Translation
Syntax
Both A and B
Identify the method which is used to start a server thread.
start thread()
run()
runthread()
start()
What is the total number of bits in a single IP address?
4
8
16
32
What is the total number of ResultSet available with the JDBC 2.0 core API?
2
3
4
5
Where can BLOB, CLOB, ARRAY, and REF type columns be updated?
JDBC 1.0
JDBC 2.0
JDBC 3.0
JDBC 4.0
Which driver is known as the thin driver in JDBC?
Type 1 driver
Type 2 driver
Type 3 driver
Type 4 driver
Which is responsible for getting a connection to the database?
Connection
Statement
ResultSet
Driver
Which of the following examples of application servers?
JBoss
Tomcat
Apache
WebLogic
Which of the following option leads to the portability and security of Java?
Dynamic binding between objects
Use of exception handling
Bytecode is executed by JVM
The applet makes the Java code secure and portable
Which of the following requires fewer resources?
Process
Thread
Both Thread and Process
Neither read nor process
Which of the following tags does the JSP page contain?
JSP tags
HTML tags
Both A and C
None of the above
Which of the following ways is used to communicate from an applet to servlet?
HTTP communication
Socket communication
RMI communication
All of the above
Which tag is used to execute Java source code in JSP?
Expression tag
Scriptlet tag
Declaration tag
None of the above
Choose whether true or false: JDBC is a Java API that is used to connect and execute queries to the database.
True
False
Among the following identify the packages which represent interfaces and classes for servlet API.
javax.servelet.http
javax.servelet
Both A and B
None of the above
Among the following methods which of the following returns proxy object.
getDatabase()
get()
load()
loadDatabase()
Among the following options choose the one which shows the advantage of using the JDBC connection pool.
Using less memory
Better performance
Slower performance
Using more memory
Among the following protocols are used for splitting and sending packets to an address across a network.
SMTP
TCP/IP
UDP
FTP
Among the following which attribute is used to specify the class name of the bean.
id
class
name
constructor-args
Among the following which contains date information.
java.sql timestamp
java.io time
java.io.timestamp
java.sql.time
What is the purpose of the finally block in a Java try-catch-finally construct?
To catch and handle exceptions thrown in the try block
To execute code regardless of whether an exception is thrown or not
To define the conditions for handling exceptions
To provide an alternate code path when an exception occurs
Which of the following access modifiers provides the widest scope of visibility for a class member in Java?
private
protected
default
public
Among the following which is a type of multitasking?
Thread based
Process-based
Both A and B
None of the above
Among the following which is not a directive?
Page
Include
Tag
Export
Among the following which method is used to know the host of an URL?
findhost()
gethost()
locatehost()
host()
Choose the instance variable of class httpd among the following.
Cache
Port
Log
All of the above
Total ways to perform exception handling in JSP is ________
2
3
4
5
Choose whether true or false: The JDBC API is what allows access to a data source from a java middle tier.
True
False
Choose whether true or false: The ResultsSet.next method is used to move the next row of the ResultSet, making the current row
True
False
Choose whether true or false: The web server is used for loading the init() method of the servlet.
True
False
For resolving Facelet views, which of the following is configured.
View_Resolver
View-resolver
ViewResolver
ViewFacelets
Full form of JDBC is __________
Java database Communications
Java database concept
Java database connectivity
None of the above
How constructor can be used for a servlet?
Initialization and Constructor function
Setup() method
Initialization
Constructor function
Identify among the following which follows the connectionless service.
HTTP
TCP/IP
TCP
UDP
Identify the class used for connection-less socket programming.
Datagram packet
Datagram socket
Both A and B
None of the above
Identify the HTTP request method which is non-idempotent.
POST
GET
Both A and B
None of the above
Identify the method of the JDBC process among the following options.
remove()
deletebatch()
setbatch()
addbacth()
Identify the method which is used to find the URL from the cache of httpd.
getfromcache()
findfromcache()
findcache()
servefromcache()