Keyword

Result: 213 questions

Which of the following is the output of the below Python code?

def test():
 try:
  return 1
 finally:
  return 2
result = test()
print(result)
Quiz

Which of the following is the output of the below Python code?

def test1(param):
 return param

def test2(param):
 return param * 2

def test3(param):
 return param + 3

result = test1(test2(test3(1)))
print(result)
Quiz

Determine the output of the below Python code fragment?

var1 = True
var2 = False
var3 = False

if var1 or var2 and var3:
 print("True")
else:
 print("False")
Quiz

Which of the following is the output of the below Python code?

def myfunc():
 try:
  print('Monday')
 finally:
  print('Tuesday')
myfunc()
Quiz

Which of the following correctly describes the output of the below Python code?

testArr = [11, 22, 33, 22, 11] 
result = testArr[0] 
for iter in testArr: 
 if iter > result: 
  result = iter
print(result)
Quiz

Which of the following is the output of the below Python code?

var1 = lambda var: var * 2
ret = lambda var: var * 3
result = 2
result = var1(result)
result = ret(result)
result = var1(result)
print(result)
Quiz

Which of the following is the output of the below Python code?
[Note: Python 2.7.5 and above]

mylist=['a', 'aa', 'aaa', 'b', 'bb', 'bbb']
print(mylist[int(-1/2)])
Quiz

Which of the following is the output of the below Python code?

try:
 if '1' != 1:
  raise "firstError"
 else:
  print("firstError has not occured")
except "firstError":
 print("firstError has occured")
Quiz

Which of the following is the output of the Python code fragment given below?

var1 = 4.5
var2 = 2
print(var1//var2)
Quiz

Which of the following for loops would yield the below number pattern?
Note: Python 2.7

11111
22222
33333
44444
55555
Quiz

Which of the following is the output of the below Python code?

mylist=['a', 'aa', 'aaa', 'b', 'bb', 'bbb']
print(mylist[:-1])
Quiz

Which of the following is the output of the below Python code snippet?

ints = set([1,1,2,3,3,3,4])
print(len(ints))
Quiz

Which Python library runs a function as thread?

Quiz

What are the libraries in Python that support threads?

Quiz

How to detect the status of a python thread?

Quiz

Which of the following environment variable for Python is an alternative module search path?

Quiz

Is the following statement correct?

There are two types of values in Python: numbers and strings.

Quiz

Which module in Python supports regular expressions?

Quiz

What is the output of the following code?

import re
sentence = 'Learn Python Programming'
test = re.match(r'(.*) (.*?) (.*)', sentence)
print(test.group())
Quiz

Is the following statement correct?

There are two types of numbers in Python: integers and assigned values.

Quiz

© 2017 QuizBucket.org