Ap Comp Sci Mascaró

0.0(0)
studied byStudied by 0 people
0.0(0)
call with kaiCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

Last updated 11:48 PM on 10/5/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

20 Terms

1
New cards

Which of the following is the correct way to write a comment in Python?

A. # This is a comment

2
New cards

What is the purpose of using comments in code?

B. To add a description or explanation of the code for the programmer

3
New cards

Which of the following is a valid Python variable name?

C. my_variable

4
New cards

Which of the following is the correct way to assign the value 10 to a variable named x?

A. x = 10

5
New cards

Which variable name is NOT valid in Python?

D. total%amount

6
New cards

What will the following code output?

A. Hello World

7
New cards

How can you extract the first character of a string: name = "Alice"?

A. name[0]

8
New cards

What does the following code output?

A. yth

9
New cards

What is the result of the following code?

B. John Doe

10
New cards

Which of the following code takes input from the user and stores it in a variable user_input?

A. user_input = input("prompt")

11
New cards

What does the following code do?

A. Asks for the user's age and prints the age in a message

12
New cards

How do you ensure that input from a user is stored as an integer?

C. number = int(input("Enter a number: "))

13
New cards

Which of the following code snippets contains a syntax error?

D. xy = 7 xY += 8

14
New cards

What is a runtime error?

A. An error detected during the execution of the program

15
New cards

What type of error is demonstrated in the following code?

A. Syntax Error

16
New cards

What type of error occurs when a program runs and terminates properly but produces incorrect output?

C. Logic Error

17
New cards

Identify the error in the following code?

A. Syntax Error

18
New cards

What will the following code output?

B. 8

19
New cards

What will be the result of the following code?

A. 53

20
New cards

What is the result of the following command: print(str(7) + int("8"))?

D. Runtime Error

Explore top flashcards