Home

Tutoring

Subjects

Live Classes

Study Coach

Essay Review

On-Demand Courses

Colleges

Games

Opening subject page...

Loading your content

  1. My Subjects
  2. AP Computer Science Principles
  3. Flashcards

AP Computer Science Principles Flashcards: Variables And Assignments

Study Variables And Assignments in AP Computer Science Principles with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

โ† Back to flashcard decks

What this deck covers

This deck focuses on Variables And Assignments, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.

How to use these flashcards

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.

AP Computer Science Principles Flashcards: Variables And Assignments

1

/ 30

0 reviewed

0% Complete

0 reviewing
QUESTION

What keyword is used to declare a variable in JavaScript?

Tap or drag to reveal answer

ANSWER

var, let, or const. JavaScript variable declaration keywords.

Swipe Right = I Know It! ๐ŸŽ‰

Swipe Left = Still Learning

All flashcards

Flashcard 1: What keyword is used to declare a variable in JavaScript?

Answer: var, let, or const. JavaScript variable declaration keywords.

Flashcard 2: What is the result of the expression '10 - 2 * 5'?

Answer:

  1. Order of operations: 10โˆ’(2ร—5)=010 - (2 ร— 5) = 010โˆ’(2ร—5)=0.

Flashcard 3: What is a variable in programming?

Answer: A named storage location for data. Variables store values that can change during program execution.

Flashcard 4: Identify the error: int x = '3';

Answer: Incorrect type; use int x = 3;. Single quotes denote characters, not integers.

Flashcard 5: What symbol is used for assignment in most programming languages?

Answer: The equals sign (=). Assignment operator stores values in variables.

Flashcard 6: Identify the error: double y = 5.5.5;

Answer: Syntax error; use double y = 5.5;. Double decimal point makes number invalid.

Flashcard 7: What is the result of 'x = 10 % 3;'?

Answer:

  1. Modulus returns remainder: 10รท3=310 รท 3 = 310รท3=3 remainder 111.

Flashcard 8: What does 'String name = "John";' do?

Answer: Assigns "John" to the variable name. String variable declaration and initialization.

Flashcard 9: Find the value of y after: int y = 7; y -= 2;

Answer:

  1. Subtraction assignment: 7โˆ’2=57 - 2 = 57โˆ’2=5.

Flashcard 10: What type of error occurs when dividing by zero?

Answer: Arithmetic error. Division by zero is mathematically undefined.

Flashcard 11: What is the scope of a variable declared inside a function?

Answer: Local to that function. Function variables exist only within that function.

Flashcard 12: What is a constant in programming?

Answer: A variable with a fixed value. Constants cannot be modified after initialization.

Flashcard 13: What is the difference between 'int' and 'double'?

Answer: 'int' is for integers; 'double' is for decimals. Different data types for whole vs decimal numbers.

Flashcard 14: What is the output type of 'x / y' if x and y are int?

Answer: int. Integer division truncates decimal portion.

Flashcard 15: Which statement correctly assigns a value to a variable?

Answer: x = 5;. Proper assignment syntax with equals operator.

Flashcard 16: What does 'x -= 5;' do to x?

Answer: Decreases x by 5. Compound subtraction assignment operator.

Flashcard 17: What is the outcome of '3.0 / 2' in programming?

Answer: 1.5. Double division produces decimal result.

Flashcard 18: Which data type would you use for a list of values?

Answer: Array or List. Data structures for multiple related values.

Flashcard 19: Identify the error: int x = '3';

Answer: Incorrect type; use int x = 3;. Single quotes denote characters, not integers.

Flashcard 20: Find the value of y after: int y = 7; y -= 2;

Answer:

  1. Subtraction assignment: 7โˆ’2=57 - 2 = 57โˆ’2=5.

Flashcard 21: What is concatenation in programming?

Answer: Joining two strings together. String concatenation combines text values.

Flashcard 22: Which data type would you use for a true/false value?

Answer: Boolean. Boolean stores only true or false values.

Flashcard 23: What is the outcome of '3.0 / 2' in programming?

Answer: 1.5. Double division produces decimal result.

Flashcard 24: Which statement defines a variable in Python?

Answer: x = 10. Python uses simple assignment without type keywords.

Flashcard 25: Which data type would you use for a list of values?

Answer: Array or List. Data structures for multiple related values.

Flashcard 26: What happens if you exceed the range of an int variable?

Answer: Overflow occurs. Values wrap around when exceeding maximum range.

Flashcard 27: What is the result of the expression '10 - 2 * 5'?

Answer:

  1. Order of operations: 10โˆ’(2ร—5)=010 - (2 ร— 5) = 010โˆ’(2ร—5)=0.

Flashcard 28: What is the purpose of a variable declaration?

Answer: To specify a variable's type and name. Establishes variable name and data type.

Flashcard 29: Find the value of x after: int x = 5; x += 3;

Answer:

  1. Addition assignment operator: 5+3=85 + 3 = 85+3=8.

Flashcard 30: What is the scope of a variable declared inside a function?

Answer: Local to that function. Function variables exist only within that function.