Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Question 2 of 61
Which one of these is a proper definition of a class TestClass that cannot be sub-classed?
Question 4 of 61
The following class will print '2' when compiled and run.
class Test
{
public static int[ ] getArray() { return null; }
public static void main(String[] args)
{
int index = 1;
try
{
getArray()[index=2]++;
}
catch (Exception e){ } //empty catch
System.out.println("index = " + index);
}
}
Question 5 of 61
Question 6 of 61
What letters, and in what order, will be printed when the following program is compiled
and run?
(See Exhibit)
public class FinallyTest
{
public static void main(String args[]) throws Exception
{
try
{
m1();
System.out.println("A");
}
finally
{
System.out.println("B");
}
System.out.println("C");
}
public static void m1() throws Exception { throw new Exception(); }
}
Question 9 of 61
Consider
Which of the
the following
following class:
statements are true?
public class GoodOne
Select 2 correct options
{
a The modulus
int theval;operator % can only be used with integer operands.
b & public
can haveint
integral as well as boolean operands.
hashCode()
c {
The arithmetic operators *, / and % have the same level of precedence.
return theval%3;
d && } can have integer as well as boolean operands.
e ~ can have boolean
public integer as equals(Object
well as boolean operands.
obj)
{
Question 16 of 61
// 1 insert code here.
}
Consider
} the following class...
class
Which ofMyString extends
the following String
options may be insterted at //1?
{
MyString(){ super(); }
Select
} 1 correct option.
a return true;
b above
The return
code
theval%3
will not==
compile.
0? true :false;
c return theval%2 == 0? true :false;
Select
d 1return
correct option.
( (int)Math.random())*10%3 == 0? true :false;
a
e True
return false;
b False
Question 17 of 61