Bloomberg LP Interview Report
- 0of 0 votes
AnswersWhat is an RMI "stub"?
- dhaval0129 July 26, 2011
a.) It is used by the client to find remote objects on a server.
b.) It acts as a client-side proxy to receive RMI calls and pass them to the server.
c.) It enables applets to make RMI calls without violating browser security.
d.) It receives RMI calls from the server to enable applet callbacks.
e.) It is the interface implemented by both the client and server objects.| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersConnection cn;
- dhaval0129 July 26, 2011
String queryStr;
// .. Code to open the connection and create a query not shown
cn.setAutoCommit(false);
cn.executeQuery(queryStr);
// *** Line A
In the code above, which one of the following substitutions for Line A writes the query results to the database?
a.) cn.update();
b.) cn.flush()
c.) cn.executeQuery("TRANSACTION END");
d.) cn.commit();
e.) cn.rollback();| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersWhat does IDL stands for ?
- dhaval0129 July 26, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
Answerschar ch1 = 0,ch2 = 0; try { ch1 = (char) System.in.read(); } catch(Exception e) {} switch(ch1) { case 'a': ch2 = '1'; case 'b': ch2 = '2'; case 'c': ch2 = '3'; default: ch2 = '4'; }
In reference to the above, if during execution the user presses "b," what is the ending value of "ch2"?
- dhaval0129 July 26, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Java - -1of 1 vote
Answerspublic double SquareRoot( double value ) throws ArithmeticException
- dhaval0129 July 26, 2011
{
if (value >= 0) return Math.sqrt( value );
else throw new ArithmeticException();
}
public double func(int x) {
double y = (double) x;
y *= -9.0;
try {
y = SquareRoot( y );
}
catch(ArithmeticException e) { y /= 3; }
finally { y += 10; }
return y;
}
Referring to the above, what value is returned when method func(9) is invoked?| Report Duplicate | Flag | PURGE
Bloomberg LP - 0of 0 votes
Answers<%@ page language="java" import="java.io.*" %>
- dhaval0129 July 26, 2011
<HTML>
<BODY>
The browser's IP address was:
<%-- *** Line A *** --%>
</BODY>
</HTML>
When substituted for Line A in the JSP code above, which one of the following lines displays the browser's IP address?
a.) <%= session.getRemoteAddr() %>
b.) <%= request.getRemoteAddr() %>
c.) <%= application.getRemoteAddr() %>
d.) <%= page.getRemoteAddr() %>
e.) <%= response.getRemoteAddr() %>| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
Answerspublic class ArrayTest{
- dhaval0129 July 26, 2011
public static void main(String[] args){
// insert code here
}
}
Given the above sample code, what do you insert to print out a list of the command-line arguments?
a.) for(int i=0; i<args.getLength(); i++)
System.out.println(args[i]);
b.) for(int i=0; i<args.size(); i++)
System.out.println(args[i]);
c.) for(int i=0; i<args.length(); i++)
System.out.println(args[i]);
d.) for(int i=0; i<args.length; i++)
System.out.println(args[i]);
e.) for(int i=0; i<sizeof(args); i++)
System.out.println(args[i]);| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
Answers// *** Line A
- dhaval0129 July 26, 2011
package com.brainbench.TestExamples;
// *** Line B
import java.io.*;
// *** Line C
public class DocumentationSample
// *** Line D
implements Serializable {
// *** Line E
// .. Code not shown ..
}
In the code sample above, where must you place a documentation comment that describes the purpose of the class DocumentationSample?| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
Answersclass SuperClass {
- dhaval0129 July 26, 2011
private void printIt() {System.out.println("SuperClass");}
void printIt(boolean f) {
if (f) {
System.out.println("Super-part 2");
} else {
printIt();
}
}
}
class SubClass extends SuperClass {
void printIt() {System.out.println("SubClass");}
}
public class TestSub {
static void main(String args[]) {
SubClass sc=new SubClass();
sc.printIt();
sc.printIt(false);
}
}| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswerFilePermission fp=new FilePermission("/tmp/110115.tmp","write");
- dhaval0129 July 26, 2011
AccessController.checkPermission(fp);
What happens if the code above is run from a thread that has NOT been granted access to the /tmp directory?
a.) The runtime system presents a browser dialog to the user.
b.) The virtual machine exits.
c.) The call to AccessController throws an AccessControlException.
d.) The runtime system terminates the thread that called AccessController.
e.) The call to AccessController returns false.| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersA)
- dhaval0129 July 26, 2011
long fib_A(unsigned long n) {
if (n <= 1) {
return n;
} else {
return fib_A(n-1) + fib_A(n-2);
}
}
B)
long fib_B(unsigned long n) {
int previous = -1;
int result = 1;
for (int i = 0; i <= n; i++)
{
int sum = result + previous;
previous = result;
result = sum;
}
return res
Which is more CPU Intensive?| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm - 0of 0 votes
AnswersA)
- dhaval0129 July 26, 2011
long fib_A(unsigned long n) {
if (n <= 1) {
return n;
} else {
return fib_A(n-1) + fib_A(n-2);
}
}
B)
long fib_B(unsigned long n) {
int previous = -1;
int result = 1;
for (int i = 0; i <= n; i++)
{
int sum = result + previous;
previous = result;
result = sum;
}
return result;
What is the execution time (in Big O notation)| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm - -1of 1 vote
Answerspublic class SortSample {
- dhaval0129 July 26, 2011
public void printSorted(int arrayToSort[]) {
.. // Insert code to sort the array here
System.out.print("Sorted array is ");
for (int j=0; j<arrayToSort.length;j++)
System.out.print(arrayToSort[j]+" ");
System.out.println();
}
In the above code, what is the code-efficient way to sort the array into ascending order?| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
Answerspublic class SaveObject{
- dhaval0129 July 26, 2011
public static void main( String[] args ){
Employee smith = new Employee("012345","Smith","James","Payroll");
FileOutputStream fos = new FileOutputStream("smith.dat");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(smith);
fos.close();
}
}
Given the above sample code, which one of the following prevents the code from working properly?| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm - 0of 0 votes
AnswerWhich interface is intended to supersede Enumeration in the collections framework?
- dhaval0129 July 26, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersWhat is the main purpose of Java servlets?
- dhaval0129 July 26, 2011
a.) They allow browsers to upload intelligent search agents to a Web server.
b.) They allow resource-limited devices such as printers or embedded systems to respond to http requests.
c.) They allow Java programs to access back-end databases such as Oracle and Sybase.
d.) They allow for generation of dynamic content and processing of user input on the Web.
e.) They handle the communications protocols required to send applets to Web browsers.| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersWrite in your most comfortable language) code that prints the numbers from 1 to 1 million.
- dhaval0129 July 26, 2011
But for multiples of prime number seven print "Multi" instead of the number and
for the multiples of prime number thirteen print "Attribution".
For numbers which are multiples of both three and five print "Multi-Attribution".| Report Duplicate | Flag | PURGE
Bloomberg LP - 0of 0 votes
AnswerIn mapreduce, which type of join is more efficient, map side join or reduce side join and why?
- dhaval0129 July 26, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Database - 0of 0 votes
AnswerWhich statement below describes a class that implements the Enumeration interface?
- dhaval0129 July 26, 2011
a.) It has implementations of the toString() and getNextString() methods.
b.) It is a subclass of Vector.
c.) It contains implementations of the hasMoreElements() and nextElement() methods.
d.) It can be used to store associative arrays.
e.) It can work with the StringTokenizer class.| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersWrite a unit test for the fibonacci function above?
- dhaval0129 July 26, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Testing - -1of 1 vote
Answerspublic class CashHolder {
- dhaval0129 July 26, 2011
private double amountHeld=0.0;
}
public void getCash() {
CashHolder wallet = new CashHolder();
// Lookup the Teller using RMI
Teller teller= (Teller) java.rmi.
Naming.lookup("//localhost/TellerObject");
// Withdraw 100.00 from account #9856432 and put it into
// Wallet.
teller.withdrawFunds("9856432",wallet,100.00);
// Go somewhere and spend it
..
}
How do you change the code above to allow teller.withdrawFunds() to update the CashHolder object passed to it?| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersWhich one of the following correctly describes the function of a bean's home interface in EJBs?
- dhaval0129 July 26, 2011
a.) It maps Java types to underlying database types.
b.) It defines how to create, find, or remove the bean.
c.) It defines all of the beans public methods.
d.) It is the container for the bean and it manages transactions.
e.) It interfaces to a naming service to allow remote objects to lookup the bean.| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersHow do you get a reference to the system clipboard?
- dhaval0129 July 26, 2011
a.) java.awt.Toolkit.getDefaultToolkit().getSystemClipboard()
b.) Java can't get access to the clipboard.
c.) new java.awt.datatransfer.Clipboard()
d.) System.lang.ClipBoard
e.) java.awt.datatransfer.Clipboard.getDesktopClipboard()| Report Duplicate | Flag | PURGE
Bloomberg LP Java - 0of 0 votes
AnswersBufferedImage im=
- dhaval0129 July 26, 2011
new BufferedImage(100,200,BufferedImage.TYPE_INT_RGB));
Graphics2D gc= im.createGraphics();
Where is the origin (0,0) of the image created above?
a.) In the center of the image
b.) In the top left corner
c.) In the top right corner
d.) In the bottom left corner
e.) In the depends on the AffineTransform in effect| Report Duplicate | Flag | PURGE
Bloomberg LP - 0of 0 votes
AnswerWhat is IDL?
- dhaval0129 July 26, 2011
a.) International Document Language - a language-independent text format for transmitting documents
b.) Independent Device Layer - a software abstraction that sits on top of different hardware presenting a uniform interface
c.) Interface Definition Language - a programming-language-independent method for defining object interfaces
d.) Internet Dialup Layer - a communications layer that manages TCP/IP connections over a modem link
e.) Image Definition Language - a graphics definition language for defining portable images| Report Duplicate | Flag | PURGE
Bloomberg LP Java