0

programming languages Online Quiz - 201

Description: programming languages Online Quiz - 201
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which of the following are illegal names for the business methods defined in an entity bean home interface?

  1. findAllCustomers(…)

  2. removeTheCustomer(…)

  3. createCustomer(…)

  4. create()

  5. retrieveCustData(…)


Correct Option: A,B,C,D

How many create methods can you declare in the entity bean home interface?

  1. One or more

  2. Zero or more

  3. Exactly one

  4. Zero


Correct Option: B

A client calls a finder method whose return type is a Collection of references to the remote interface of an entity bean. Assume no match for that entity is found. Which of the following will be the result of this call?

  1. ObjectNotFoundException.

  2. An empty Collection will be returned.

  3. An entity would be created and a reference to that entity would be returned.

  4. EntityNotFoundException.


Correct Option: B

Which of the following are true statements about what happens when a remove() method is called using the component interface of an entity bean representing a specific entity in the database?

  1. The entity bean instance is deleted.

  2. The entity in the database is deleted.

  3. Both the entity and the entity bean instance survive, but that entity bean instance does not represent that entity anymore.

  4. Nothing happens; the container simply ignores the call.


Correct Option: B

Which of the following statements are true about a CMP entity bean?

  1. You cannot write JDBC code in the bean class to make a connection and send queries to any database.

  2. You cannot write JDBC code in the bean class to change the values of virtual persistent fields of your bean.

  3. You can write JDBC code and get connected to any database you want.

  4. You can write JDBC code to read the virtual persistent fields, but you cannot change their values.


Correct Option: B
  1. getEJBObject()

  2. getPrimaryKey()

  3. getEJBHome()

  4. getRollbackOnly()

  5. getUserTransaction()


Correct Option: A,B,C,D

Which of the following statements about the entity bean are true?

  1. All entity bean instances of the same type (say CustomerBean) have the same Home, that is, an instance of an object that implements the home interface of this bean.

  2. A specific entity bean instance can be accessed by only one client at a time.

  3. If two clients wanted to access the same entity in the database concurrently, the container would make two entity bean instances to represent that entity.

  4. If two clients wanted to access the same entity in the database concurrently, the container would make one entity bean to represent that entity, and the two clients would get their own references to the same EJBObject correspondtwo clients would get their


Correct Option: A,D

Consider the method getUserTransaction() of the interface Entity- Context. From which methods of an entity bean class can this method be called?

  1. ejbCreate

  2. Home business methods

  3. Business methods exposed in the component interface

  4. ejbStore()

  5. None of the above


Correct Option: E

Given: import java.util.regex.; class Regex2 { public static void main(String[] args) { Pattern p = Pattern.compile(args[o]); Matcher m = p.matcher(args[1]); boolean b = false; while(b = m.find()) { System.out.print(m.start() + m.group()); } } } And the command line: java Regex2 "\d" ab34ef What is the result?

  1. 234

  2. 334

  3. 2334

  4. 0123456

  5. 01234456

  6. 12334567


Correct Option: E

Given that bw is a reference to a valid BufferedWriter And the snippet: 15. BufferedWriter b1 = new BufferedWriter(new File("f")); 16. BufferedWriter b2 = new BufferedWriter(new FileWriter("f1")); 17. BufferedWriter b3 = new BufferedWriter(new PrintWriter("f2")); 18. BufferedWriter b4 = new BufferedWriter(new BufferedWriter(bw)); What is the result?

  1. Compilation succeeds

  2. Compilation fails due only to an error on line 15

  3. Compilation fails due only to an error on line 16

  4. Compilation fails due only to an error on line 17

  5. Compilation fails due only to an error on line 18

  6. Compilation fails due to errors on multiple lines


Correct Option: B
  1. Servlet in web application

  2. Record in a database

  3. Enterprise java bean

  4. File record


Correct Option: C

In a Weblogic Development environment…. (Choose the best answer):

  1. A Workspace can contain multiple applications and projects ….

  2. Module can have projects ,library and application

  3. Library can have modules and projects

  4. Application can have one or more projects, library and module


Correct Option: D
  1. public void perform() { }

  2. public boolean perform() { }

  3. static public boolean perform() { }

  4. public void perform() throws Exception { }

  5. public boolean perform() throws Exception { }


Correct Option: D

Of the following which has got the broadest scope (Choose the best answer):

  1. Application

  2. Library

  3. Project

  4. Module

  5. Process


Correct Option: A

If the method to be overridden has access type protected, choose access types among the following that a subclass can have,

  1. Protected

  2. Private

  3. Public

  4. 2&3

  5. 1&3


Correct Option: E

While serializing a class whose Base class is serializable, which of the following fields are ignored?

  1. Non Static field

  2. Base class fields

  3. Transient Fields.

  4. Static Field


Correct Option: C
  1. Can have only one constructor

  2. a.Cannot have a constructor

  3. Can have more than one constructor

  4. May or May not have constructors


Correct Option: B
- Hide questions