JNDI/JNDI MCQ QUESTIONS AND ANSWER Sample Test,Sample questions

Question:
		
A message driven bean is like a stateful session bean that encapsulates the business logic and doesn't maintain state.

1.True

2.False

3.none

4.all


Question:
	
GET methods are great for sending ....................amounts of information that you do not mind having visible in a URL.

1.negligible

2.huge

3.small

4.both and b


Question:
	
Implement the Listener interface and overrides its methods. Register the component with the Listener The Following steps are required to perform

1.Exception Handling

2.String Handling

3. Event Handling

4.None of the above


Question:
	
JFramemyFrame = new JFrame (); Any command (such as the one listed above) which creates a new object of a specific class (in this case a new JFrame object called myFrame) is generally called a ...

1.Constructor

2.Layout manager

3.Parameter

4.GUI


Question:
	
MVC Architecture stands for

1. Model View Controller

2.. Mode View Control

3.. Maximum View Control

4.. None


Question:
	
The ActionListener interface is used for handling action events,Forexample,it's used by a

1. JButton

2. JCheckbox

3.JMenuItem

4.All of these


Question:
 What does the == operator compare in Java objects?

1.Values

2.References

3.Hash codes

4. Fields


Question:
 What is the purpose of the "final" keyword in Java?

1.To prevent the inheritance of a class

2.To prevent overriding of a method

3.To prevent modification of a variable's value

4.All of the above


Question:
 What is the purpose of the "final" keyword in Java?

1.To prevent the inheritance of a class

2.To prevent overriding of a method

3.To prevent modification of a variable's value

4.All of the above


Question:
 Which loop construct is best suited for iterating over an array or a collection?

1.for loop

2. while loop

3.do-while loop

4.continue statement


Question:
 Which of the following is a unary operator?

1.+

2.-

3.!

4.All of the above


Question:
. Component used for displaying data in tabular

1.JList

2.JTextArea

3.JTable

4.JTree


Question:
..................... is the first phase of the servlet life cycle.

1.Initialization

2.Service

3.Destruction

4.Both a and b


Question:
A servlet maintain session in

1.Servlet container

2.Servlet context

3.Servlet request heap

4.Servlet response heap


Question:
A servlet needs to acquire a data source through a JNDI naming lookup. Which of the following is the best place to do this?

1.Constructor

2.init method

3.service method

4.doGet method


Question:
A session bean represents a multiple clients inside the Application Server.

1.True

2.False

3.none

4.all


Question:
Can an interface extend another interface in Java?

1.No

2.Yes


Question:
Can an interface have a constructor?

1.Yes

2.No


Question:
EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

1. True

2. False

3.none

4.all


Question:
EJB technology is built on the top of Socket Programming

1. True

2. False

3.none

4.all


Question:
How can you check if two arrays are equal in Java?

1.Use the == operator

2.Use the .equals() method

3.Use Arrays.equals() method

4.Compare each element one by one


Question:
How do you access the fourth element of an array named numbers?

1.numbers[4];

2.numbers(3);

3.numbers[3];

4.numbers.get(3);


Question:
How do you declare an array in Java?

1. int arrayName;

2. int[] arrayName;

3.int arrayName[];

4.Both b and c


Question:
How do you find the length of a string named 'example'?

1.example.size()

2. example.length()

3.example.getLength()

4.example.len()


Question:
How do you initialize an array in Java?

1.int[] arr = (1,2,3,4,5);

2.int arr = {1,2,3,4,5};

3.int[] arr = new int[]{1,2,3,4,5};

4.int arr = new int(5);


Question:
How do you initialize an array in Java?

1.int[] arr = (1,2,3,4,5);

2.int arr = {1,2,3,4,5};

3.int[] arr = new int[]{1,2,3,4,5};

4.int arr = new int(5);


Question:
How many bits does the long data type use?

1.8

2. 16

3.32

4.64


Question:
How many ServletContext objects are available for an entire web application?

1.One each per servlet

2.One each per request

3.One each per response

4.Only one


Question:
In EJB, middleware services are provided by EJB Container automatically.

1.True

2.False

3.none

4.all


Question:
In Java, strings are:

1.Primitive data types

2.Immutable objects

3.Mutable objects

4.Arrays of characters


Question:
In Java, strings are:

1.Primitive data types

2.Immutable objects

3.Mutable objects

4.Arrays of characters


Question:
In which year was the first version of Java released?

1.1991

2.1995

