109

PYTHON - FINAL EXAM

The number of attempts remaining is 5

1 / 100

What will the below Python code will return?

list1=[0,2,5,1]
str1="7"
for i in list1:
	str1=str1+i
print(str1)

2 / 100

All keyword in python are in

3 / 100

What will be the output of above Python code?

str1="6/4"
print("str1")

4 / 100

What is the maximum length of an identifier in python?

5 / 100

Which operator is used in Python to import modules from packages?

6 / 100

What is a python file with .py extension called?

7 / 100

What is a recursive function?

8 / 100

Which of the following statements are correct?
(i) Python is a high level programming language.
(ii) Python is an interpreted language.
(iii) Python is a compiled language.
(iv) Python program is compiled before it is interpreted.

9 / 100

What is the output of the following program : print((1, 2) + (3, 4))

10 / 100

Which of the following will result in an error?

str1="python"

11 / 100

Which statement will check if a is equal to b?

12 / 100

Which statement is correct?

13 / 100

How to get last element of list in python? Suppose we have list with name arr, contains 5 elements.

14 / 100

Which of the following is the property of variable argument count?

15 / 100

Which of the following statment is False?

16 / 100

What is used to define a block of code in Python?

17 / 100

In Python, how are arguments passed?

18 / 100

What will be the values of var1 and var2 after the execution of program?

var=3
var1=0
var2=var1+1
while(var<7):
    var2=var2+var1
    if(var1%2==0):
        var=var+1
        var1=var1+1
    else:
        var2=var2*var1
        var1=var1+3

19 / 100

Which of the following is False regarding loops in Python?

20 / 100

The marks of a student on 6 subjects are stored in a list, list1=[80,66,94,87,99,95]. How can the student's average mark be calculated?

21 / 100

Which of the following two Python codes will give same output?
(i) print(tupl[:-1])
(ii) print(tupl[0:5])
(iii) print(tupl[0:4])
(iv) print(tupl[-4:])

If tupl=(5,3,1,9,0)

22 / 100

Python is written in which language?

23 / 100

What will be the output of the following Python code?

def function1(var1=5, var2=7):
    var2=9
    var1=3
    print (var1, " ", var2)
function1(10,12)

24 / 100

Python is Object Oriented Programming Language.

25 / 100

Which one is false regarding global variables?

26 / 100

What will be the output of below Python code?

tupl=("annie","hena","sid")
print(tupl[-3:0])

27 / 100

Which of the following is incorrect regarding variables in Python?

28 / 100

Which of the following statements is true?

29 / 100

What will be the output of the following Python code?

def function1(var1,var2=5):
    var1=2
    var3=var1*var2
    return var3
var1=3
print(function1(var1,var2))

30 / 100

What will be the output of below Python code?

list1=["tom","mary","simon"]
list1.insert(5,8)
print(list1)

31 / 100

What will be the output of the following Python code?

def function1(var1):
    var1=var1+10
    print (var1)
var1=12
function1(var1)
print(var1)

32 / 100

What will be the output of the following program on execution?

a=0
b=5
x=(a&b)|(a&a)|(a|b)
print("x")

33 / 100

Choose the correct option with respect to Python.

34 / 100

If return statement is not used inside the function, the function will return:

35 / 100

Python 3.0 is released in which year?

36 / 100

What will be the result of following Python code snippet after execution?

a=0
b=1
if (a and b):
    print("hi")
elif(not(a)):
    print("hello")
elif(b):
    print("hi world")
else:
    print("hello world")

37 / 100

Suppose a list with name arr, contains 5 elements. You can get the 2nd element from the list using:

38 / 100

The elements of a list are arranged in descending order. Which of the following two will give same outputs?
i. print(list_name.sort())
ii. print(max(list_name))
iii. print(list_name.reverse())
iv. print(list_name[-1])

39 / 100

Which one is false regarding local variables?

40 / 100

What type of data is: arr = [(1,1),(2,2),(3,3)]?

41 / 100

Which among the following are mutable objects in Python?
(i) List
(ii) Integer
(iii) String
(iv) Tuple

42 / 100

Python was developed in which year?

43 / 100

What is called when a function is defined inside a class?

44 / 100

Which of the following is not used as loop in Python?

45 / 100

What will following Python code return?

str1="Stack of books"
print(len(str1))

46 / 100

What will be the output of below Python code?

list1=[8,0,9,5]
print(list1[::-1])

47 / 100

Which of the following is incorrect variable name in Python?

48 / 100

What will be the output of the following Python code?

