编程语言
首页 > 编程语言> > linkedin python 领英技能 测评

linkedin python 领英技能 测评

作者:互联网

整理了部分概念题,感觉在看的时候,对自己的python基础重新反思了一下。。

下面开始啦,在重温python基础时,还能顺便复习一下英语,冲~

Q1. What is an abstract class?
An abstract class exists only so that other “concrete” classes can inherit from the abstract class.

Q2. What happens when you use the build-in function “any()” on a list?
The “any()” function returns True if any item in the list evaluates to True. Otherwise, it returns False.

Q3. What data structure does a binary tree degenerate to if it isn’t balanced properly?
linked list 链表

Q4. What is a static method?
They serve mostly as utility methods or helper methods since they can’t access or modify a class’s state.

Q5. What are attributes?属性
Function arguments are called “attributes” in the context of class methods and instance methods.

Q6. What is the term to describe this code?
count, fruit, price = (2, ‘apple’, 3.5)
tuple unpacking 元组解包

Q8. What is one of the most common use of Python’s sys library系统库?
to capture command-line arguments given at a file’s runtime

Q9. What is the runtime of accessing a value in a dictionary by using its key?
Q35. What is runtime complexity of the list’s built-in .append() method?
"O(1)", also called constant time恒定时间

Q10. What is the correct syntax for defining a class called Game?
class Game: pass
Q15. What is the correct syntax for defining a class called “Game”, if it inherits from a parent class called “LogicGame”?
class Game(LogicGame): pass

Q12. What buit-in Python data type is commonly used to represent a stack? 堆栈
Q22. What buit-in Python data type is commonly used to represent a queue?队列
list

Q13. What would this expression return?
college_years = [‘Freshman’, ‘Sophomore’, ‘Junior’, ‘Senior’]
return list(enumerate(college_years, 2019)
在这里插入图片描述
Q14. How does “defaultdict” work? 默认字典
If you try to access a key in a dictionary that doesn’t exist, “defaultdict” will create a new key for you instead of throwing a “KeyError”.

Q16. What is the purpose of the “self” keyword when defining or calling instance methods?
self refers to the instance whose method was called

Q17. Which of these is NOT a characteristic of namedtuples?
You can assign a name to each of the namedtuple members and refer to them that way, similarly to how you would access keys in dictionary
Each member of a namedtuple object can be indexed to directly, just like in a regular tuple
namedtuples are just as memory efficient as regular tuples
No import is needed to use namedtuples because they are available in the standard library

Q18. What is an instance method?
Instance methods can modify the state of an instance or the state of its parent class

Q20. Which statement does NOT describe the object-oriented programming concept of encapsulation?封装
It protects the data from outside interference
A parent class is encapsulated and no data from the parent class passes on to the child class
It keeps data and the methods that can manipulate that data in one place
It only allows the data to be changed by methods

Q24. What does the built-in map() function do?
It applies a function to each item in an iterable and returns the value of that function.

Q26. What is the purpose of the pass statement in Python? pass的作用
It is a null operation used mainly as a placeholder占位符 in functions, classes, etc.

Q27. What is the term used to describe items that may be passed into a function?
arguments
注:Argument (更像实参)和 Parameter (更像行参)两个词均翻译为参数

Q30. Assuming the node is in a singly linked list, what is the runtime complexity of searching for a specific node within a singly linked list?
The runtime is O(n) because in the worst case, the node you are searching for is the last node, and every node in the linked list must be visited.

Q31. Given the following three list, how would you create a new list that matches the desired output printed below?

fruits = [‘apples’, ‘oranges’, ‘bananas’]
quantities = [5, 3, 4]
prices = [1.50, 2.25, 0.89]
#Desired output
[(‘Apples’, 5, 1.50), (‘Oranges’, 3, 2.25), (‘Bananas’, 4, 0.89)]
在这里插入图片描述
Q33. What is the correct syntax for calling an instance method on a class named Game?

dice = Game()
dice.roll()

Q34. What is the algorithmic paradigm of quick sort? 快排的算法范式
divide and conquer

Q37. What is the definition of abstraction as applied to object-oriented Python? 抽象的定义
Abstraction means the implementation is hidden from the user, and only the relevant data or information is shown.

Q42. What does calling namedtuple on a collection type return? 集合类型
a tuple subclass with iterable named fields

Q46. What does a class’s init() method do?Q46. What does a class’s init() method do?
The init() method is a constructor method that is called automatically whenever a new object is created from a class. It sets the initial state of a new object.
Q58. What is the correct syntax for defining an init() method that takes no parameters?

def __init__(self):
	pass

标签:领英,What,methods,python,list,linkedin,method,data,class
来源: https://blog.csdn.net/weixin_44625028/article/details/122001986