Search Header Logo

Quiz 3

Authored by Kyle Yap

World Languages

1st - 5th Grade

Used 2+ times

Quiz 3
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

19 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_01. What is the output of the following program? Be precise about where there are spaces and where there are newlines.

public class Ex4_1{

public static void zoop() {

baffle();

System.out.print("you foo ");

baffle(); }

public static void main(String[] args) {

System.out.print("No, I ");

zoop();

System.out.print("I ");

baffle(); }

public static void baffle() {

System.out.print("baz");

ping(); }

public static void ping() {

System.out.println("."); } }

the program doesn't stop

No, I baz.
you foo baz.
I baz.

none of the other choices is correct

you foo baz.
No, I baz.
I baz.

you foo baz.
No, I baz.
I baz.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_02. What is the output of the following program?

public class Ex4_2{

public static void zoop() {

baffle();

System.out.print("you foo ");

baffle(); }

public static void main(String[] args) {

System.out.print("No, I ");

zoop();

System.out.print("I ");

baffle(); }

public static void baffle() {

System.out.print("baz");

ping(); }

public static void ping() {

System.out.println(".");

baffle(); } }

you foo baz.
No, I baz.
I baz.

none of the other choices is correct

the program doesn't stop

No, I baz.
you foo baz.
I baz.

you foo baz.
No, I baz.
I baz.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_03. Choose what would be the correct first line of a method named zool that takes three parameters: an int and two Strings.

none of the other choices is correct

 

    public void zool(int i, String s1, String s2)

 

    public void zool(int i, String s1, s2)

 

    public  zool(int i , String ss, String ss)

 

    public void zool(int, Str, Str)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_04. Identify the line of code that calls a method named zool, that takes three parameters: an int and two Strings, passing as arguments the value 11, the String "hello" and the String "world".

 

    public void zool(11,"hello","world")

 

zool(11, hello, world)

 

 zool(int, Str, Str)

 

none of the other choices is correct

 

zool(11,"hello", "world")

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_06. Suppose you have a static method called printAmerican that takes the month (e.g. "July"), day (e.g. 23), year (e.g. 2018), and day of the week (e.g. "Thursday") as parameters and displays them in American format (e.g. Thursday, July 23, 2018).  Which one of the following programs calls the method correctly to print the date.

public class PrintAmerican{

    //method diefition goes here

    public static void main(String[] aaa){

        PrintAmerican("July", 23, 2018, "Thursday");

    }

}

PrintAmerican.PrintAmerican("July", 23, 2018, "Thursday");


public class PrintAmerican{

    

    //method definition goes here

    

    public static void main(String[] aaa){

        main.PrintAmerican("July", 23, 2018, "Thursday");

    }

}

 

none of the other choices is correct


public class PrintAmerican{

    

    //method definition goes here

    

    public static void foo(String[] aaa){

        PrintAmerican("July", 23, 2018, "Thursday");

    }

}

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_07. in the following code the print statements  are numbered (the numbers look like //1, //2, //3, //4)

list the numbers in the order in which they are executed.

public class foo{
    public static void main(String[] args) {
        zippo("foo");
        System.out.println("foo");//1
        baffle("zoo");
    }
    public static void baffle(String blimp) {
        System.out.println(blimp);//2
    }
    public static void zippo(String quince) {
        System.out.println(quince);//3
        System.out.println(quince);//4
    }
}

 

3142

 

none of the other answers is correct

3412

1324

3124

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

TJ04_08. in order to use the Math class you must first import the package that contains it.

True

False

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?