TAC 115 Final Exam: Python Programming, Data Structures, and File Handling

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/34

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.

35 Terms

1
New cards

What is the variable type of 16/4?

int (integer)

2
New cards

What is the variable type of 5.5 > 4?

bool (boolean)

3
New cards

What is the variable type of drinksCoffee?

str (string)

4
New cards

What is the variable type of favorite[2:]?

str (string)

5
New cards

What is the variable type of favorite.index('i')?

int (integer)

6
New cards

What is the variable type of desserts[1]?

str (string)

7
New cards

What is the variable type of desserts[2:3]?

list

8
New cards

What is the variable type of 'pie' in desserts?

bool (boolean)

9
New cards

What is the variable type of menu['espresso']?

float (floating point number)

10
New cards

What is the variable type of file.readline()?

str (string)

11
New cards

True or False: The constructor (dunder init) method returns a value.

False

12
New cards

True or False: Lists are a type of sequence in Python.

True

13
New cards

True or False: Python is a low-level programming language.

False

14
New cards

True or False: Dictionary keys must be immutable and unique.

True

15
New cards

True or False: Each if statement can have an unlimited number of elif statements.

True

16
New cards

What is the value of favorites?

['pencil', 'binder', 'eraser']

17
New cards

What is the value of num?

4

18
New cards

How do you add 'folder' to supplies?

supplies.append('folder')

19
New cards

How do you flip the order of supplies?

supplies.reverse()

20
New cards

How do you add 'ruler' after 'pencil' in supplies?

supplies.insert(2, 'ruler')

21
New cards

What is the correct way to create a for loop to print supplies?

for item in supplies: print(item + ' is required for class')

22
New cards

How do you convert supplies to a string with '*' separator?

newString = '*'.join(supplies)

23
New cards

What is the value of len(villagers)?

6

24
New cards

How do you correctly access Diva's hobby?

villagers[3]['hobby']

25
New cards

How do you add newNeighbor to villagers?

villagers.append(newNeighbor)

26
New cards

How do you delete Eunice's dictionary from villagers?

villagers.remove({'name':'Eunice', 'personality':'normal', 'pet':'sheep', 'hobby':'fashion'})

27
New cards

How do you generate a random even number from 20 to 30?

num = random.choice(range(20, 31, 2))

28
New cards

How many parameters does the userChoice function have?

1

29
New cards

What is the condition for the while loop in userChoice?

userInput not in options

30
New cards

How do you create a main function that calls userChoice?

def main(): userChoice()

31
New cards

What is the first error in the Pig Latin program?

Line 3: Change 'if word[0] == vowels:' to 'if word[0] in vowels:'

32
New cards

What is the second error in the Pig Latin program?

Line 5: Remove the colon after 'elif'

33
New cards

What is the third error in the Pig Latin program?

Line 10: Change 'lower' to 'lower()'

34
New cards

What is the fourth error in the Pig Latin program?

Line 15: Change 'pigLatinList = pigLatinList.append(pigLatinWord)' to 'pigLatinList.append(pigLatinWord)'

35
New cards

What is the fifth error in the Pig Latin program?

Line 21: Change 'messageToTranslate[]' to 'messageToTranslate()'