AP CSA Unit 2 Test review

AP CSA Unit 2 Test review

11th Grade

•

34 Qs

quiz-placeholder

Similar activities

Defensive Design and Laws & Ethics

Defensive Design and Laws & Ethics

10th - 11th Grade

•

34 Qs

Principles of Computer Programming

Principles of Computer Programming

9th - 12th Grade

•

30 Qs

Chapter 1, 2 Test

Chapter 1, 2 Test

University

•

30 Qs

NETWORK1 M2 Quiz

NETWORK1 M2 Quiz

University

•

29 Qs

Adobe Premiere Pre-Test

Adobe Premiere Pre-Test

9th - 12th Grade

•

31 Qs

Excel Vocabulary Part 1

Excel Vocabulary Part 1

8th - 12th Grade

•

34 Qs

Object Oriented Programming-Finals

Object Oriented Programming-Finals

University

•

30 Qs

Skyrim Dovahzul Alphabet

Skyrim Dovahzul Alphabet

12th Grade - University

•

34 Qs

AP CSA Unit 2 Test review

AP CSA Unit 2 Test review

Assessment

Quiz

•

Computers

•

11th Grade

•

Practice Problem

•

Medium

Created by

James Santiago

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

34 questions

Show all answers

1.

MATCH QUESTION

30 sec • 5 pts

Match the following

(int) (Math.random() * 11 + 1)

Integer 0-10, inclusive

(int) (Math.random() * 20)

Integer 1-11, inclusive

 (Math.random()*10)

Integer 0-99, inclusive

(int) (Math.random()*100)

Integer 0-19, inclusive

(int) (Math.random() * 11)

0.0 <= x < 10.0

2.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Media Image

Consider the following code segment.

What is printed when the code segment is executed?

2

5

-1

2

5

2

2

6

-1

3

6

-1

-1

-1

2

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Media Image

The code segment below is intended to randomly print one of the values 2, 4, 6, or 8 with equal probability.

Which of the following can be used to replace /* missing code */ so that the code segment works as intended?

Math.random() * 4 + 1

Math.random() * 8

(int) (Math.random() * 4)

(int) (Math.random() * 4 + 1)

(int) (Math.random() * 8 + 1)

4.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Media Image

Consider the following code segment, which is intended to display 6.0.

Which of the following best describes the error, if any, in the code segment?

There are no errors and the code works as intended.

Either the numerator or the denominator of the fraction 1 / 2 should be cast as double.

The expression fact1 * fact 2 should be cast as double.

The expressions 1 / 2 and 3 * 4 should both be cast as double.

The variables fact1 and fact2 should both be declared as int.

5.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


What is the correct way to find the length of "txt" string?

int len = length(txt);

float len = txt.length();

int len = txt.length();

double len = length(txt);

6.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

System.out.println(1 + 2 + "3");

123

6

33

error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A standard way of visualizing the design of a program that displays class names, attributes, behaviors, and relationships to other classes is known as a(n):

Program Design Layout

Abstraction Model

UML Diagram

Class Hierarchy

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?