AP CSA Unit 1: Lesson 4 Questions

0.0(0)
studied byStudied by 27 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
Assume the following has been typed in:
Scanner scan = new Scanner(System.in);
Which line of code declares a double y and sets it equal to input from the user?
double y = scan.nextDouble();
2
New cards
Which line of code declares a double variable z and sets it equal to 3.5?
double z = 3.5;
3
New cards
Is an int smaller in memory than a double?
True
4
New cards
What is printed by the following code?
int y = (13 - 7) / 4;
System.out.println(y);
1
5
New cards
What is output when the following code is executed?
double num = 2.0 * (26.75 - 20);
System.out.println(num);
13.5
6
New cards
What is output when the following code is executed?
double num = (0 - 3) * 5;
System.out.println(num);
-15.0
7
New cards
What is output when the following code is executed?
int x = -7;
x++;
x++;
x--;
System.out.println(x);
-6
8
New cards
What is output when the following code is executed?
int x = 13;
x++;
x++;
x -= 7;
x *= 3;
x--;
System.out.println(x);
23
9
New cards
Which of the following is a primitive data type?
"hello"
5.6
a7878
5.6
10
New cards
What data type takes the least memory?
boolean