def fn(var1):
    var1.pop(1)
var1=[1,2,3]
fn(var1)
print(var1)

49 / 100

What will be the result after the execution of above Python code?

list1=[3,2,5,7,3,6]
list1.pop(3)
print(list1)

50 / 100

Which of the following is True regarding loops in Python?

51 / 100

What will be the output of below Python code?

tupl=()
tupl1=tupl*2
print(len(tupl1))

52 / 100

What will be the output of below Python code?

str1="poWer"
str1.upper()
print(str1)

53 / 100

Which of the following options will not result in an error when performed on tuples in Python where tupl=(5,2,7,0,3)?

54 / 100

What will be output of this expression:

'p' + 'q' if '12'.isdigit() else 'r' + 's'

55 / 100

What is the extension of python file?

56 / 100

What keyword would you use to add an alternative condition to an if statement?

57 / 100

Which of the following is not valid variable name in Python?

58 / 100

What will be the output of below Python code?

tuple1=(5,1,7,6,2)
tuple1.pop(2)
print(tuple1)

59 / 100

Which of the given options has same output as given statement?

If var1=7
var2=5
var3=1
var4=10
var5=20
(var1*var2)>(var5+var4*var3) and ((var5+var3)/var1)>=(var2-2)/var3

60 / 100

What will the below Python code will return?

If str1="save paper,save plants"
str1.find("save")

61 / 100

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)
tupl[0][1]=1
print(tupl)

62 / 100

Which of the following will print the pi value defined in math module?

63 / 100

Which of the following would result in an error?

64 / 100

Which of these is not a core data type?

65 / 100

Can tuple be used as dictionary key in python?

66 / 100

Which of the following is incorrect way of using an argument while defining a function in Python, where var1 and var2 are two arguments?

67 / 100

Which of the following would give an error?

68 / 100

What will be the output of the following program on execution?

if False:
	print ("inside if block")
elif True:
	print ("inside elif block")
else:
	print ("inside else block")

69 / 100

Which of the following is True regarding lists in Python?

70 / 100

Which keyword is use for function?

71 / 100

Which of the following items are present in the function header?

72 / 100

Which of the following Python code will give different output from the others?

73 / 100

What will be the output of below Python code?

tuple1=(2,4,3)
tuple3=tuple1*2
print(tuple3)

74 / 100

Which of the following is False?

75 / 100

What will be the output of below Python code?

str1="Information"
print(str1[2:8])

76 / 100

What will be the output of below Python code?

str1="Aplication"
str2=str1.replace('a','A')
print(str2)

77 / 100

Which one of the following is a valid Python if statement :

78 / 100

Which of the following function headers is correct?

79 / 100

What will be the output of following Python code snippet?

for i in range(0 , -2 , -1):
    print(i)

80 / 100

Which of the following is the use of id() function in python?

81 / 100

Which one of the following is correct way of declaring and initialising a variable, x with value 5?

82 / 100

What will be the output of following Python code?

list1=["Python","Java","c","C","C++"]
print(min(list1))

83 / 100

What will be the output of the following code?

arr = [1,2,3,4,5,6]
  print(a[::2])

84 / 100

Suppose a tuple arr contains 10 elements. How can you set the 5th element of the tuple to 'Hello'?

85 / 100

What will be the output of the following program on execution?

a=0
b=6
x=(a&b)|(a&a | a&b)
y=not(x)
print(y)

86 / 100

Choose the correct option.

87 / 100

Python was developed by

88 / 100

Can we write if/else into one line in python?

89 / 100

Which of the following is not a type of argument in Python?

90 / 100

Which of the following will give error?

91 / 100

In a Python program, a control structure:

92 / 100

Which of the following will give "Simon" as output?

If str1="John,Simon,Aryan"

93 / 100

In which part of memory does the system stores the parameter and local variables of funtion call?

94 / 100

What will be the output of below Python code?

list1=[1,3,5,2,4,6,2]
list1.remove(2)
print(sum(list1))

95 / 100

How many keywords are there in python 3.7?

96 / 100

 Which of the following will give output as [23,2,9,75] ?

If list1=[6,23,3,2,0,9,8,75]

97 / 100

Which of the following creates a tuple?

98 / 100

How to copy one list to another in python?

99 / 100

By the use of which character, single line is made comment in Python?

100 / 100

What will be the output of following Python code snippet?

str1="012"
num1=2
num2=0
for i in range(4):
    num1+=2
    for j in range(len(str1)):
        num2=num2+num1
num3=num2%int(str1)
print(num3)