Free Exam: java programming exam
Number of Questions in Test: 10
Number of Questions in Preview: 5
Register to view all questions.
Note: Answers are not shown below but will be copied with this test.
Copy this test to my quiz maker account
Register with ClassMarker to copy free tests to give to your Test takers.
Register nowQuestion 1
[size=4]You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?[/size]
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |
Question 2
[code]public class Outer
{
public void someOuterMethod()
{
//Line 5
}
public class Inner { }
public static void main(String[] argv)
{
Outer ot = new Outer();
//Line 10
}
} [/code]
which of the following code fragments inserted, will allow to compile
{
public void someOuterMethod()
{
//Line 5
}
public class Inner { }
public static void main(String[] argv)
{
Outer ot = new Outer();
//Line 10
}
} [/code]
which of the following code fragments inserted, will allow to compile
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |
Question 3
[code]interface Base
{
boolean m1 ();
byte m2(short s);
}
[/code]
[size=4]which two code fragments will compile?[/size]
[ol][li][i][color=#dd0000][size=4]interface Base2 implements Base {}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 extends Base
{ public boolean m1(){ return true; }}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 implements Base {}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 implements Base
{ public boolean m1(){ return (7 > 4); }}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 implements Base
{ protected boolean m1(){ return (5 > 7) }}[/size][/color][/i][/li]
[/ol]
{
boolean m1 ();
byte m2(short s);
}
[/code]
[size=4]which two code fragments will compile?[/size]
[ol][li][i][color=#dd0000][size=4]interface Base2 implements Base {}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 extends Base
{ public boolean m1(){ return true; }}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 implements Base {}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 implements Base
{ public boolean m1(){ return (7 > 4); }}[/size][/color][/i][/li]
[li][i][color=#dd0000][size=4]abstract class Class2 implements Base
{ protected boolean m1(){ return (5 > 7) }}[/size][/color][/i][/li]
[/ol]
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |
Question 4
[table][tr][td][size=4]Which three form part of correct array declarations?
[/size][ol][li]public int a [ ][/li][li]static int [ ] a[/li][li]public [ ] int a[/li][li]private int a [3][/li][li]private int [3] a [ ][/li][li]public final int [ ] a[/li][/ol]
[/td][/tr][/table]
[/size][ol][li]public int a [ ][/li][li]static int [ ] a[/li][li]public [ ] int a[/li][li]private int a [3][/li][li]private int [3] a [ ][/li][li]public final int [ ] a[/li][/ol]
[/td][/tr][/table]
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |
Question 5
[code]public class Test { }
[/code]
[size=4]What is the prototype of the default constructor?[/size]
[/code]
[size=4]What is the prototype of the default constructor?[/size]
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |