Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ITS410- Module 6 Mastery Exercise: Question 1 (1 point) Which MySQLCursor object

ID: 3753003 • Letter: I

Question

ITS410- Module 6 Mastery Exercise:

Question 1 (1 point)

Which MySQLCursor object returns some of the rows in a result set?

a

fetch()

b

fecthsome()

c

fetchmany()

d

fetchall()

multiple_choice682911776Question 2 (1 point)

Placeholders are used to defend against what kind of hacking attack?

a

SQL Injection

b

Key stroke logging

c

Phishing

d

Denial of Service

multiple_choice682911766Question 3 (1 point)

You have a Python script where you don’t buffer your query results. The query result returns ten rows and you read only the first row and then close the cursor. What kind of error will you get?

a

Should not get an error.

b

Syntax error

c

Buffer underflow exception

d

Internal error

multiple_choice682911784Question 4 (1 point)

Of what use is the following code block:
def read_db_config(filename='config.ini', section='mysql'):

# create parser and read ini configuration file
parser = ConfigParser()
parser.read(filename)

# get section, default to mysql
db = {}
if parser.has_section(section):
items = parser.items(section)
for item in items:
db[item[0]] = item[1]
else:
raise Exception('{0} not found in the {1} file'.format(section, filename))

return db

a

It reads a database configuration from a configuration file

b

It prevents having to store passwords in a Python script

c

It conceals the database schema

d

All of the above

multiple_choice682911774Question 5 (1 point)

Which of the following is a valid placeholder format for Connector/Python prepared statements in a Python script?

a

Numeric Position

b

Named Parameter

c

Question Mark

d

Pyformat

multiple_choice682911750Question 6 (1 point)

You get an error when trying to insert a record into a table from a Python script. A possible reason for this could be:

a

Malformed insert statement

b

Failure to connect to the database

c

No permission to insert into the table

d

All of these

multiple_choice682911768Question 7 (1 point)

To control for an InternalError exception you should use a(n) __________ connection.

a

Unbuffered

b

Buffered

c

Secure

d

Open

multiple_choice682911756Question 8 (1 point)

Which of the following methods is not supported by the MySQLCursor object?

a

fetchone()

b

fecthsome()

c

fetchmany()

d

fetchall()

multiple_choice682911752Question 9 (1 point)

A(n) _____ is an internal structure used to iteratively process the rows in a result set from a query in a Python script.

a

connection string

b

cursor

c

database schema

d

for loop

multiple_choice682911770Question 10 (1 point)

___________ are used when an SQL statement has to be executed multiple times in a Python script.

a

Prepared statements

b

Cursors

c

Connections

d

Queries

a

fetch()

b

fecthsome()

c

fetchmany()

d

fetchall()

Explanation / Answer

Which MySQLCursor object returns some of the rows in a result set?

Answer 1: fetchMany()

Placeholders are used to defend against what kind of hacking attack?

Amswer 2: SQl Injection

You have a Python script where you don’t buffer your query results. The query result returns ten rows and you read only the first row and then close the cursor. What kind of error will you get?

Answer 3: No error

Answer 4:

It reads a database configuration from a configuration file

Question Mark

Answer 6: D All of the above

Answer 7:Buffered

Answer 8:fecthsome()

Answer 9: For loop

Answer 10:

Prepared statements

It reads a database configuration from a configuration file

Answer 5:

Question Mark

Answer 6: D All of the above

Answer 7:Buffered

Answer 8:fecthsome()

Answer 9: For loop

Answer 10:

Prepared statements

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote