Você está na página 1de 7

Test Subject : RnD Sr Software Enginering

Start Time : 09:17:07


End Time : 09:29:07
Time Left : 00:11:32

Read carefully and answer this question to complete the test! and do not refresh the test page or your answer
will be lost!

Consider this class structure? C


1 Shape // bentuk
Rectangle extends Shape // persegi panjang meluas bentuk
Square extends Shape // kotak meluas bentuk

Which of the following is true?

a.

Rectangle is a Square

b.

Square is a Rectangle

c.

Rectangle is a Shape

d.

None of the above

When is a Hashtable better to use than an ArrayList? C


2

a.

When adding items to the collection


b.

When finding items by value on a large collection

c.

When finding items by key on a large collection

d.

When iterating over all the values

What would the following method print? C


3
<pre>
public void bar() {
print("hello");
try {
print("Paul");
throw new Exception();
print("John");
}
catch {
print("Ringo");
}
finally {
print("George");
}

print("bye");
}
</pre>

a.

hello Paul Ringo bye

b.

hello Paul John Ringo George bye


c.

hello Paul Ringo George bye

d.

hello Paul John Ringo bye

Which of the following are true for singleton classes?C


4

a.

Cannot be derived by other classes.

b.

Cannot be referred to in a variable

c.

Not more than one instance may exist ever within a runtime

d.

They are thread safe

What would calling Daemon.run() print? A


5 public class Daemon
{
private int id;

public Daemon( int testid ) { id = testid; }

public void printID() { Console.WriteLine( id ); }

// creates a thread that calls printID() on entry


private static Thread createThread( int id ) {
ThreadStart entryPoint = new ThreadStart( new Daemon( id ).printID );
return new Thread( entryPoint );
}

public static void run()


{
createThread( 1 ).Start();
createThread( 2 ).Start();
}
}

a.

b.

Cannot be determined

c.

Exception is thrown

d.

Will not compile

Consider 3 integers A, B, C.if A > B and C > B then what is the relationship of A and C?D
6

a.

A=C

b.

A>C

c.

A<c< td=""></c<>
d.

Cannot be determined

What would the value method getValue() return?B


7 class Test {
private int value = 5;

static public int getValue() {


return value - 1;
}
}

a.

b.

c.

Method will throw an exception

d.

Class will not compile

What will this function return when called as?B


8 Min(5/2, 4.8/2.0)

double Min( double a, double b )


{
return a < b ? a : b;
}

An exception will be thrown


a.

2.5

b.

c.

2.4

d.

An exception will be thrown

Consider this method:


9 int GetProfit(int n, int p, int vc, int fc) {
return n * (p - vc) - fc;
}
When would this return a profit greater than zero?A

a.

n > p + vc / fc

b.

n > fc / (p - vc)

c.

n < fc * p - vC
d.

None of the above

What is the value of x after this line of code? int x = 3 & 2;?B
10

a.

b.

c.

d.

Você também pode gostar