Comp Sci Python Quiz 2

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards

Which if statement correctly checks if a number (num) is greater than 10 and less than 20?

if num > 10 and num < 20:

2
New cards

Which of the following is the correct method to concatenate two strings s1 and s2?

s1 + s2

3
New cards

Which of the following will result in the substring 'dog' from the string 'bulldog'?

'bulldog'[4:7]

4
New cards

Given the following code: What is printed with the following call: print("add(3, 4)")

add(3, 4)

5
New cards

What is the result of the following expression? 3 + 5 * 2

13

6
New cards

What is the result of the following expression? 5 / 2

2.5

7
New cards

Which of the following expressions evaluates to True?

5 < 3 or 2 > 1

8
New cards

Which of the following is a syntax error?

3 + 5 = x

9
New cards

Which of the following produces a runtime error?

print("Hello" + 3)

10
New cards

Which of the following is an example of a logic error?

Incorrectly calculating an average in a program

11
New cards

Which of the following methods can be used to convert a string s = "123" into an integer?

int(s)

12
New cards

Identify the Python logical operators:

and, or, not