Modified Ass M
Modified Ass M
Options :
1. No Number gets printed
2. One number gets printed
3. Two numbers gets printed
4. Three numbers gets printed
You want all clients using XYZ to use the same instance (only one) of class XYZ , what
should you do to achieve this goal?
1. Mark class XYZ final
2. Mark class XYZ abstract
3. Apply the Singleton design pattern to class XYZ
4. Apply the Factory Method design pattern to class XYZ
2.What gets printed when the following JSTL code fragment is executed ?
%@taglib uri=”http://java.sun.com/jsp/jstl/core”prefix=”c”%
<c:forEach var=”item”begin=”0” end=”12”step=”3”>
${item}
</c:forEach>
1. 0,3,6,9,12
2. 3,6,9,12
3. 0,6,9,12
4. 0,3,6,9
Which of the following means that the ResultSet can only read ?
1. ResultSet.CONCUR_READ_ONLY
2. ResultSet.CONCUR_UPDATABLE
3. ResultSet.READ_ONLY
4. ResultSet.UPDATABLE
In the Snippet below, what line of code needs to be added to move the cursor to the 3 rd
row in the resultset?
Class.forName(“oracle.jdbc.driver.OracledDriver”);
Connectioncon=DriverManager.getConnection(“jdbc:oracle:thin@localhost:1521:xe”,”syst
em”,”oracle”);
Statement
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDAT
ABLE);
ResultSetrs=stmt.executeQuery(“select*from emp765”);
1. Rs.move(3);
2. Rs.next(3);
3. Rs.absolute(3);
4. Rs.getstring(3);
How do you know in your Java program that an SQL warning generated as a result of
executing and SQL statement in the database?
1. You must catch the checked SQLException which is thrown by the method which
executes the statement.
2. You must Catch the unchecked SQLWarningException which is thrown by the
method
3. You must invoke the getWarnings() method on the statement object (or a sub
interface thereof)
4. You must query the ResultSet object about possible warnings generated by the
database
You are creating a class diagram using UML and you need to show that one of your classes
is an abstract clas. How would you do that ?
1. Underline the name of the class In the diagram
2. Draw a dotted line between it and the other classes
3. Use italics for the name of the class
4. Draw an arrow with a hallow diamond head between it and the other classes.
1. SC_OK
2. SC_CREATED
3. SC_NOT_FOUND
4. SC_CONTINUE
4. If in test.jsp:
\${3+2-1:}${3+2-1}
What is the Output?
1. \${3+2-1}:4
2. \$4:4
3. 4:4
4. \4:4
5.The Lifecycle of a servlet is managed by:
1. Servlet context
2. Servlet container
3. The Supporting protocol (such as http or https)
4. None of the above
6. A JSP page uses the java.util.ArrayList class many times. Instead of referring the class by
its complete package name each time, we want to just use ArrayList. Which attribute of
page directive must be specified to achieve this? Select the one correct
1. Extends
2. Include
3. Package
4. Import
7. Which of the following does not include getAttribute () method?
1. Httpsession
2. ServletRequest
3. ServletContext
4. ServletConfig
1. getOutputStream
2. getBinaryStream
3. getWriter
4. getStream
11. Identify the Location of compiled class files within a war file ?
1. /META-INF/classes
2. /classes
3. /WEB-INF/classes
4. D,/root/classes
12. Which of the following cannot be used as the scope when using a JavaBean with JSP?
1. Application
2. Session
3. Response
4. Request
13. What is the effect of executing the following JSP statement , assuming a class with
name Employee exists in classes package?
1. The code does not compile as there is no property attribute of setProperty tag.
2. The code does not compile as the property attribute cannot take * as a value
3. The code sets value of all properties of employee bean to “*”.
4. The code sets the values of all properties of employee bean matching parameters in
request object
14. What are the mechanisms available in ServletContextListener Interface?
1. contextInt().contextService(),contextDestroy()
2. contextInitialized(),contextDestroy()
3. contextInitialized(),contextService(),ContextDestroyed()
4. contextInitialized(), contextService()
16. The task authentication blocking of requests ,data compression, logging and auditing
are performed by _________
1. Servlet filter
2. Servlet Config
3. Servlet Context
4. Servlet Container
17. What is the output of following code?
@Test
Public void testA() {
System.out.println(name.getMethodName());
assertEquals(“testA”, name .getMethodName());
}
@Test
Public void testB() {
System.out.println(name.getMethodName());
assertEquals(“testB”,name.getMethodName());
}
}
1. TestA,testB
2. testBtestA
3. testA compile error
4. testB compile error
18. Which of the following annotations causes that method run once before any of the
test methods in the class ?
1. @Test
2. @Before
3. @BeforeClass
4. @AfterClass
19. Pick the correct Java Stream API’s?
1. Stream.allMatch
2. Stream.noneMatch
3. Stream.anyMatch
4. All the above
20. What is the command line tool introduced for JS engine in Java 8?
1. Jjs
2. Jss
3. Jfs
4. Jbd
31. Which class is introduced in Java 8 to get the current milliseconds?
a) Clock
b) Current Time
c) Date Time
d) Time
32. Which is the correct Java code snippet to be used to create a Functional Interface ?
a) Interface MyFunctionalInterface implements Functional {
b) “@FunctionalInterface interface MyFunctionalInterface {“
c) “@Functional interface MyFunctionalInterface {“
33. Pick the class that is NOT part of Java collection framework.
a) Map
b) List
c) Queue
d) Struct
34. In Java, Which of these class types supports sequential and parallel processing of data?
a) Queue
b) Lambda
c) ExecutorService
d) Streams
35. Which Java Set implementation is sorted and synchronized?
a) TreeSet
b) LinkedHashSet
c) HashSet
d) ConcurrentSkipListSet
36. Which of the following statements is NOT correct for JVM?
a) JVM acts as a translator that translates different Machine code (on the basis of Host
Machine) for a common Byte Code.
b) JVM is a Virtual Machine that acts as a intermediary between Java Application and Host
Operating System.
c) JVM reads Byte Code and generates Machine Code.
d) JVM reads Source Code and generates Byte Code.
38. Java Stream does NOT store the elements. It simply performs the aggregate operations
to get the desired stream of data.
a) True
b) False
39. Which Java class is used to apply reduction or aggregate functions on streams?
a) Filters
b) Reduction
c) Collectors
40. Java system properties can be set or modified at runtime.
a) True
b) False
44. Which of the following terminologies are typically used with regards to AOP?
A. Concerns
B. Advice
C. Float
D. Pointcut
a) A, B, and D
b) A, C, and D
c) A, B, and C
d) B, C, and D
45. Fill in the blank.
The use of Autodiscovery and Autowire will reduce the amount of ___________.
a) Java code generated
b) Methods generated
c) XML Spring configurations
d) <bean> elements
48. From where does the Spring container gets its instructions?
A. Properties File
B. Spring JARS
C. XML File
D. Annotations
a) A and C
b) C and D
c) B and D
d) A and D
50. Which is the alternative to create, load, and manage beans in a Spring Application?
a) ApplicationFactory
b) ContextFactory
c) BeanFactory
d) SpringBeanFactory
51. The Dependency Lookup is a methodology where we get the resource after demand.
There can be various ways to get the resource. Types of Dependency Lookup include:
a) Factory Method
b) JNDI Method
c) Key Word Method
d) All of the above
52. To use java.util.List,what is the Spring Collections element that you need?
a) <list>
b) <List>
c) <lists>
d) <util:list>
54. Which one of these statements about XML declaration of transaction manager bean is
NOT true?
a) The tx namespace provides JTA transaction manager declaration shortcut syntax.
b) The Id of the bean has to be transactionManager.
c) Depending on the application persistence technology, the HibernateTransactionManager
or the DataSourceTranasctionManager could be used as bean class.
d) A default transaction timeout could be given.
55. Which one of the following is one of the challenge of Traditional Transaction
Management?
a) Transaction Management at Database Connection Level
b) Programmatic Management of Transactions
c) Error-Prone Connection Management
d) All of the above
56. What does the JDBC Template users to connect to the database?
a) A simple java bean with connection properties
b) A data source bean configuration
c) An XML with DB connection parameters
d) A jdbc connection object
60. What annotation wiring element is added to scan packages to find and register beans
within the Application Context?
a) <context:annotation-config/>
b) <context:annotation-scan/>
c) <context:component-config/>
d) <context:component-scan>