Right Place For Right PersonTM |
| Tolal:16 Click: 1 |
| Questions | Show Answers | Total Posts | Post Your Answers | Last Post |
|---|---|---|---|---|
What is the value of "d" after this line of code has been executed? double d = Math.round ( 2.5 + Math.random( )); A. 2 B. 3 C. 4 D. 2.5 |
Show Answers | 1 | Post Your Answers | 28.11.11 Harsh |
Which of the following would compile without error? A. int a = Math.abs(-5); B. int b = Math.abs(5.0); C. int c = Math.abs(5.5F); D. int d = Math.abs(5L); |
Show Answers | 1 | Post Your Answers | 28.11.11 Harsh |
Which of the following are valid calls to Math.max? A.Math.max(1,4) B.Math.max(2.3, 5) C.Math.max(1, 3, 5, 7) D.Math.max(-1.5, -2.8f) |
Show Answers | 1 | Post Your Answers | 28.11.11 Harsh |
public class Myfile
{
public static void main (String[] args)
{
String biz = args[1];
String baz = args[2];
String rip = args[3];
System.out.println("Arg is " + rip);
}
}
Select how you would start the program to cause it to print: Arg is 2
A. java Myfile 222
B. java Myfile 1 2 2 3 4
C. java Myfile 1 3 2 2
D. java Myfile 0 1 2 3
|
Show Answers | 1 | Post Your Answers | 28.11.11 Harsh |
The methods wait() and notify() are defined in A.java.lang.Object B.java.lang.String C.java.lang.Runnable D.java.lang.Thread |
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
Which of the following statements are true? (A) A Java monitor must either extend Thread or implement Runnable. (B) The sleep() method should be enclosed in try ... catch block. (C) The yield() method should be enclosed in try ... catch block. (D) A thread can be temporarily suspended from running by using the wait() method. (E) A suspended thread using suspend() method can be revived using the resume() method. |
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
Given the following code:
class Base { int x = 10; }
class Derived extends Base
{ int x = 20; }
Base b = new Base();
Derived d = new Derived ( );
Base bd = new Derived();
The statement
System.out.println(b.x + " " + d.x + " " + bd.x);
will produce the output
a.10 20 20
b.20 10 20
c.10 20 10
d.20 20 10
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
Given the class definitions
class Base
{
void display ()
{ System.out.println("Amit"); }
}
class Derived extends Base
{
void display ()
{
System.out.println("Anu"); }
}
and objects
Base b = new Base();
Derived d = new Derived();
Base bd = new Derived;
then the print statements
System.out.print(b.display() + " ");
System.out.print(d.display() + " ");
System.out.print(bd.display() + " ");
System.out.println();
will display:
a.Amit Amit Anu
b.Amit Anu Amit
c.Anu Anu Anu
d.Amit Anu Anu
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
When we implement the Runnable interface, we must define the method a.start() b.init() c.resume() d.main() e.run() |
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program?
String x = new String("xyz");
String y = "abc";
x = x + y;
How many String objects have been created?
A. 2
B. 3
C. 4
D. 5
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program?
public class Test
{
public static void main(String [] args)
{
int result = 0;
short s = 12;
Long x = new Long("12");
Long y = new Long(12);
Short z = new Short("12");
Short x2 = new Short(s);
Integer y2 = new Integer("12");
Integer z2 = new Integer(12);
if (x == y) /* Line 13 */
result = 1;
if (x.equals(y) ) /* Line 15 */
result = result + 10;
if (x.equals(z) ) /* Line 17 */
result = result + 100;
if (x.equals(x2) ) /* Line 19 */
result = result + 1000;
if (x.equals(z2) ) /* Line 21 */
result = result + 10000;
System.out.println("result = " + result);
}
}
A. result = 1
B. result = 10
C. result = 11
D. result = 11010
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program?
public class Test
{
public static void main(String[] args)
{
String s = "foo";
Object o = (Object)s;
if (s.equals(o))
{
System.out.print("Amit");
}
else
{
System.out.print("Anu");
}
if (o.equals(s))
{
System.out.print("Akash");
}
else
{
System.out.print("Akhil");
}
}
}
A. AmitAkash
B. AmitAkhil
C. AnuAkash
D. AnuAkhil
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program?
String x = "xyz";
x.toUpperCase(); /* Line 2 */
String y = x.replace('Y', 'y');
y = y + "abc";
System.out.println(y);
A. abcXyZ
B. abcxyz
C. xyzabc
D. XyZabc
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program? int i = (int) Math.random(); A. i = 0 B. i = 1 C. value of i is undetermined D. Statement causes a compile error |
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program?
class A
{
public A(int x){}
}
class B extends A { }
public class test
{
public static void main (String args [])
{
A a = new B();
System.out.println("complete");
}
}
A. It compiles and runs printing nothing
B. Compiles but fails at runtime
C. Compile Error
D. Prints "complete"
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
What will be the output of the program?
int i = 1, j = 10;
do
{
if(i++ > --j) /* Line 4 */
{
continue;
}
} while (i < 5);
System.out.println("i = " + i + "and j = " + j); /* Line 9 */
A. i = 6 and j = 5
B. i = 5 and j = 5
C. i = 6 and j = 6
D. i = 5 and j = 6
|
Show Answers | 1 | Post Your Answers | 29.11.11 Harsh |
Lang Interview Questions And Answers
Lang Interview Questions And AnswersLang Subjective Questions And Answers
Lang Subjective Questions And AnswersR4R,Lang Objective, Lang Subjective, Lang Interview Questions And Answers,Lang,Lang Interview,Lang Questions ,Lang Answers