3.1998

4.2000


Question:
It is lightweight.It supports pluggable look and feel.It follows MVC (Model View Controller) architecture. The following specifies the advantages of

1.Swing

2.AWT

3.Both A & B

4.None of the above


Question:
Java Bean is a _____________ technology

1.Component

2.scripting

3.middle tier

4.None


Question:
Java Beans are extremely secured?

1.True

2. False

3.none

4.all


Question:
Java Servletsare efficient and powerful solution for creating .......for the web.

1.dynamic content

2.static content

3.hardware

4.both and b


Question:
JMS is also known as a messaging service.

1.True

2.False

3.none

4.all


Question:
JMS is mainly used to send and receive message from one application to another.

1. True

2.False

3.none

4.all


Question:
Manifest file is a special file that contains information about the files packed in

1.JAR file

2.GIF

3.JPEG

4.all the above


Question:
Servlet mapping defines

1.an association between a URL pattern and a servlet

2.an association between a URL pattern and a request page

3.an association between a URL pattern and a response page

4.All of the above


Question:
Several vendors are adding ...................... to their existing database .................

1.JDOBC, middle-ware products

2.JDBC drivers, upper-ware products

3.middle-ware products, JDOBC drivers

4.JDBC drivers, middle-ware products


Question:
Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application?

1.True

2.False

3.none

4.all


Question:
The ActionListener interface is not used for handling action events?

1. True

2. False

3.none

4.all


Question:
The getSession() method with „true? as its parameter [ getSession(true) ] it will return the appropriate session object when

1.the session is completed

2.the session object is passed to another method

3.the session does not exists

4.the session is existing


Question:
The init parameter name and value pairs that are defined in web.xml file are handled by

1.ServletConfig object

2.ServletContext object

3.ServletRequest object

4.ServletResponse object


Question:
The service phase of the servlet life cycle represents all interactions with requests until the servlet is ......................

1.created

2.running

3.initiated

4.destroyed


Question:
What does JDK include?

1.Only a compiler

2.Only a runtime environment

3.Both a compiler and a runtime environment

4.None of the above


Question:
What happens when you try to access an array element with an index that is out of bounds?

1.It returns -1

2.It returns a null value

3.It throws an exception

4.It initializes a new array


Question:
What is an infinite loop?

1.A loop that executes only once

2.A loop that never terminates naturally

3.A loop that contains an unreachable code block

4.A loop that uses the continue statement


Question:
What is an interface in Java?

1.A class

2.A data type

3.A blueprint for a class

4.A data structure


Question:
What is encapsulation in Java?

1.The process of combining data and methods into a single unit

2.The process of hiding data and methods within a class

3.The process of creating multiple instances of a class

4.The process of reusing code from existing classes


Question:
What is inheritance in Java?

1.The process of creating multiple instances of a class

2.The process of hiding data and methods within a class

3.The process of reusing code from existing classes

4.The process of combining data and methods into a single unit


Question:
What is polymorphism in Java?

1.The ability of a class to inherit properties and behaviors from another class

2.The process of hiding data and methods within a class

3.The process of creating multiple instances of a class

4.The ability of an object to take on many forms


Question:
What is polymorphism?

1.Multiple forms

2. Single form

3.No form

4.Static form


Question:
What is the default value of the int data type?

1.0

2.1

3.null

4.Undefined


Question:
What is the key difference between a while loop and a do-while loop in Java?

1.The syntax used to define the loop

2.The number of iterations performed

3.The condition check timing

4.The ability to use the break statement


Question:
What is the output of the expression true || false?

1.true

2.false

3.null

4. 0


Question:
What is the primary function of JRE?

1.Compilation

2.Debugging

3.Execution

4.Development


Question:
What is the purpose of the "super" keyword in Java?

1.To refer to the current object

2.To invoke the superclass constructor or methods

3.To create multiple instances of a class

4.To hide data and methods within a class


Question:
What is the purpose of the "this" keyword in Java?

1.To refer to the superclass

2.To create multiple instances of a class

3.To hide data and methods within a class

4.To refer to the current object


Question:
What is the purpose of the continue statement in a loop?

1.To exit the loop immediately

2.To skip the current iteration and move to the next iteration

3.To terminate the program

4.To execute a specific block of code


Question:
What is the result of the expression "Java" + "Programming"?

1.JavaProgramming

2. Java Programming

3. Java Programming

4.JavaProgramming-


