CompSci 1/7 Test

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

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:27 AM on 1/7/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

16 Terms

1
New cards

What does PEMDAS stand for in operations?

Parentheses, Exponents, Multiplication and Division (from left to right), Addition and Subtraction (from left to right)

2
New cards

What is the result of 5 // 2?

2, as integer division removes the decimal.

3
New cards

What does the % operator do?

The modulus operator returns the remainder of a division.

4
New cards

What does the str() function do?

Converts any value to a string.

5
New cards

What is the output of print(bool(0))?

False, since any number converted to boolean is true unless it is 0.

6
New cards

What function is used to calculate the square root in math?

math.sqrt() function.

7
New cards

How do you round a number to a specified decimal places in Python?

Use round(a, b), where a is the number and b is the number of decimal places.

8
New cards

What is the purpose of the find() method in strings?

It gives the index position of the character/substring searched, returning -1 if not found.

9
New cards

What is an algorithm?

A set of steps/instructions to solve a problem or accomplish a task.

10
New cards

What will print('Hello'.lower()) output?

hello, as it converts the string to lowercase.

11
New cards

What is the difference between a for loop and a while loop?

A for loop runs for a predetermined number of iterations, while a while loop continues as long as a condition is true.

12
New cards

What does the term 'identifier' mean in Python?

A name used to identify a variable, function, class, module, or other object.

13
New cards

What does the insert(index, item) method do in a list?

It inserts an item into the list at a specified index.

14
New cards

What is a 2D array?

An array that contains multiple arrays, which can be visualized as a table.

15
New cards

What does an f-string do in Python?

It allows for the creation of formatted strings that include variables.

16
New cards

How can you create an empty list in Python?

Use empty brackets, e.g., nums = [] .