-
1.
What does the function re.match do?
matches a pattern at any position in the string
matches a pattern at the start of the string
such a function does not exist
none of the above
Answer
-
2.
Which module in Python supports regular expressions?
pyregex
regex
re
None
Answer
-
3.
what should the below code print?
print type(1J)
<type 'dict'>
<type 'float'>
<type 'unicode'>
<type 'complex'>
Answer
-
4.
What is the value of colors[2]?
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
orange
indigo
blue
yellow
Answer
-
5.
Is the following statement correct?
There are two types of values in Python: numbers and strings.
True
False
Answer
-
6.
Which of the following function checks that all characters of a string are in upper case?
isupper()
ljust(width[, fillchar])
len(string)
join(seq)
Answer
-
7.
Which of the following environment variable for Python is an alternative module search path?
PYTHONSTARTUP
PYTHONCASEOK
PYTHONPATH
PYTHONHOME
Answer
-
8.
What are the states/features supported by a Lock object?
Unlocked
Locked
Owning thread
Recursion level
Answer
-
9.
How does run() method is invoked?
By Thread.run()
By Thread.create()
None
By Thread.start()
Answer
-
10.
Which one is reentrant lock type?
Lock
RLock
Condition
Semaphore
Answer
-
11.
What is the difference between threading.Lock and threading.RLock?
Lock is owned by a thread while RLock is owned by many.
Lock is owned by none while RLock is owned by many.
Lock and RLock both primitives are owned by many.
Lock and RLock both primitives are owned by a single thread.
Answer
-
12.
What are the lock types a Condition object can associate with?
Lock object
Semaphore
RLock object
None
Answer
-
13.
How to terminate a blocking thread?
None
thread.stop()
thread.stop() & thread.wait()
thread.terminate()
Answer
-
14.
Which synchronization method is used to guard the resources with limited capacity, e.g. a database server?
Lock
Condition
Event
Semaphore
Answer
-
15.
What is the method that wakes up all thread waiting for the condition?
notify()
notifyAll()
release()
releaseAll()
Answer
-
16.
What would be the impact of multithreading on a uni-processor system?
Increase throughput
Degrade performance
Improve performance
Reduce execution time
Answer
-
17.
How to detect the status of a python thread?
isDaemon()
isAlive()
isActive()
None
Answer
-
18.
Which statements are true for RLock objects?
if another thread owns the lock, acquire() will block until the lock is unlocked.
If a thread already owns the lock, acquire() will increment the recursion level by one, and return immediately.
If a thread already owns the lock, acquire() will block until the lock is unlocked.
if another thread owns the lock, acquire() will increment the recursion level by one, and return immediately.
Answer
-
19.
What are the libraries in Python that support threads?
thread
_threading
threading
None
Answer
-
20.
Which Python library runs a function as thread?
threading
None
thread
_threading
Answer