What is the expected behavior of the following code?

What is the expected behavior of the following code? A . it outputs 2B . the code is erroneous and it will not executeC . it outputs 1D . it outputs 3View AnswerAnswer: D

November 5, 2021 No Comments READ MORE +

What can you do if you don't like a long package path tike this one0 import alpha.beta.gamma.delta.epsiIon.zeta

What can you do if you don't like a long package path tike this one0 import alpha.beta.gamma.delta.epsiIon.zetaA . you can make an alias for the name using the a 1 i a s keywordB . nothing; you need to come to terms with itC . you can shorten it to...

November 5, 2021 No Comments READ MORE +

Assuming that String is six or more letters long, the following slice String [1:-2] is shorter than the original string by:

Assuming that String is six or more letters long, the following slice String [1:-2] is shorter than the original string by:A . four charsB . three charsC . one charD . two charsView AnswerAnswer: B

November 5, 2021 No Comments READ MORE +

Python strings can be “glued” together using the operator:

Python strings can be “glued” together using the operator:A . .B . &C . _D . +View AnswerAnswer: D Explanation: Reference: https://docs.python.org/3/tutorial/introduction.html

November 5, 2021 No Comments READ MORE +

Is it possible to safely check if a class object has a certain attribute0

Is it possible to safely check if a class object has a certain attribute0A . yes, by using the hasattr attributeB . yes. by using the hasattr () methodC . yes, by using the hasattr () functionD . no, it is not possibleView AnswerAnswer: B Explanation: Reference: https://stackoverflow.com/questions/610883/how-to-know-if-an-object-has-an-attribute-in-python

November 4, 2021 No Comments READ MORE +

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

Which of the following lambda function definitions are correct? (Select two answers)A . lambda X: NoneB . lambda: 3,1415C . lambda x: def fun(x): return xD . lambda lambda: lambda * lambdaView AnswerAnswer: A,B

November 4, 2021 No Comments READ MORE +

Which of the following words can be used as a variable name? (Select two valid names)

Which of the following words can be used as a variable name? (Select two valid names)A . forB . TrueC . trueD . ForView AnswerAnswer: C,D

November 3, 2021 No Comments READ MORE +

What is the expected output of the following code?

What is the expected output of the following code? A . abcefB . The program will cause a runtime exception errorC . acdefD . abdefView AnswerAnswer: B

November 3, 2021 No Comments READ MORE +

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

Assuming that the following code has been executed successfully, select the expressions which evaluate to True (Select two answers) A . a is bB . b( ) > 2C . a() > 2D . a is not NoneView AnswerAnswer: B,C,D

November 2, 2021 No Comments READ MORE +

A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:

A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:A . lambda (x, y) = x ** yB . lambda (x, y): x ** yC . def lambda (x, y): return x ** yD . lambda x, y: x ** yView...

November 2, 2021 No Comments READ MORE +