AP CSA Unit 2: Lesson 1 Questions

studied byStudied by 303 people
0.0(0)
Get a hint
Hint

Which of the following lines of code create a String variable z and set it equal to the word "Strings are String-y"?

1 / 9

flashcard set

Earn XP

Description and Tags

10 Terms

1

Which of the following lines of code create a String variable z and set it equal to the word "Strings are String-y"?

String z = "Strings are String-y";

New cards
2

Consider the following code: String a = "determined"; String b = "learner"; System.out.println(a + "-" + b); What is the output?

determined-learner

New cards
3

Consider the following code: int a = 43; int b = 17; System.out.println(a % b); What is the output?

9

New cards
4

_____ data types can hold many pieces of information at a time.

class

New cards
5

Java allocates a space in memory called a(n) _____.

reference

New cards
6

To define an empty variable, ____ keyword can be used.

null

New cards
7

Which of the following would set the String variable hobby to be completely empty (i.e. not even storing a memory address)?

String hobby = null;

New cards
8

Which of the following are true about class data types? Click all that apply.

can hold multiple pieces of data of different types can be created can be customized

New cards
9

Consider the following code: String a = "first"; String b = a; a = "second"; System.out.println(a + " " + b); What is printed when the code is run?

second first

New cards
10

Consider the following code: String a = "first"; a = "second"; String b = a; System.out.println(a + " " + b); What is printed when the code is run?

second second

New cards

Explore top notes

note Note
studied byStudied by 31 people
Updated ... ago
5.0 Stars(3)
note Note
studied byStudied by 18 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 391 people
Updated ... ago
4.0 Stars(1)
note Note
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)

Explore top flashcards

flashcards Flashcard138 terms
studied byStudied by 24 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard44 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard70 terms
studied byStudied by 122 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard71 terms
studied byStudied by 21 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard36 terms
studied byStudied by 17 people
Updated ... ago
5.0 Stars(3)
flashcards Flashcard22 terms
studied byStudied by 25 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard89 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard204 terms
studied byStudied by 19 people
Updated ... ago
5.0 Stars(1)