What will be the output after the following statements? x = [int(i**3/3) for i in range(0,5,2)] print(x) a. [0, 2, 36] b. [0, 2, 21] c. [0, 6, 2] d. [0, 2, 14]
What will be the output after the following statements? x = [int(i/2-5) for i in range(3,8,2)] print(x) a. [-3, -2, -1] b. [0, 2, 6] c. [0, 1, 2] d. [-3, -1, 3]
What is the famous one-line Hello World program of Python? a. print(“Hello World!”) b. print “Hello World!” c. print(“Hello World!”)! d. print(“Hello World!”):
What is used for multi-line strings in Python? a. Three braces {{{ }}} b. Three Colons ::: ::: c. Three hashes ### ### d. Three Quotes ”’ ”’
What will be the output after the following statements? x = 90 y = ‘I ran for %s minutes’ print(y % x) a. y ran for x minutes b. y ran for 90 minutes c. I ran for 90 minutes d. I ran for x minutes
What will be the output after the following statements? x = ‘She’ y = 60 z = ‘ran for %s minutes’ print(x, z % y) a. ran for 60 minutes b. she ran for 60 minutes c. She ran for 60 minutes d. x ran for 60 minutes
What will be the output after the following statements? x = 75 y = 60 z = ‘ran for %s minutes’ print(z % y) a. ran for 75 minutes b. ran for 60 minutes c. ran for 135 minutes d. y ran for 60 minutes
What will be the output after the following statements? x = 7 y = 6 z = ‘He ran for %s minutes for %s days’ print(z % (x, y)) a. He ran for 7 minutes for 7 days b. He ran for 6 minutes for 6 days c. He ran for 6 minutes for 7 days d. He ran for 7 minutes for 6 days
What will be the output after the following statements? x = ‘Python 2’ y = ‘Python 3’ z = ‘We can convert %s program to %s program’ print(z % (x, y)) a. We can not convert Python 2 program to Python 3 program b. We can not convert Python 3 program to Python 2 program c. We can convert Python 2 program to Python 3 program d. We can convert Python 3 program to Python 2 program
What will be the output after the following statements? x = ‘ ‘ print(x*5) a. Displays a tab b. Displays 5 spaces c. Displays a newline d. Displays 10 quotes
What will be the output after the following statements? x = ‘no’ y = ‘yes’ z = ‘may be’ a = [y, z, x] print(a) a. ‘yes’, ‘may be’, ‘no’ b. ‘no’, ‘may be’, ‘yes’ c. [‘no’, ‘may be’, ‘yes’] d. [‘yes’, ‘may be’, ‘no’]
Which of the following operations is not possible while manipulating lists? a. Addition b. Multiplication c. Division d. Deletion
Which of the following is used by interpreter to identify code blocks? a. Braces b. Indentation c. Commas d. Expressions
What will be the output after the following statements? x = [“Yesterday’s”, “Today’s”, “Tomorrow’s”] y = [‘weather’, ‘temperature’, ‘humidity’] for i in x: print(i, end=’ ‘) for j in y: print(j, end=’ ‘) a. Yesterday’s Today’s Tomorrow’s weather temperature humidity b. Yesterday’s weather temperature humidity c. Yesterday’s weather temperature humidity Today’s Tomorrow’s d. Yesterday’s weather Today’s temperature Tomorrow’s humidity
What will be the output after the following statements? x = [“Yesterday’s”, “Today’s”, “Tomorrow’s”] y = [‘temperature’] for i in x: print(i, end=’ ‘) for j in y: print(j, end=’ ‘) a. Yesterday’s Today’s Tomorrow’s temperature b. Yesterday’s temperature c. Yesterday’s temperature Today’s Tomorrow’s d. Yesterday’s temperature Today’s temperature Tomorrow’s temperature
What will be the output after the following statements? x = [“Yesterday’s”, “Today’s”, “Tomorrow’s”] y = [‘temperature’] for i in x: if i[0] == ‘T’: for j in y: print(i, j, end=’ ‘) a. Today’s Tomorrow’s temperature b. Today’s temperature Tomorrow’s temperature c. temperature Today’s Tomorrow’s d. Today’s temperature Tomorrow’s
What will be the output after the following statements? x = [“Yesterday’s”, “Today’s”, “Tomorrow’s”] y = [‘temperature’] for i in x: if i[0] != ‘T’: for j in y: print(i, end=’ ‘) a. Today’s Tomorrow’s temperature b. Yesterday’s temperature Tomorrow’s temperature c. Yesterday’s d. Yesterday’s Today’s Tomorrow’s
What will be the output after the following statements? x = [“Yesterday’s”, “Today’s”, “Tomorrow’s”] y = [‘temperature’] for i in x: if i[0] != ‘y’: for j in y: print(j, end=’ ‘) a. temperature temperature b. temperature c. temperature temperature temperature d. Yesterday’s Today’s Tomorrow’s
What will be the output after the following statements? x = 25 y = 10 while x < 26 and y < 11: x = x + 1 y = y + 1 print(x,y) a. 26 11 b. 25 11 c. 25 10 d. 26 10
What will be the output after the following statements? x = 25 y = 10 while x < 26 and y < 11: print(x,y) x = x + 1 y = y + 1 a. 26 11 b. 25 11 c. 25 10 d. 26 10
What will be the output after the following statement? print(list(range(0,5))) a. list(range(0,5)) b. list(0, 1, 2, 3, 4) c. 0, 1, 2, 3, 4 d. [0, 1, 2, 3, 4]
What will be the output after the following statements? def abc(world): print(‘hello %s’ % world) abc(‘Python’) a. hello world b. hello Python c. hello d. hello % world
What will be the output after the following statements? def abc(x, y): print(‘hello %s %s’ % (y, x)) abc(‘Python’, ‘world’) a. hello world b. hello Python world c. hello Python d. hello world Python
What will be the output after the following statements? b = ‘Python’ a = ‘world’ def pypi(x, y): print(‘hello %s %s’ % (y, x)) pypi(a, b) a. hello world b. hello Python world c. hello Python d. hello world Python
What will be the output after the following statements? a = 12 b = 45 c = 10 def pypi(x, y, z): return(z * y – x) print(pypi(b, c, a)) a. 15 b. 45 c. 75 d. 120
What will be the output after the following statements? def pypi(): b = 25 c = 20 return(a * b – c) a = 12 print(pypi()) a. 280 b. Error c. 60 d. 215
What will be the output after the following statements? class Furniture: def legs(x): print(‘has %s legs’ % x) Furniture.legs(4) a. Furniture has 4 legs b. Error c. has 4 legs d. legs has 4 legs
What will be the output after the following statements? class Furniture: def legs(): print(‘is made of wood’) Furniture.legs() a. Furniture is made of wood b. is made of wood c. print(is made of wood) d. legs is made of wood
What will be the output after the following statements? class Furniture: def chair(x): print(‘It has %s legs’ % x) def table(x): print(‘It has %s legs’ % x) Furniture.table(6) a. It has 4 legs b. It has no legs c. It has 0 legs d. It has 6 legs
What will be the output after the following statements? class Furniture: def chair(): print(‘It has 4 legs’) def table(): print(‘It has 6 legs’) Furniture.chair() a. It has 4 legs b. It has no legs c. It has 0 legs d. It has 6 legs
What will be the output after the following statements? x = -4 if abs(x) > 0: print(‘This is absolute value’) a. None b. Error c. Wrong Value d. This is absolute value
What will be the output after the following statements? x = -3 if abs(x) < 3: print(x) else: print(0) a. No output b. Error c. 0 d. -3
What will be the output after the following statements? x = -4 if bool(x): print(x) else: print(0) a. No output b. Error c. 0 d. -4
What will be the output after the following statements? x = 0 if bool(x): print(x) else: print(5) a. No output b. Error c. 5 d. 0
What will be the output after the following statements? x = ‘None’ if bool(x): print(‘Yes’) else: print(‘No’) a. None b. Yes c. No d. 0
What will be the output after the following statements? x = ” if bool(x): print(‘Yes’) else: print(‘No’) a. None b. Yes c. No d. 0
What will be the output after the following statements? x = ‘ ‘ if bool(x): print(‘Yes’) else: print(‘No’) a. None b. Yes c. No d. 0
What will be the output after the following statements? x = [] if bool(x): print(‘Yes’) else: print(‘No’) a. No b. Yes c. None d. 0
What will be the output after the following statements? x = [1, 2, 3] if bool(x): print(‘Yes’) else: print(‘No’) a. No b. Yes c. None d. 0
What will be the output after the following statements? x = ” if not bool(x): print(‘Yes’) else: print(‘No’) a. Yes b. No c. None d. 0
What will be the output after the following statements? x = ‘print(“Python”)’ eval(x) a. x b. print(“Python”) c. Python d. 0
What will be the output after the following statements if input entered is 45*2? x = input(“Enter an expression: “) print(eval(x)) a. 45*2 b. eval(“90”) c. 90 d. 0
What will be the output after the following statements? x = ”’print(“Python 3″, end=”) print(” is Good”)”’ exec(x) a. Python 3is Good b. Python 3 is Good c. Python 3 d. is Good
What will be the output after the following statements? a = [‘a’, ‘b’, ‘c’, ‘A’, ‘B’] print(max(a)) a. a b. A c. b d. c
What will be the output after the following statements? a = [‘a’, ‘b’, ‘c’, ‘A’, ‘B’] print(min(a)) a. a b. A c. b d. c
What will be the output after the following statements? a = [‘a’, ‘b’, ‘c’, ‘1’, ‘2’, ‘A’, ‘B’] print(max(a)) a. a b. A c. 1 d. c
What will be the output after the following statements? a = [‘a’, ‘b’, ‘c’, ‘1’, ‘2’, ‘A’, ‘B’] print(min(a)) a. a b. A c. 1 d. c
What will be the output after the following statements? a = [1, 2, 3] print(sum(a)) a. 3 b. 2 c. 1 d. 6
What will be the output after the following statements? a = list(range(0,10,3)) print(sum(a)) a. 10 b. 100 c. 18 d. 30
What will be the output after the following statements? a = list(range(10,-10,3)) print(sum(a)) a. 10 b. 0 c. 18 d. 90