Classes Part 1 Re-Test
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
6 Questions
16 points
16
Question 1
1.
What is output by the code below?System.out.println( Math.sqrt(25) );
What is output by the code below?
System.out.println( Math.sqrt(25) );
16 points
16
Question 2
2.
What is output by the code below?System.out.println( (int)Math.pow( Math.sqrt(12),2) );
What is output by the code below?
System.out.println( (int)Math.pow( Math.sqrt(12),2) );
16 points
16
Question 3
3.
How many methods does Bird contain?(enter a number)public class Bird{ public void speak() { out.println("chirp-chirp"); } public void sayName() { out.println("baby bird"); } public void fly() { out.println("moving wings"); }}
How many methods does Bird contain?(enter a number)
public class Bird
{
public void speak()
{
out.println("chirp-chirp");
}
public void sayName()
{
out.println("baby bird");
}
public void fly()
{
out.println("moving wings");
}
}
16 points
16
Question 4
4.
What is output by the code below?public class Fun2{ public static int times(int num1, int num2) { return num1 * num2; }}System.out.println( Fun2.times(3 , 6) );
What is output by the code below?
public class Fun2
{
public static int times(int num1, int num2)
{
return num1 * num2;
}
}
System.out.println( Fun2.times(3 , 6) );
16 points
16
Question 5
5.
What is output by the code below?public class Fun2{ public static int times(int num1, int num2) { return num1 + num2; }}System.out.println( Fun2.times(15 , 25) );
What is output by the code below?
public class Fun2
{
public static int times(int num1, int num2)
{
return num1 + num2;
}
}
System.out.println( Fun2.times(15 , 25) );
20 points
20
Question 6
6.
Methods Free Response
Directions :: Write only one method named printMethod. It should output what below. In the most efficient way possible.
Output:
"AAAAAA"AAAAAA'AAAAAA'\AAAAAA\
Methods Free Response
Directions :: Write only one method named printMethod. It should output what below. In the most efficient way possible.
Output:
"AAAAAA"
AAAAAA
'AAAAAA'
\AAAAAA\