Python MCQs - 241211 - 133746
Python MCQs - 241211 - 133746
1) What will be the output of the following Python code snippet? d= {"john":40, "peter":45}
c. 40 and 45
d. d = (40:"john", 45:"peter")
a. Degrade performance
b. Improve performance
d. Increase throughput
a. getThreads()
b. getList()
c. threads()
d. enumerate()
4) What is the exception raised for an error that doesn't fall in any of the categories?
a. ReferenceError
b. RuntimeError
c. SystemError
d. LookupError
a. via Mutex
b. None
d. via Locking
a. Perl scripts
b. C/C++ programs
c. Unix Scripts
b. As a discreate stream of values from standard input, the number of bytes is stored in
the content length environment variable.
b. Platform dependent
9) Which method of the socket module allows a server socket to accept requests from a client
socket from another host?
a. socket.accepts()
b. socket.sendto(address)
c. socket.acceptsocket
d. accept.socket()
10) Which method of the socket module allows you to send data to a given address?
a. socket.sendto(address, data)
b. socket.address()
c. socket.sendto(data, address)
d. socket.data
11) Which method of the socket module allows you to associate a host and a port with a
specific socket?
12) What is the difference between the TCP and UDP protocols, and how do you implement
them in Python with the socket module?
13) Which method of the socket module allows you to implement port scanning with sockets
and to check the port state?
14) What protocol can be used to retrieve web pages using python?
a. urllib
b. bs4
c. HTTP
d. GET
15) What is a python library that can be user to send and receive data over HTTP?
a. http
b. urllib
c. port
d. header
a. line()
b. canvas.create_line()
c. create_line(canvas)
d. create_line()
b. create a button
c. To define a geometry
d. delete a function
20) Fow the place() function put the widget on the screen?
c. According to left,right,up,down
a. Database
b. OS commands
c. GUI
d. Sys command
a. local
d. Global
c. Server
d. browser
24) What is the name of the SQL database the comes distributed with Python?
a. SQLite
b. PostgreSQL
c. PySQL
d. MySQL
a. Zim Den
c. Niene Stom
a. integer
b. float
c. string
d. character
a. X^Y
b. X**Y
c. X^^Y
d. X***Y
a. /
b. //
c. %
d. *
a. Fun
b. Define
c. Def
d. Function
a. Custom function
c. User function
d. System function
31) Python supports the creation of anonymous functions at runtime, using a construct called
a. pi
b. lambda
c. anonymous
d. synonymous
a. 27
b. 9
c. 3
d. 1
33) What will be the output of the following Python expression? round(4.5676,3)?
a. 4.5
b. 4.6
c. 4.568
d. 4.57
c. When there is a deviation from the rules of a programming language, a semantic error
is thrown
35) Which of the follwoing blocks will be executed wheather an exception is thrown or not?
a. except
b. else
c. finally
d. assert
a. except
b. try
c. accept
d. finally
37) How many except statements can a try-except block have?
a. zero
b. one
39) What is the method to retrieve the list of all active threads?
a. getThreads()
b. getList()
c. threads()
d. enumerate()
40) What is the exception raised for an error that doesn't fall in any of the categories?
a. ReferenceError
b. RuntimeError
c. SystemError
d. LookupError