AP CS A - Java Scanner Input

AP CS A - Java Scanner Input

Assessment

Quiz

Computers

9th - 12th Grade

Easy

Created by

Keith Fiore

Used 32+ times

FREE Resource

Student preview

quiz-placeholder

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following would correctly define and instantiate a Scanner?

Scanner kb = Scanner(in);

Scanner kb = new Scanner(in);

Scanner new kb = Scanner(in);

Scanner kb = new kb(in);

none of these

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following Scanner methods can be used to read in a int?

nextInt()

next()

nextInts()

nextDouble()

nextInteger()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following Scanner methods can be used to read in a double?

nextInt()

nextDble()

nextDouble()

next()

nextLine()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following Scanner methods can be used to read in a String?

nextInt()

nextWord()

nextDouble()

next()

nextLine()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following Scanner methods can be used to read in a line of words?

nextInt()

nextDble()

nextDouble()

next()

nextLine()

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the following statement, var must be defined as which of the following types?

var = keyboard.nextInt();

short

String

double

int

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the following statement, var must be defined as which of the following types?

var = keyboard.nextLine();

short

String

double

int

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?