AP CSA Unit 2: Lesson 1 Questions

0.0(0)
studied byStudied by 310 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards
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";
2
New cards
Consider the following code:
String a = "determined";
String b = "learner";
System.out.println(a + "-" + b);
What is the output?
determined-learner
3
New cards
Consider the following code:
int a = 43;
int b = 17;
System.out.println(a % b);
What is the output?
9
4
New cards
_____ data types can hold many pieces of information at a time.
class
5
New cards
Java allocates a space in memory called a(n) _____.
reference
6
New cards
To define an empty variable, ____ keyword can be used.
null
7
New cards
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;
8
New cards
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
9
New cards
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
10
New cards
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