Loading

Quipoin Menu

Learn • Practice • Grow

node-js / Connecting to MySQL
mcq
Direction: Choose the correct option

Q1.

Which npm package is popular for connecting to MySQL in Node.js?
A. Both A and B
B. mysql
C. mysql2
D. sql
Direction: Choose the correct option

Q2.

How do you create a connection to MySQL using the `mysql2` package?
A. mysql.connect()
B. mysql.connection()
C. new mysql.Connection()
D. mysql.createConnection()
Direction: Choose the correct option

Q3.

What is a connection pool?
A. A pool of water
B. A backup system
C. A cache of database connections reused for performance
D. A type of database
Direction: Choose the correct option

Q4.

How do you execute a query using a MySQL connection in Node.js?
A. connection.execute('SQL')
B. Both A and B
C. connection.run('SQL')
D. connection.query('SQL', callback)
Direction: Choose the correct option

Q5.

What should you do after finishing database operations?
A. Restart the server
B. Leave it open
C. Nothing
D. Close the connection or pool