Twa kɔ nsɛm atitiriw so
Log in
Sign up for FREE
arrow_back
Laabri

Array of Ref Quiz

star
star
star
star
star
Last updated about 2 years ago
10 Nsɛmmisa
1
1
1
1
1
1
1
1
1
1
Asemmisa {{asɛmmisaAhyɛnsode}}
1.

What is output by the code below?

String[] x;

x = new String[6];

System.out.println( x[2] );

Asemmisa {{asɛmmisaAhyɛnsode}}
2.

What is output by the code below?

String[] x;

x = new String[7];

x[1] = "go";

x[4] = "up";

x[2] = "by";

System.out.println( x[1] );

Asemmisa {{asɛmmisaAhyɛnsode}}
3.

What is output by the code below?

String[] x;

x = new String[7];

x[1] = "go";

x[4] = "up";

x[2] = "by";

System.out.println( x[0] );

Asemmisa {{asɛmmisaAhyɛnsode}}
4.

What is output by the code below?

String[] x;

x = new String[7];

x[1] = "go";

x[4] = "up";

x[2] = x[4];

x[4] = null;

System.out.println( x[2] );

Asemmisa {{asɛmmisaAhyɛnsode}}
5.

What is output by the code below?

String[] x;

x = new String[7];

x[1] = "go";

x[4] = "up";

x[2] = x[4];

x[4] = null;

System.out.println( x[2].length() );

Asemmisa {{asɛmmisaAhyɛnsode}}
6.

Consider the following class definitions.

public class Cat

{

private String name:

private int age;

public Cat( String n, int a )

//implementation not shown

public String getName()

//implementation not shown

public int getAge()

//implementation not shown

//other methods not shown

}

//client code in another class

Cat[] bunch = new Cat[5];

System.out.println( bunch[0] );

Asemmisa {{asɛmmisaAhyɛnsode}}
7.

Consider the following class definitions.

public class Cat

{

private String name:

private int age;

public Cat( String n, int a )

//implementation not shown

public String getName()

//implementation not shown

public int getAge()

//implementation not shown

//other methods not shown

}

//client code in another class

Cat[] bunch = new Cat[5];

System.out.println( bunch.length );

Asemmisa {{asɛmmisaAhyɛnsode}}
8.

Consider the following class definitions.

public class Cat

{

private String name:

private int age;

public Cat( String n, int a )

//implementation not shown

public String getName()

//implementation not shown

public int getAge()

//implementation not shown

//other methods not shown

}

//client code in another class

Cat[] bunch = new Cat[5];

bunch[0] = new Cat("rocket", 8);

System.out.println( bunch[0].getAge() );

Asemmisa {{asɛmmisaAhyɛnsode}}
9.

Consider the following class definitions.

public class Cat

{

private String name:

private int age;

public Cat( String n, int a )

//implementation not shown

public String getName()

//implementation not shown

public int getAge()

//implementation not shown

//other methods not shown

}

//client code in another class

Cat[] bunch = new Cat[5];

bunch[0] = new Cat("rocket", 8);

bunch[3] = new Cat("sam", 15);

bunch[4] = new Cat("ben", 12);

System.out.println( bunch[3].getAge() );

Asemmisa {{asɛmmisaAhyɛnsode}}
10.

Consider the following class definitions.

public class Cat

{

private String name:

private int age;

public Cat( String n, int a )

//implementation not shown

public String getName()

//implementation not shown

public int getAge()

//implementation not shown

//other methods not shown

}

//client code in another class

Cat[] bunch = new Cat[5];

bunch[0] = new Cat("rocket", 8);

bunch[3] = new Cat("sam", 15);

bunch[4] = bunch[3];

bunch[3] = bunch[0];

System.out.println( bunch[4].getAge() );