Search Header Logo

AP CS A Semester 1 Review

Authored by Lindsay Schwisow

Computers

10th - 12th Grade

Used 11+ times

AP CS A Semester 1 Review
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

33 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

If String str has value "brouhaha", then the expression str.indexOf("ha") returns a value of 6.

TRUE

FALSE

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The expression "baseball".substring(2) returns "seball".

TRUE

FALSE

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

If you wanted to check to see if two numerical values were equal, which operator would you use?

=
!=
equals
==

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

To check if some integer x was evenly divisible by another integer y, which line of code would you use?

if ( x / y = 0)
if ( x / y == 0 )
if ( x % y == 0 )
if ( x % y = 0 )

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

To generate a random integer between 10 - 100, which line of code would you use?

int randomInt = 10 + (int) ( Math.random() * ( ( 100 - 10 ) + 1 ) )
int randomInt = 10 + (int) Math.random() * ( ( 100 - 10 ) + 1 ) 
int randomInt = (int) ( Math.random(10, 100 )
int randomInt = (int) ( Math.random(10, 100)  ) + 1

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What would the result of this code be?
int x = 0;
while ( x < 5 )
{
System.out.print( "Hello" );
}

It would print "Hello" 5 times
It would print "Hello" 4 times
It would print "Hello" an infinite number of times.
It would print Hello once and then generate an error.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does this operator mean?
||

and
or
exclusive or
not equal to

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?