APCSA 1.2 — Variables & Data Types

25 multiple‑choice questions (5 options each). The first option is the correct answer.

Unit 1 • Program Design & Development

Quiz

1) What is a variable in Java?
2) What are the three key parts of a variable?
3) Which of the following declares a variable correctly?
4) What is the process of giving a variable its first value called?
5) Which line both declares and initializes a variable?
6) Which data type holds whole numbers?
7) Which Java type is used for decimal numbers?
8) Which primitive type can store logical values like true or false?
9) Which primitive data type represents a single Unicode character?
10) Which of the following is NOT a primitive type in Java?
11) Which type is considered a reference type in Java?
12) Which statement correctly creates a String variable?
13) What does name.length() return for a String?
14) What will name.toUpperCase() do?
15) Why are Strings not considered primitive types?
16) Which assignment is valid (widening conversion)?
17) Which assignment causes a narrowing error without casting?
18) What symbol is used for String concatenation?
19) What is the output of System.out.println("Score: " + 100);?
20) Which example shows explicit casting?
21) What happens during a cast from double to int?
22) What does it mean that a variable must be declared before use?
23) Which statement is true about primitive vs reference types?
24) What is the correct way to change a variable’s value?
25) Which of the following best summarizes this unit?