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

Semester Final CS3 (1/11/2024)

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

What is output by the code below?

String[] ray;

ray = new String[4];

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

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

What is output by the code below?

Integer[] ray;

ray = new Integer[4];

System.out.println( ray[3] );

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

What is output by the code below?

Integer[] ray;

ray = new Integer[4];

ray[1] = null;

ray[0] = new Integer(3);

ray[2] = new Integer(99);

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

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

What is output by the code below?

Integer[] ray = {11,55,-4,909};

System.out.println( ray[3] );

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

What is output by the code below?

Double[] ray = {11.2,55.0,-4.5,909.0};

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

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

What is output by the code below?

Double[] ray = {11.2,7.2,-4.5,909.0};

ray[1] = new Double(55.0);

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

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

What is output by the code below?

Double[] ray = {3.2,5.7,6.3,1.9};

double x = 0;

for( double r : ray )

x += r;

System.out.println( x );

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

What is output by the code below?

Double[] ray = {3.1,5.2,6.3,1.4};

for( double r : ray )

r = 0;

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

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

What is output by the code below?

String[] ray;

ray = new String[4];

ray[1] = "one";

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

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

What is output by the code below?

String[] ray;

ray = new String[4];

ray[1] = "one";

ray[2] = "two";

ray[3] = "three";

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

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

What do you call the condition that stops recursion?

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

What is returned the call fun(6) ?

public static int fun(int x)

{

if(x < 1)

return 1;

else

return x + fun(x - 1);

}

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

What is returned by the call fun(8) ?

public static int fun(int x)

{

if(x < 1)

return 1;

else

return x + fun(x - 1);

}

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

What is returned by the call fun(8) ?

public static int fun(int x){

if(x < 1)

return 1;

else

return x + fun(x - 2);

}

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

What is returned by the call fun(6) ?

public static int fun(int x){

if(x < 1)

return 1;

else

return x + fun(x - 2);

}

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

What is returned by the call fun(10) ?

public static int fun(int x)

{

if (x < 1)

return x;

else

return x + fun(x - 2);

}