Exam 350-401 All QuestionsBrowse all questions from this exam
Question 688

Refer to the exhibit.

What does this Python script do?

    Correct Answer: B

    This Python script reads the username for a specific IP address from a light (SQLite) database. It connects to the SQLite database, creates a cursor object to execute SQL commands, constructs and executes a query to select the user from the monitor_branch table where the loopback IP matches a specified IP address, fetches the result, and processes the retrieved username. The script only reads the data and does not perform any write operations on the database.

Discussion
jackr76

WTF is this a Cisco or SQL exam

dragonwise

They think we're not worthy of the certificate if we do answer this question

mgiuseppe86

Thats my biggest gripe with the new CCNP. It's all BS Cloud/WiFi/Automation. WHAT HAPPENED TO REAL LAYER 1 2 3 NETWORKING

ando2023

I've recertified my ccnp since 2013 a few times, but now Cisco all of a sudden is going off in such a different direction. Switching and routing is now such a small part of the overall requirements.

Dre876

tell me about it!

Badger_27

WTF are they serious?

zogerixty

Can't understand?

Badger_27

No- how are you supposed to if you don't regularly use Python and the SQLite module?

slacker_at_work

Here's a breakdown of what each part does: -1 Importing sqlite3: This line imports the SQLite3 module in Python, allowing the script to interact with SQLite databases. -2 Connecting to the database: The script connects to a SQLite3 database located at /home/sdwan-lab/user.sqlite3. This is done using the connect() method of the sqlite3 module, which returns a connection object (a in this case). -3 Creating a cursor object: Cursors are used to execute SQL queries on the connected database. The cursor() method creates a cursor object (b in this case) associated with the connection

Sammy3637

no clue ... didn't see this coming , not in OCG

slacker_at_workOption: B

- 4 SQL Query: The variable c contains an SQL query. It appears to be selecting the user column from a table named monitor_branch where the loopbackip matches a specific pattern. However, there seems to be a syntax error in the query. The string concatenation is not done properly. - 5 Executing the query: The execute() method of the cursor b executes the SQL query stored in the variable c. - 6 Fetching the results: The fetchall() method retrieves all the rows returned by the query execution and stores them in the variable e. - 7 Processing the result: The script then appears to be manipulating the fetched result. It converts the first element of the result (e[0]) to a string, removes any occurrences of ( and ,) from the string, and assigns the modified string back to the variable usr.

Nation_2024

Thankyou

SeMo0o0oOption: B

B is correct The keyword is: c = "select user from monitor branch where loopbackip='" + str(ip[i]) + "'"

SeMo0o0o

...........................

RickAO76Option: C

I'm 50/50 with it being B or C. The two lines for .... usr = usr.replace() ...functions, are for writing. - I honestly just hope I don't see this question :-/

RickAO76

Re-visiting - I'm leaning to B now for read. The replace looks like it's only replacing the special characters.

djedeenOption: B

B: good link here for similar queries from sqlite3 DB. https://pyneng.readthedocs.io/en/latest/book/25_db/sqlite3_fetch.html

HungarianDishOption: B

B seems to be correct, because data only needs to be read from the DB, and not altered. https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-list-tables-using-sqlite3-in-python/amp/

Steve122Option: B

Definitely 'B'. After getting the username from e[0] it removes the ( and ) chars from string. (nothing written back to DB)

SeMo0o0oOption: B

i'm going with B, no idea why :D

mgiuseppe86Option: C

doesn the usr.replace string write the username back to the DB once it selects it from the table monitor_Branch?