0
Alien head

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

What is the rule of anonymous class

  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

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

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

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

What will be the syntax for the Perform node created by the developer

  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

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

JPD is deployed in weblogic as (Choose the best answer)

  1. Servlet in web application

  2. Record in a database

  3. Enterprise java bean

  4. File record


Correct Option: C

Given: class Polish { public static void main(String[] args) { int x = 4 ; StringBuffer sb = new StringBuffer("..fedcba"); sb.delete(3,6); sb.insert(3, "az"); if(sb.length() > 6) x = sb.indexOf("b"); sb.delete((x-3), (x-2)); System.out.println(sb); } } What is the result?

  1. .faza

  2. .fzba

  3. ..azba

  4. .fazba

  5. ..fezba

  6. Compilation fails


Correct Option: C

Given: 1. import java.text.*; 2. class DateOne { 3. public static void main(String[] args) { 4. Date d = new Date(1123631685981L); 5. DateFormat df = new DateFormat(); 6. System.out.println(df.format(d)); 7. } 8. } And given that 1123631685981L is the number of milliseconds between Jan. 1, 1970, and sometime on Aug. 9, 2005, what is the result? (Note: the time of day in option A may vary.)

  1. 8/9/05 5:54 PM

  2. 1123631685981L

  3. An exception is thrown at runtime.

  4. Compilation fails due to a single error in the code.

  5. Compilation fails due to multiple errors in the code.


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

Given: import java.io.*; class Player { Player() { System.out.print("p"); } } class CardPlayer extends Player implements Serializable { CardPlayer() { System.out.print("c"); } public static void main(String[] args){ CardPlayer cl = new CardPlayer(); try { FileOutputStream fos = new FileOutputStream("play.txt"); ObjectOutputStream os = new ObjectOutputStream(fos); os.writeObject(c1); os.close() ; FileInputStream fis = new FileInputStream("play.txt"); ObjectInputStream is = new ObjectInputStream(fis); CardPlayer c2 = (CardPlayer) is.readObject(); is.close(); } catch (Exception x ) { } } } What is the result?

  1. pc

  2. pcc

  3. pcp

  4. pcpc

  5. Compilation fails

  6. An exception is thrown at runtime


Correct Option: C

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

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

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

Which methods of the EntityContext interface can be called from within an ejbPostCreate of an entity bean class?

  1. getEJBObject()

  2. getPrimaryKey()

  3. getEJBHome()

  4. getRollbackOnly()

  5. getUserTransaction()


Correct Option: A,B,C,D

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

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

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

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

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
+ View questions