Back to marketplace

Unit 1: Primitive Types

No description yet. This curated deck is ready for daily study.

Total cards: 21•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (21)

#1
Front (Question)

What are primitives?

Back (Answer)

Primitives are the simplest elements available in a programming language. Ex. int, double, char, boolean

#2
Front (Question)

What is the correct way to initialize a primitive? a) (Type) (Name) = new (Type)(); b) (Name (Type) = (Value); c) (Type) (Name) = (Value); d) (Type) (Name) == (Value);

Back (Answer)

c) (Type) (Name) = (Value); ex: int num = 10;

#3
Front (Question)

What values can int hold?

Back (Answer)

The int data type stores whole numbers from -2,147,483,648 to 2,147,483,647.

#4
Front (Question)

What values does double hold?

Back (Answer)

The double data type stores decimal numbers up to 15 decimal digits

#5
Front (Question)

What values does char hold?

Back (Answer)

The char data type stores a single character/letter or ASCII values.

#6
Front (Question)

What is casting?

Back (Answer)

Type casting is when you assign a value of one primitive data type to another type. Ex. int total = 100; int numPeople = 40; double average = total / (double) numPeople; //Average will equal 2.5 as a double

#7
Front (Question)

What is a compound assignment operator?

Back (Answer)

A simpler way to assign an arithmetic value to a pre-existing value. (+= , /=, *=, -=) Ex: int num = 8; num += 7; //Now num will equal 15

#8
Front (Question)

What is the correct way to create a Scanner object? a) Scanner = new Scanner(System.in); b) Scanner name = new scanner; c) Scanner name = new Scanner(System.in); d) Scanner name = System.in;

Back (Answer)

c) Scanner objectName = new Scanner(System.in);

#9
Front (Question)

What does “final” do when used while initializing a primitive?

Back (Answer)

The word "final" makes it such that you cannot modify the variable after its initialization. Ex. final String name = "Chad"; //This String will always be Chad.

#10
Front (Question)

How do you swap the data stored in two variables of the same type?

Back (Answer)

Through the use of a temp variable that stores the data of one of the variables so that it is not lost. For example, if you have variables a and b, and you want to switch their values: int temp c; c = a; a = b; b = c;

#11
Front (Question)

What does modulus (%) do?

Back (Answer)

It returns the remainder of a division operation. Ex. 25%7 = 4 Ex. 25%5 =0

#12
Front (Question)

What is a reference type?

Back (Answer)

An example of a reference value would be a string. Reference variables store the address of the value.

#13
Front (Question)

What is the correct way to name a variable?

Back (Answer)

Variables names must start with a letter, $, or _ and be lowerCamelCase examples include: - numApples - $numApples - _numApples

#14
Front (Question)

What does a String hold?

Back (Answer)

A String holds a list of ASCII characters or numbers. For example any word in the English language. Ex. String numbers = “123456789101123456789011223344556677”; String words = “Cat dog mice cows horses !@#$%^&&* more things”;

#15
Front (Question)

Is a string a Primitive

Back (Answer)

It is not because it has chars in it

#16
Front (Question)

int thing = 2*2.2;

Back (Answer)

4

#17
Front (Question)

double thing = 2.2 *2;

Back (Answer)

4.4

#18
Front (Question)

How do you print things out

Back (Answer)

System.out.print(“THing”); or System.out.println(“THings”);

#19
Front (Question)

What is the Answer of this expression? 4 + 8 * 3 / 4 + 5 % 2 = ? A.) 5 B.) 6 C.) 12 D.) 11

Back (Answer)

D.) 11 PEMDAS don’t forget that modulus is treated as multiplication or division so don’t forget to follow the order of operations.

#20
Front (Question)

What is the result of the following expression when x is 125? x % 6

Back (Answer)

5 Don’t forget that modulus returns the remainder.

#21
Front (Question)

Which of the following values can correctly be saved in a boolean? A.)False B.)Yes C.)no D.)true

Back (Answer)

D.) true Boolean values in java save true/false values without a capitalized letter