Comp SCI NWC Test 2

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

1/10

flashcard set

Earn XP

Description and Tags

Landon Van Berkuk, Based on quizzes 67 8

Last updated 4:16 PM on 11/18/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

11 Terms

1
New cards


Interactive Loop

Will stop looping unless "told" to continue

2
New cards

Sentinel Loop

Will keep looping unless "told" to stop

3
New cards


Pre-Test Loop

May not loop at all, depending on initial conditions

4
New cards

Definite Loop

Knows exactly how many times it will iterate ahead of time

5
New cards

Indefinite Loop

Doesn't know how many times it will iterate

6
New cards

True or False: Tuples are ordered, but Dictionaries are unordered.

True

7
New cards

What will the following code print out?

x = 10

for i in range(1,4):

聽聽聽聽x = x * i

聽聽聽聽for k in range(1,4):

聽聽聽聽聽聽聽聽x = x - k

print(x)

0

8
New cards

Given the following list of lists, which statement will access the 'X'?

table = [['O', 'O', 'O'],

聽聽聽聽聽聽聽聽聽['X', 'O', 'O'],

聽聽聽聽聽聽聽聽聽['O', 'O', 'O']]

table[1][0]

9
New cards

Consider the following code snippet. How many times will statement #1 be run?

x = 400

for i in range(5):

聽聽聽聽for k in range(6):

聽聽聽聽聽聽聽聽# Statement #1

聽聽聽聽聽聽聽聽x = x - (i*k)

聽聽聽聽# Statement #2

聽聽聽聽x = x * i

5脳6=30

10
New cards

Consider the following code snippet. How many times will statement #2 be run?

x = 400

for i in range(5):

聽聽聽聽for k in range(6):

聽聽聽聽聽聽聽聽# Statement #1

聽聽聽聽聽聽聽聽x = x - (i*k)

聽聽聽聽# Statement #2

聽聽聽聽x = x * i

5

11
New cards

What does the following code snippet print out?

def recur(a, b):

聽聽聽聽if a == 0:

聽聽聽聽聽聽聽聽return b

聽聽聽聽elif b == 0:

聽聽聽聽聽聽聽聽return a

聽聽聽聽else:

聽聽聽聽聽聽聽聽return 1 + recur(a-1, b-1)

print(recur(4,6))

  1. 2+1+1+1+1=6.

Explore top flashcards