Search Header Logo

Java Basics 2

Authored by Tim Jones

Computers

9th Grade - University

Used 5+ times

Java Basics 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the following method declaration, what is the name of the method?

public static void showMenu(String category) {}

public

static

void

showMenu

String

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the following method declaration header, how many formal parameters are there?

public static double squareRoot(double value)

0

1

2

None. Methods do not have formal parameters

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What word is missing below (fill in the __________). The method called increaseTemperature takes 2 integers as formal parameters. The two parameters represent the upper and lower targets. The method returns the difference between the upper and lower targets as an integer.

public static _________ increaseTemperature(int upper, int lower) { return upper - lower;}

void

double

int

return

Nothing. No word is needed in the blank space.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this main() method?


public static void main(String [] args) {

System.out.print("A");

processRequest();

System.out.print("B"); System.out.print("C");

showMenu();

System.out.print("D");}


public static void showMenu() { System.out.print("Q");}

public static void eraseFile() { System.out.print("T");}

public static void processRequest() { System.out.print("2");}

ABCDQT2

A2BDCTQ

A2BCQD

A2CBQD

A2BCQTD

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The following code in the main is valid:

public static void main(String [] args) {

int value; value = createGameCharacter();

// rest of program}

public static void createGameCharacter() { // code}

true

false

Impossible to determine

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The following code in the main is valid:

public static void main(String [] args) {

int value; value = depositMoney(amount); // rest of program}

public static int depositMoney() { return 4;}

true

false

Impossible to determine

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this main() method?

public static void main(String [] args) {

int value; loadSong(5);

value =checkLength(1);

System.out.print(value);

public static void loadSong(int id) { System.out.print(id);}

public static int checkLength(int id) { System.out.print(id); id = id + 4; System.out.print(id); return 9;}

5199

5559

5159

519

5

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?