Fundamentals of Programming MCQs (Part-10)

What is the main difference between a scripting language and a compiled language?

A Speed of execution
B Syntax
C Memory usage
D Error handling

Which of the following is used to connect to a database in Python?

A database
B DBConnect
C sqlite3
D sql

Which protocol is used for transferring web pages across the internet?

A HTTP
B FTP
C SMTP
D POP3

In Java, which method is used to establish a connection to a database?

A connect()
B getConnection()
C open()
D database()

Which of these is a key advantage of compiled languages over scripting languages?

A Easier syntax
B Platform independence
C No need for interpretation
D Faster execution

In C, which function is used to establish a network connection?

A connect()
B socket()
C send()
D bind()

What does the import statement do in Python?

A Imports a variable
B Imports a function
C Imports a module
D Imports a file

Which of the following is used for network programming in Java?

A Socket
B FileReader
C Server
D Buffer

Which of these is a compiled language?

A Python
B JavaScript
C C++
D Ruby

Which of these is used to send a query to a database in SQL?

A send()
B query()
C execute()
D fetch()

What is the main advantage of scripting languages over compiled languages?

A Faster execution
B Easier to debug
C More efficient memory usage
D Better error handling

What does the send() function do in network programming?

A Sends data over a socket
B Receives data from a socket
C Connects to a server
D Closes a connection

Which of these is the correct way to connect to a MySQL database in Python?

A mysql.connect()
B mysqlDB.connect()
C mysql.connector.connect()
D db.connect()

Which of the following protocols is used for secure communication over the web?

A FTP
B HTTP
C SMTP
D HTTPS

Which module in Python is used to perform networking tasks like socket communication?

A os
B io
C sys
D socket