final exam flash cards

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

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

54 Terms

1
New cards

Dictionaries are sometimes also called maps.

True

2
New cards

Which of the following are valid elements that can be added to a set?

both strings and tuples

3
New cards

In Python, we can get a collection of all the values by calling the .values() method on a dict.

True

4
New cards

Dictionaries are immutable.

False

5
New cards

Dictionaries are sorted in alphabetical order by key.

False

6
New cards

Dictionary keys can be mutable. 

False

7
New cards

In Python, we can get a collection of all the key-value pairs by calling the .items() method on a dict.

True

8
New cards

Dictionaries are a collection type.

True

9
New cards

If you have two sets and you wanted to find out which elements are contained by both sets, which set operation would you use?

intersection

10
New cards

In Python, we can get a collection of all the keys by calling the .keys() method on a dict.

True

11
New cards

Dictionary Keys can be mutable.

False

12
New cards

Sets can contain duplicate items.

False

13
New cards

Tuples are mutable.

False

14
New cards

Which of the following would allow you to iterate through the keys and values of a dict? Assume the variable ‘d’ is a dict.

for k, v in d.items():

15
New cards

Which of the following are properties of tuples. 

All of the above

16
New cards

if you have two sets and you wanted to find out which elements are contained by both sets, which set operation would you use

intersection

17
New cards

a recursive function is one which calls itself in the definition.

True

18
New cards

There are certain problems that can ONLY be solved by using recursion.

False

19
New cards

There are never any performance repercussions from using recursion.

False

20
New cards

The ‘base case’ in a recursive function is one where the answer is known immediately and can be returned without doing any work. 

True

21
New cards

A ‘recursive case’ in a recursive function is one where the function makes a call to itself.

True

22
New cards

Which of the following is true about the input to the recursive case in a recursive function.

it should make the problem smaller.

23
New cards

Which of the following is a natural, real-world use case for recursion?

traversing file systems.

24
New cards

which of the following uses showcases the performance drawbacks of using recursion. 

calculating fibbonacci numbers.

25
New cards

which of the following is a recursive function that would behave correctly (i.e no stack overflows, no exceptions, etc)

def my_recursive_func(num):
	if num <= 1:
	     print('done')
	else:
	     my_recursive_func(num - 1)

26
New cards

Refactoring is the process of editing code you’ve already written to improve the quality, readability, and/or maintainability of the code. 

True

27
New cards

Dunder methods have no special significance and are treated just like other methods. 

False

28
New cards

A variable that’s created in a function definition is also in scope outside that function. 

False

29
New cards

An object’s unique ID that corresponds to its memory address can be accessed with the ‘id()’ function.

True

30
New cards
31
New cards

Objects are NOT instances of a class. They are a separate concept in Python.

False

32
New cards

Say there is a class called ‘Log’ and you create an instance of that class with the variable ‘my_log’. The type of ‘my_log’ is <Class>.

False

33
New cards

Class methods cannot return values like functions can.

False

34
New cards

Class methods can return values as long as they aren’t held in instance variables.

False

35
New cards

A class’s constructor gets called when a new instance of that class is created.

True

36
New cards

Which of the following creates a new instance of the class ‘LoginManager’?

my_instance = LoginManager()

37
New cards

In Python all objects are descendants (i.e. inherit from) the built-in object class.

True

38
New cards

Only a single subclass can inherit from any given superclass.

False

39
New cards

Assume that there’s a class called SubClass that inherits from another class called SuperClass. In’s impossible to inherit from SubClass because it’s already a child.

False

40
New cards

The following Python class definition does not inherit from anything.

class ExampleClass:
	'''a simple class that does nothing'''

False

41
New cards

Markup languages are languages that use predetermined characters and/or symbols to annotate text giving semantic meaning and structure to the document.

True

42
New cards

HTML has self-closing tags that open and close themselves.

True

43
New cards

HTML has open-ended tags that don’t need to be closed.

False

44
New cards

Method overriding is the process of

creating a new implementation/definition of a method that was

previously defined in an ancestor class

45
New cards

Operator overloading is the process of

Adding a definition for an operator’s dunder method so that it can be used with custom behavior for your class.

46
New cards

Which of the following is true about calling a method on an object.

Python will first look for the definition of that method in the

object's type (i.e. class), then through all its ancestors until it

finds a definition or throws an exception if there are no more

ancestors.

47
New cards

HTML is a

markup language

48
New cards

The main semantic component of HTML is the

tag

49
New cards

HTML attributes are

key-value pairs

50
New cards

An HTML attribute lets you

change/modify/specify properties of an HTML tag

51
New cards
52
New cards
53
New cards
54
New cards