What will be the output after the following statements? a = list(range(-10,5,2)) print(sum(a)) a. -24 b. 0 c. 24 d. 20
What will be the output after the following statements? x = [5, 4, 3, 2, 1] y = x.copy() x[0] = 6 print(y) a. [6, 4, 3, 2, 1] b. 6 c. [5, 4, 3, 2, 1] d. 5
What will be the output after the following statements? import copy x = [5, 4, 3, 2, 1] y = copy.copy(x) x.append(6) print(y[0]) a. [6, 4, 3, 2, 1] b. 6 c. [5, 4, 3, 2, 1] d. 5
What will be the output after the following statements? import keyword print(keyword.iskeyword(‘IS’)) a. True b. keyword c. for d. False
What will be the output after the following statements? import keyword print(keyword.iskeyword(‘for’)) a. True b. keyword c. for d. False
What will be the output after the following statements? import keyword print(keyword.iskeyword(‘Python’)) a. True b. keyword c. for d. False
What will be the output after the following statements? import random x = [3, 8, 6, 5, 0] print(random.choice(x)) a. A random element from the list x b. The list x c. A random element from the list x, excluding 3 and 0 d. A random element from the list elements 3 and 0
What will be the output after the following statements? import random x = [3, 8, 6, 5, 0] random.shuffle(x) print(x) a. A random element from the list x b. The shuffled list x with the elements mixed up c. A random element from the list x, excluding 3 and 0 d. A random element from the list elements 3 and 0
What will be the output after the following statements? import random x = [3, 8, 6, 5, 0] y = random.shuffle(x) print(y) a. A random element from the list x b. The shuffled list x with the elements mixed up c. None d. A random element from the list x, excluding 3 and 0
What will be the output after the following statements? import sys x = sys.stdout.write(‘Python Jobs’) a. A random character from the string ‘Python Jobs’ b. Python Jobs c. None d. PJ
What will be the output after the following statements? import time print(time.time()) a. Current time in seconds since the Epoch at 00:00:00 GMT on January 1, 1970 b. Today’s time in hours c. None d. Today’s time in minutes
What will be the data type of the output after the following statements? import time print(time.time()) a. String b. Integer c. List d. Float
What will be the data type of the output after the following statements? import time print(time.asctime()) a. String b. Integer c. List d. Float
What will be the output after the following statements? import time print(time.asctime()) a. Current time in seconds since the Epoch at 00:00:00 GMT on January 1, 1970 b. Current date and time c. None d. Today’s time in minutes
What will be the output after the following statements? import time y = (2016, 2, 10, 12, 45, 32, 5, 0, 0) print(time.asctime(y)) a. Current time in seconds since the Epoch at 00:00:00 GMT on January 1, 1970 b. Current date and time c. Sat Feb 10 12:45:32 2016 d. No output
What is likely to be the output after the following statements? import time y = time.asctime() print(y[:3]) a. 2016 b. 3:40 c. Mon d. 04
What will be the output after the following statements? import random print(int(random.random()*10)) a. 10 b. A random integer number within the range of 0 to 9 c. None d. A random floating point number within the range of 0 to 9
What will be the output after the following statements? import random print(int(random.random()*10) + 1) a. 11 b. A random integer number within the range of 0 to 11 c. None d. A random whole number within the range of 1 to 10
What will be the output after the following statements? import random print(random.sample(range(20), 5)) a. A list of 5 unique numbers within the range of 0 to 19 b. A list of 5 unique numbers within the range of 0 to 20 c. A list of 4 unique numbers within the range of 0 to 19 d. A tuple of 5 unique numbers within the range of 0 to 19
What will be the output after the following statements? import random print(random.sample(range(5, 20), 4)) a. A list of 5 unique numbers within the range of 4 to 19 b. A list of 5 unique numbers within the range of 5 to 20 c. A list of 4 unique numbers within the range of 5 to 19 d. A tuple of 4 unique numbers within the range of 5 to 19
What will be the output after the following statement? print(a) a. SyntaxError b. TypeError c. ValueError d. NameError
What will be the output after the following statement? a = “Python Practice’ a. SyntaxError b. TypeError c. ValueError d. NameError
What will be the output after the following statement? a = true a. No Error b. TypeError c. ValueError d. NameError
What is the value of the NoneType data type? a. undefined b. Null c. Nan d. None
What will be the output after the following statements? def xyz(): a = 56 xyz() print(a) a. NameError b. 56 c. a = 56 d. xyz
What will be the output after the following statements? def xyz(): x = 40 abc() print(x) def abc(): a = 32 x = 10 xyz() a. NameError b. 40 c. 10 d. 32
What will be the output after the following statements? def xyz(): x = 40 def abc(): xyz() a = 32 x = 10 print(x) abc() a. NameError b. 40 c. 10 d. 32
What will be the output after the following statements? def abc(): print(x) x = 10 abc() a. NameError b. x c. 10 d. 0
What will be the output after the following statements? def abc(): x = 12 print(x) x = 10 abc() a. NameError b. 12 c. 10 d. 0
What will be the output after the following statements? def abc(): x = 10 print(x) abc() x = 12 a. NameError b. 12 c. 10 d. 0
What will be the output after the following statements? def abc(): global x x = 23 x = 10 abc() print(x) a. NameError b. 23 c. 10 d. 0
What will be the output after the following statements? def abc(): print(x) x = 10 abc() x = 20 a. NameError b. 20 c. 10 d. UnboundLocalError
What will be the output after the following statements? def abc(x): return 20 / x print(abc(4)) a. NameError b. 5 c. 5.0 d. ZeroDivisionError
What will be the output after the following statements? def abc(x): return 20 / x print(abc(0)) a. NameError b. Undefined c. 5.0 d. ZeroDivisionError
What will be the output after the following statements? def abc(x): try: print(20 / x) except: print(‘Not a valid argument’, end=’ ‘) print(abc(0)) a. NameError b. Not a valid argument c. Not a valid argument None d. ZeroDivisionError
What will be the output after the following statements? def abc(x): try: print(20 / x) except: print(‘Not a valid argument’, end=’ ‘) finally: print(0, end=’ ‘) print(abc(0)) a. Not a valid argument 0 None b. Not a valid argument c. Not a valid argument None d. ZeroDivisionError
What will be the output after the following statements? x = [1, 2, 3, 4] print(x[4]) a. 4 b. 3 c. [1, 2, 3, 4] d. IndexError
What will be the output after the following statements? x = [10, 20, 30, 40] print(x[20]) a. 20 b. 30 c. [20] d. IndexError
What will be the output after the following statements? x = [1.0, 2.0, 3.0] print(x[2.0]) a. 2 b. 3.0 c. TypeError d. IndexError
What will be the output after the following statements? x = [1.0, 2.0, 3.0] print(x[int(2.0)]) a. 2 b. 3.0 c. TypeError d. IndexError
What will be the output after the following statements? x = [‘Today’, ‘nice’, ‘day’] print(x[0] + ‘ is a ‘ + x[1] + x[2]) a. Today is a niceday b. Today is a nice day c. Todayis aniceday d. Todayisaniceday
What will be the output after the following statements? x = [‘Today’, ‘Sunday’, ‘Monday’] print(x[0] + ‘ was a great day’) a. Today was a great day b. Sunday was a great day c. TypeError d. IndexError
What will be the output after the following statements? x = [‘Today’, ‘Sunday’, ‘Monday’] print(x[-1] + ‘ was a great day’) a. Today was a great day b. Sunday was a great day c. Monday was a great day d. IndexError
What will be the output after the following statements? x = [‘Today’, ‘Sunday’, ‘Monday’] print(x[-3] + ‘ was a great day’) a. Today was a great day b. Sunday was a great day c. Monday was a great day d. IndexError
What will be the output after the following statements? x = [‘Today’, ‘Sunday’, ‘Monday’] x[2] = ‘Friday’ x[1] = ‘Yesterday’ print(x[-2] + ‘ was a great day’) a. Friday was a great day b. Sunday was a great day c. Monday was a great day d. Yesterday was a great day
What will be the output after the following statements? x = [‘Today’, ‘Sunday’, ‘Monday’] y = [4, 6, 8] print(y + x) a. [‘Today’, ‘Sunday’, ‘Monday’, 4, 6, 8] b. [4, 6, 8, ‘Today’, ‘Sunday’, ‘Monday’] c. [‘Today’, ‘Sunday’, ‘Monday’] d. [4, 6, 8]
What will be the output after the following statements? x = ‘Monday’ print(‘Mon’ in x) a. ‘Mon’ in x b. ‘Monday’ in x c. True d. False
What will be the output after the following statements? x = ‘Monday’ print(‘Day’ not in x) a. ‘Day’ not in x b. ‘Monday’ not in x c. True d. False
What will be the output after the following statements? x = [‘hot’, ‘100’, True] weather = x[0] temperature = x[1] humid = x[2] print(weather, temperature, humid) a. x b. [‘hot’, ‘100’, True] c. ‘hot’, ‘100’, True d. hot 100 True
What will be the output after the following statements? x = [‘hot’, ‘100’, True] weather, temperature, humid = x print(weather, temperature, humid) a. ValueError b. [‘hot’, ‘100’, True] c. ‘hot’, ‘100’, True d. hot 100 True