Which of the following lambda definitions are correct? (Select two answers)

Which of the following lambda definitions are correct? (Select two answers)A . lanbda x, y; return x\y - x%yB . lambda x, y; x\y - x%yC . lambda (x, y = x\y x%yD . lambda x, y; (x, y)View AnswerAnswer: B,D

May 18, 2021 No Comments READ MORE +

Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Select two answers)

Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Select two answers) A . obj_b.prop_a == 3B . hasattr(obj_b, 'prop_aa')C . isinstance(obj_c,A)E . VarA == 3View AnswerAnswer: B,C

May 18, 2021 No Comments READ MORE +

Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Select two answers)

Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Select two answers) string = 'python' [::2] string = string[-1] + string[-2]A . string[0] == string[-1]B . string is NoneC . len (string] == 3D . string[0] == 'o'View AnswerAnswer: D

May 18, 2021 No Comments READ MORE +

Which of the following literals reflect the value given as 3 4. 2 3 (select two answers)

Which of the following literals reflect the value given as 3 4. 2 3 (select two answers)A . .3423e2B . 3423e-2C . .3423e-2D . 3423e2View AnswerAnswer: A,B

May 18, 2021 No Comments READ MORE +

Which of the invocations should be used instead of XXX?

The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead of XXX?A . print (get(self))B . print (self.get())C . print (get())D . print (self.get...

May 17, 2021 No Comments READ MORE +

What is the expected output of the following snippet?

What is the expected output of the following snippet? A . 3B . 1C . 2D . the code is erroneousView AnswerAnswer: D

May 17, 2021 No Comments READ MORE +

What will the value of the i variable be when the following loop finishes its execution?

What will the value of the i variable be when the following loop finishes its execution? A . 10B . the variable becomes unavailableC . 11D . 9View AnswerAnswer: D Explanation: Reference: https://www.programiz.com/python-programming/pass-statement

May 17, 2021 No Comments READ MORE +

Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Select two answers)

Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Select two answers) import random v1 = random. random() v2 = random. random()A . len(random. sample([1,2,3],1)) > 2B . v1 == v2C . random.choice{[1,2,3]) > 0D . v1 < 1View AnswerAnswer:...

May 15, 2021 No Comments READ MORE +

What is true about Python packages? (Select two answers)

What is true about Python packages? (Select two answers)A . the sys.path variable is a list of stringsB . _pycache_is a folder that stores semi-completed Python modulesC . a package contents can be stored and distributed as an mp3 fileD . a code designed to initialize a package's state should...

May 15, 2021 No Comments READ MORE +

If you need a function that does nothing, what would you use instead of XXX? (Select two answers)

If you need a function that does nothing, what would you use instead of XXX? (Select two answers) def idler ( ): XXXA . passB . returnC . exitD . NoneView AnswerAnswer: A,D Explanation: Reference: https://www.pythoncentral.io/python-null-equivalent-none/

May 15, 2021 No Comments READ MORE +