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()

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 dont 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!