Question 31.
Read this piece of code carefully
if("String".replace('T','t') == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
Answers
Question 32.
Read this piece of code carefully
System.out.println("String".substring(0,4));
Answers
Question 33.
Read this piece of code carefully
if("String".replace('g','G') == "String".replace('g','G'))
System.out.println("Equal");
else
System.out.println("Not Equal");
Answers
Question 34.
public class ADirtyOne
{
public static void main(String args[])
{
System.out.println(Math.abs(Integer.MIN_VALUE));
}
}
an attempt to compile and run the above class will
Question 35.
public class ADirtyOne
{
public static void main(String args[])
{
System.out.println(Math.min(0.0,-0.0));
}
}
An attempt to compile and run the above class will
Question 36.
public class Base
{
public void aMethod() throws ClassNotFoundException
{
}
}
public class Derived extends BaseAssuming that the classes are in two seperate files, compilation of the Dervied.java causes
{
public void aMethod() throws RuntimeException
{
}
}
Question 37.
Math.round(Float.MAX_VALUE);
Question 38.
Read the code below carefully
import java.awt.*;
public class TestFrame extends Frame
{Button bNorth = new Button("North");}
Button bSouth = new Button("South");
Button bEast = new Button("East");
Button bWest = new Button("West");
Button bCenter = new Button("Center");public TestFrame()
{
setLayout(new BorderLayout());
add(bSouth,BorderLayout.SOUTH);
add(bWest,BorderLayout.WEST);
add(bEast,BorderLayout.EAST);
add(bNorth,BorderLayout.NORTH);
add(bCenter);setLayout(new FlowLayout());
validate();
pack();
setVisible(true);
}public static void main(String args[])
{
TestFrame tf = new TestFrame();
}
What will be the effect trying compile and run the above class?
Question 39.
import java.awt.*;
public class TestFrame extends Frame
{Button bNorth = new Button("North");
Button bSouth = new Button("South");
Button bEast = new Button("East");
Button bWest = new Button("West");
Button bCenter = new Button("Center");public TestFrame()
{
setLayout(new FlowLayout());
add(bNorth);
add(bSouth);
add(bWest);
add(bEast);
add(bCenter);setLayout(new BorderLayout());
validate();
setSize(300,300);
setVisible(true);
}public static void main(String args[])
{
TestFrame tf = new TestFrame();
}
}
Attemping to compile and run the above code
|
|
|
|
|
|
|
|
|
|
|
|
Question 40.
A frame uses BorderLayout Management and has components added to all
the regions. One resizing the Frame Some space becomes available. The space
is alloted to the regions, in which Order of preference?