What this deck covers
This deck focuses on Assignment Statements And Input, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Study Assignment Statements And Input in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
Identify the error in 'boolean flag = "true";'
Tap card or press Space to flip
Should be: boolean flag = true;. Boolean variables require boolean literals, not strings.
How well did you know it?
Card 1 / 68
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Assignment Statements And Input, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: Should be: boolean flag = true;. Boolean variables require boolean literals, not strings.
Answer: Integer.parseInt("123");. Converts String representation to int value.
Answer: 6 apples. Arithmetic is evaluated first, then concatenated with string.
Answer: Cannot assign String to int. String literal cannot be stored in int variable.
Answer:
Answer: The boolean data type. Stores either true or false values in Java.
Answer: Declares and initializes 'a' with 7. Creates variable and assigns initial value in one statement.
Answer:
Answer: Correct: int num = 10;. Cannot assign String literal to int variable.
Answer: 8.0. Calculates 23 which equals 8.0.
Answer: sc.nextInt();. Reads next integer token from input stream.
Answer: The 'final' keyword. Prevents variable value from being changed after initialization.
Answer: int a;. Declares variable without assigning a value.
Answer: An assignment statement assigns a value to a variable. It stores a value in memory using the = operator.
Answer: The result is 3. Integer division truncates the decimal portion.
Answer: Integer.parseInt("123");. Converts String representation to int value.
Answer: 2.5. At least one operand is double, so result is double.
Answer: The boolean data type. Stores either true or false values in Java.
Answer: import java.util.Scanner;. Required before using Scanner in your program.
Answer: It is used for input from the keyboard. Standard input stream for reading user data.
Answer: false. Boolean variables automatically initialize to false.
Answer: The 'final' keyword. Prevents variable value from being changed after initialization.
Answer: true. The equality comparison evaluates to boolean true.
Answer: 2.5. At least one operand is double, so result is double.
Answer: The result is 3. Integer division truncates the decimal portion.
Answer: char c;. Declares single character variable.
Answer: The equal sign '=' is used for assignment. Not to be confused with == which tests equality.
Answer: Cannot assign String to int. String literal cannot be stored in int variable.
Answer: sc.nextLine();. Reads entire line including spaces until newline.
Answer: 8.0. Calculates 23 which equals 8.0.
Answer: The '==' operator. Compares values for equality, returns boolean.
Answer: sc.nextLine();. Reads entire line including spaces until newline.
Answer:
Answer: sc.nextDouble();. Reads floating-point number from input stream.
Answer: It is used for input from the keyboard. Standard input stream for reading user data.
Answer: The equal sign '=' is used for assignment. Not to be confused with == which tests equality.
Answer: float f;. Declares floating-point variable without initialization.
Answer: true. The equality comparison evaluates to boolean true.
Answer:
Answer: false. Boolean variables automatically initialize to false.
Answer: Declares and initializes 'a' with 7. Creates variable and assigns initial value in one statement.
Answer: Missing closing parenthesis ')'. Constructor call needs both opening and closing parentheses.
Answer: double d;. Declares double-precision floating-point variable.
Answer: // for single line comments. Text after these symbols is ignored by compiler.
Answer: 6.0. Double operand makes result a double value.
Answer: The '==' operator. Compares values for equality, returns boolean.
Answer: An assignment statement assigns a value to a variable. It stores a value in memory using the = operator.
Answer:
Answer: // for single line comments. Text after these symbols is ignored by compiler.
Answer: float f;. Declares floating-point variable without initialization.
Answer: String s = "Hello";. String literals are enclosed in double quotes.
Answer: sc.nextInt();. Reads next integer token from input stream.
Answer:
Answer: 6 apples. Arithmetic is evaluated first, then concatenated with string.
Answer: Correct: int num = 10;. Cannot assign String literal to int variable.
Answer: import java.util.Scanner;. Required before using Scanner in your program.
Answer: String s = "Hello";. String literals are enclosed in double quotes.
Answer: int a;. Declares variable without assigning a value.
Answer:
Answer: 6.0. Double operand makes result a double value.
Answer:
Answer:
Answer: sc.nextDouble();. Reads floating-point number from input stream.
Answer: Missing closing parenthesis ')'. Constructor call needs both opening and closing parentheses.
Answer: Should be: boolean flag = true;. Boolean variables require boolean literals, not strings.
Answer: char c;. Declares single character variable.
Answer:
Answer: double d;. Declares double-precision floating-point variable.