Technical Interview Rapid Fire Questions

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

1/30

encourage image

There's no tags or description

Looks like no tags are added yet.

31 Terms

1
New cards

Lists vs Tuples vs Sets

Lists: ordered mutable data structures

Tuples: ordered immutable data structures

Sets: unordered mutable data structures containing only unique objects

2
New cards

shallow copy vs deep copy

shallow copy: creates a new outer object while nested inner object may still reference the same point in memory as original

deep copy: recursively creates a new outer and inner object

3
New cards

*args and **kwargs

*args: function takes any number of positional arguments which are stored in a tuple

**kwargs: function takes keyword arguments which are stored in a dictionary where the keys are the keys, and the words are the values

4
New cards

Generator

generates a result one at a time using YIELD

5
New cards

yield vs return

yield: ouputs a result and pauses the function

return: outputs a result and terminates the function

6
New cards

instance method vs class method vs static method

instance method: receives self, is a method that can access class and instance attributes

class method: receives cls, method created within a class that is bound to the class, uses @classmethod decorator

static method: method used for utility functionality related to a class, uses @staticmethod decorator

7
New cards

append vs extend

append: adds an item to the end of a list

extend: adds the elements of an iterable to the end of an existing list

8
New cards

remove() vs pop() vs del

remove(): removes first instance of an item from an iterable using the item as an argument

pop(): removes an item from an iterable by index and returns the item, default -1

del: removes list items by index or slice without returning

9
New cards

sort() vs sorted()

sort(): sorts a list in place, changing the original list and returns None

sorted(): creates and returns a new sorted list, not changing original list

10
New cards

break vs continue vs pass

break: breaks out of the current loop

continue: skips the current iteration and moves to the next

pass: placeholder for functions and loops

11
New cards

is vs ==

is: checks if two objects share the same memory address

==: checks if two objects are equivalent to one another

12
New cards

Decorator

used to modify/change a function’s behavior without changing source code.
e.g. logging, caching

13
New cards

SyntaxError vs TypeError vs ValueError

SyntaxError: not following python’s grammatical rules

TypeError: wrong datatype for operation

ValueError: right datatype but invalid value

14
New cards

stack vs queue

stack: data structure that controls how objects are added/remove, uses LIFO

queue: data structure that controls how objects are added/remove, uses FIFO

15
New cards

heap

heaps are tree-based data structures that are used to implement priority queues

minheap: root contains smallest item, every parent is smaller or equal to children

maxheap: root tracks largest item, every parent is larger or equal to children

16
New cards

linear search vs binary search

linear search: iterates through an iterable one at a time — O(n)

binary search: elminates half of the iterable when iterating, iterable must be sorted — O(logn)

17
New cards

recursion vs iteration

recursion: function that repeatedly calls itself until a base case is met

iteration: repetition using a for or while loop for memory efficiency

18
New cards

map() vs filter()

map(): changes elements into iterables

filter(): keeps elements that meet a condition

19
New cards

lambda

anonymous function that automatically returns a value from a single expression

20
New cards
21
New cards
22
New cards
23
New cards
24
New cards
25
New cards
26
New cards
27
New cards
28
New cards
29
New cards
30
New cards
31
New cards