Search Header Logo

APCSA Unit 4 test

Authored by Thomas Wright

Computers

9th Grade

Used 18+ times

APCSA Unit 4 test
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

35 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a method that loops until the user inputs the correct secret password or until the user fails to enter the correct password 10 times. The secret password the program should look for is the String "secret"

Assume that a Scanner object called input has been correctly initialized.

Media Image
Media Image
Media Image
Media Image

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What would the method call myMethod("Karel The Dog", 'e') return?

1

2

3

4

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What kind of error would the method call myMethod("Frog") cause?

Compile Time Error: String index out of range

Runtime Error: String index out of range

Compile Time Error: Unexpected return value

Runtime Error: Syntax Error in method definition

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the call to the method funWithNumbers(314159) print to the screen?

314159

951413

314

951

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What does the call to the method someMethod(3,1) output?

9

12

11

10

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a method that will ask for user input until user inputs the String “no”. Allow the user to input any capitalization of the String “no” (“no”, “No”, “NO”, “nO”) Also, have the method return the number of loops.

Assume that a Scanner object input has already been created.

Media Image
Media Image
Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the call to method patternGrid(3,4,'#') print?

####

####

####

###

###

###

####

####

####

####

This code will error.

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?