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: Identifying And Correcting Errors

Study Identifying And Correcting Errors 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 Identifying And Correcting Errors, 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: Identifying And Correcting Errors

1

/ 30

0 reviewed

0% Complete

0 reviewing
QUESTION

Which Python keyword is used to handle exceptions?

Tap or drag to reveal answer

ANSWER

try. Used with except to catch and handle errors.

Swipe Right = I Know It! 🎉

Swipe Left = Still Learning

All flashcards

Flashcard 1: Which Python keyword is used to handle exceptions?

Answer: try. Used with except to catch and handle errors.

Flashcard 2: What is the purpose of 'break' in a loop?

Answer: Exits the loop prematurely. Immediately terminates loop execution and continues after loop.

Flashcard 3: What is the result of '3 ** 2' in Python?

Answer: Result: 9. Double asterisk performs exponentiation in Python.

Flashcard 4: Find the error in 'while (x = 10): pass' in Python.

Answer: Use '==' for comparison: 'while (x == 10): pass'. Assignment operator used instead of equality comparison.

Flashcard 5: What is the output of '10 / 3' in Python 3?

Answer: Output: 3.3333... Python 3 performs true division by default.

Flashcard 6: What is the correct method to add an element to a list in Python?

Answer: list.append(element). Standard method to add elements to Python lists.

Flashcard 7: What operator is used to check equality in Python?

Answer: ==. Double equals tests equality, single equals assigns values.

Flashcard 8: What is the result of '7 % 2' in Python?

Answer: Result: 1. Modulo operator returns remainder of division operation.

Flashcard 9: Identify the error in 'if x > 5 then y = 10;' in Python.

Answer: Remove 'then': 'if x > 5: y = 10'. Python doesn't use 'then' keyword in if statements.

Flashcard 10: What is the correct way to start a comment in Python?

Answer: #. Hash symbol starts single-line comments in Python.

Flashcard 11: Find the error in 'print 5 + 5' in Python 3.

Answer: Use parentheses: 'print(5 + 5)'. Python 3 requires parentheses for print function calls.

Flashcard 12: What is the value of 10 mod 3?

Answer: Value: 1. Modulo operation returns remainder after division.

Flashcard 13: What is the error in 'if (x > y) print('x is greater');' in Python?

Answer: Use a colon: 'if (x > y): print('x is greater');'. Python if statements require colon after condition.

Flashcard 14: What is the hexadecimal representation of the decimal number 15?

Answer: Hexadecimal: F. 15 in decimal equals F in hexadecimal (base 16).

Flashcard 15: What is the output of 'print(2 ** 3)' in Python?

Answer: Output: 8. Double asterisk is the exponentiation operator in Python.

Flashcard 16: What is the purpose of the 'return' statement in a function?

Answer: Returns a value from a function. Exits function and sends value back to caller.

Flashcard 17: Find the error in 'print 5 + 5' in Python 3.

Answer: Use parentheses: 'print(5 + 5)'. Python 3 requires parentheses for print function calls.

Flashcard 18: What is the hexadecimal representation of the decimal number 15?

Answer: Hexadecimal: F. 15 in decimal equals F in hexadecimal (base 16).

Flashcard 19: What is the binary representation of the decimal number 10?

Answer: Binary: 1010. Convert decimal to binary using powers of 2.

Flashcard 20: What is the output of 'print(2 ** 3)' in Python?

Answer: Output: 8. Double asterisk is the exponentiation operator in Python.

Flashcard 21: What is the error in 'if (x > y) print('x is greater');' in Python?

Answer: Use a colon: 'if (x > y): print('x is greater');'. Python if statements require colon after condition.

Flashcard 22: What is the value of 10 mod 3?

Answer: Value: 1. Modulo operation returns remainder after division.

Flashcard 23: What is the ASCII value for the character 'A'?

Answer: ASCII: 65. Standard ASCII value for uppercase A character.

Flashcard 24: What is the correct method to add an element to a list in Python?

Answer: list.append(element). Standard method to add elements to Python lists.

Flashcard 25: What is the result of '3 ** 2' in Python?

Answer: Result: 9. Double asterisk performs exponentiation in Python.

Flashcard 26: What is the correct syntax for a for-loop in Python?

Answer: for i in range(n):. Standard Python loop syntax iterating from 0 to n-1.

Flashcard 27: What is the purpose of the 'return' statement in a function?

Answer: Returns a value from a function. Exits function and sends value back to caller.

Flashcard 28: Find the error in 'while x = 5: pass' in Python.

Answer: Correct: 'while x == 5: pass'. Single equals is assignment, double equals is comparison.

Flashcard 29: What is the result of '7 % 2' in Python?

Answer: Result: 1. Modulo operator returns remainder of division operation.

Flashcard 30: What is the decimal equivalent of the binary number 1101?

Answer: Decimal: 13. Binary 1101 = 8+4+1=138 + 4 + 1 = 138+4+1=13 in decimal.