Question:
What is the result of the expression "Java" + "Programming"?

1.JavaProgramming

2. Java Programming

3. Java Programming

4.JavaProgramming-


Question:
What is the root class for all Java classes?

1.Object

2.Class

3.Superclass

4. Root


Question:
What was the original name for Java?

1. C++++

2.Oak

3.Pine

4.Maple


Question:
What's the difference between servlets and applets? a. Servlets executes on Servers, where as

1.Applets executes on Browser

2.Servlets have no GUI, where as an Applet has GUI

3.Servlets creates static web pages, where as Applets creates dynamic web pages

4.Servlets can handle only a single request, where as Applet can handle multiple requests


Question:
What's the main difference between int and Integer in Java?

1.No difference

2.Integer can store larger values than int

3.int is a primitive data type, while Integer is a class

4.int can be null, while Integer cannot


Question:
Which class can create a string that is thread-safe?

1.String

2.StringBuffer

3.StringBuilder

4.StringBuilder


Question:
Which class provides many methods for graphics programming?

1. java.awt

2. java.Graphics

3. java.awt.Graphics

4. None of the above


Question:
Which data type can store a single character?

1.String

2. byte

3.char

4.int


Question:
Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfieldetc?

1.Window

2.Frame

3.Panel

4.all the above


Question:
Which is the passive control that do not support any interaction with the user?

1.JList

2.JLabel

3.JTable

4.JTree


Question:
Which keyword is used to implement an interface?

1.extends

2. new

3.interface

4.implements


Question:
Which loop construct guarantees that the loop body is executed at least once?

1.for loop

2.while loop

3.do-while loop

4.continue statement


Question:
Which loop construct in Java is best suited when the number of iterations is known?

1.for loop

2.while loop

3.do-while loop

4.break statement


Question:
Which loop construct in Java is best suited when the number of iterations is unknown?

1. for loop

2.while loop

3.do-while loop

4. none


Question:
Which method is used to compare two strings for equality?

1. ==

2. equals()

3.compare()

4. isEqual()


Question:
Which method is used to get the length of an array in Java?

1.length()

2. size()

3.getLength()

4.length


Question:
Which method is used to specify before any lines that uses the PrintWriter?

1.setPageType()

2.setContextType()

3.setContentType()

4.setResponseType()


Question:
Which of the following access modifiers are implicitly applied to variables in an interface?

1.private

2.protected

3.public

4.default


Question:
Which of the following are the session tracking techniques?

1.URL rewriting, using session object, using response object, using hidden fields

2.URL rewriting, using session object, using cookies, using hidden fields

3.URL rewriting, using servlet object, using response object, using cookies

4.URL rewriting, using request object, using response object, using session object


Question:
Which of the following creates a mutable string?

1.String

2.StringBuilder

3.StringChar

4.StringMutable


Question:
Which of the following data types can store a floating-point number?

1.int

2.byte

3.double

4.char


Question:
Which of the following is NOT a part of the JRE?

1.Bytecode verifier

2.Classloader

3.Java Compiler

4. Java API classes


Question:
Which of the following is not a primitive data type in Java?

1.byte

2.String

3.double

4.short


Question:
Which of the following is not true about Java beans?

1.Implements java.io.Serializable interface

2.Extends java.io.Serializable class

3.Provides no argument constructor

4.Provides setter and getter methods for its properties


Question:
Which of the following is responsible for converting bytecode into machine code?

1.JDK

2. JRE

3.JVM

4.Java Compiler


Question:
Which of the following operators is used for concatenation of two strings?

1.+

2.*

3.&

4.+=


Question:
Which of the following package contains servlet classes?

1.javax.servlet

2.javax.servlet.http

3.Both of the above

4.None of the above


Question:
Which operator has the highest precedence?

1.+

2.*

3.()

4.&&


Question:
Which operator is used for logical "AND" operation?

1.&&

2.&

3.||

4.|


Question:
Which operator is used to perform bitwise "AND" operation?

1.&&

2.&

3.|

4.||


Question:
Which statement is used to exit a loop prematurely?

1.return statement

2.continue statement

3.break statement

4.exit statement


Question:
Who developed the Java programming language?

1.Microsoft

2.Oracle

3.Sun Microsystems

4.Google


More MCQS

  1. JNDI MCQ QUESTIONS AND ANSWER
  2. JNDI MCQ QUESTIONS AND ANSWER
  3. JNDI MCQ QUESTIONS AND ANSWER
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!