Logo ExamsQA
Exit
Free 0/10
1
Question

Analyze the following snippet and select the statement that best describes it.

Question image
Options
A

The code is an example of implicitly chained exceptions.

B

The code is erroneous as the OwnMath class does not inherit from any Exception type class

C

The code is fine and the script execution is not interrupted by any exception.

D

The code is an example of explicitly chained exceptions.

2
Question

If purple can be obtained from mixing red and blue, which color codes represent the two ingredients? Select two answers)

Select 2
Options
A

#FFFFFF

B

#0000FF

C

#FF0000

D

#000000

3
Question

Select the true statements about the sqlite3 module. (Select two answers.)

Select 2
Options
A

The fetchalt method returns None when no rows are available

B

The execute method allows you to perform several queries at once

C

The execute method is provided by the Cursor class

D

The fetchone method returns None when no rows are available

4
Question

A socket object is usually created by which one of the following invocations?

Options
A

socket. socket (socket_domain, socket_type)

B

socket = socket. socket (socket_number)

C

socket = socket. socket (socket_domain, socket_type, server_address)

D

socket = socket.socket(server address)

5
Question

Select the true statements related to PEP 8 programming recommendations for code writing. (Select two answers:)

Select 2
Options
A

You should use the not ... is operator (e.g. if not spam is None:), rather than the is not operator (e.g. if spam is not None:), to increase readability.

B

You should make object type comparisons using the ismstanceQ method (e.g. if isinstance (obj, int) :) instead of comparing types directly (eg if type(obj) is type(i)).

C

You should write code in a way that favors the CPython implementation over PyPy, Cython. and Jython.

D

You should not write string literals that rely on significant trailing whitespaces as they may be visually indistinguishable, and certain editors may trim them

6
Question

Select the true statement about PEP 8 recommendations related to line breaks and binary operators.

Options
A

It is recommended that you use line breaks before binary operators to improve code readability.

B

It is permissible to use line breaks before or after a binary operator as long as the convention is consistent locally However, for new code it is recommended that break lines should be used only after binary operators.

C

It is recommended that you use line breaks after binary operators to improve code readability.

D

There is no specific PEP 8 recommendation related to using line breaks with binary operators.

7
Question

Select the true statement about the___name___attribute.

Options
A

___name___is a special attribute, which is inherent for both classes and instances, and it contains information about the class to which a class instance belongs.

B

___name is a special attribute, which is inherent for both classes and instances, and it contains a dictionary of object attributes.

C

__name___is a special attribute, which is inherent for classes and it contains information about the class to which a class instance belongs.

D

__name___is a special attribute, which is inherent for classes, and it contains the name of a class.

8
Question

Analyze the following snippet and choose the best statement that describes it.

Question image
Options
A

self. name is the name of a class variable.

B

varl is the name of a global variable

C

Excalibur is the value passed to an instance variable

D

Weapon is the value passed to an instance variable

9
Question

Analyze the code and choose the best statement that describes it.

Question image
Options
A

___ne___() is not a built-in special method

B

The code is erroneous

C

The code is responsible for the support of the negation operator e.g. a = - a.

D

The code is responsible for the support of the inequality operator i.e. i =

10
Question

Select the true statements about the sqirte3 module. (Select two answers.)

Select 2
Options
A

The sqlite3 module provides an interface compliant with the DB-API 2.0.

B

The special name memory is used to create a database in RAM.

C

The sqhte3 module does not support transactions.

D

The fetchall method returns an empty list when no rows are available