AP CSA Unit 2: Lesson 2 Questions

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

How could you create a String variable, s, and set it equal to "Fast Start" in one line?

1 / 9

flashcard set

Earn XP

Description and Tags

10 Terms

1

How could you create a String variable, s, and set it equal to "Fast Start" in one line?

String s = "Fast Start";

New cards
2

Consider the following code: int x = 13; int y = 7; System.out.println(x % y); What is the output?

6

New cards
3

What is a double?

A double is a primitive data type so a double variable directly stores the data for the double.

New cards
4

Consider the following code: int x = 27; int y = 13; System.out.print("Answer: " + x + y); This code outputs: Answer: 2713

True

New cards
5

Consider the following code: System.out.println("Answer: " + (3 + 7)); This code outputs: Answer: 10

True

New cards
6

What will be printed by the following code? System.out.println("I came,\tI saw,\n\tI left.");

I came, I saw, I left.

New cards
7

To output: Nums: [31, 43, 28, 17 ] You would need to use what escape sequence in the blank: System.out.print("Nums: [31, 43, 28, 17____]");

\n

New cards
8

Which of the following symbols need an escape character to be output in a System.out.print statement?

New cards
9

What does \t do?

It puts a tab space in between two characters

New cards
10

Consider the following code: System.out.println("Answer: " + (5.0 + 9)); This code outputs: Answer: 14

False

New cards

Explore top notes

note Note
studied byStudied by 23 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 41 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 46 people
Updated ... ago
4.0 Stars(1)
note Note
studied byStudied by 91 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 26 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 30060 people
Updated ... ago
4.4 Stars(24)

Explore top flashcards

flashcards Flashcard36 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard117 terms
studied byStudied by 66 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard27 terms
studied byStudied by 16 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard103 terms
studied byStudied by 16 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard47 terms
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard29 terms
studied byStudied by 15 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard46 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard40 terms
studied byStudied by 65 people
Updated ... ago
5.0 Stars(1)