PYTHON QUIZ
1 .
What is the value of colors[2]?
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']​

Correct Answer : Option (B)

yellow
  Show Answer
2 .
What is the output of the following code?
print(3 >= 3)​

Correct Answer : Option (A)

True
  Show Answer
3 .
what is the output of the following code?
print(type([1,2]))​

Correct Answer : Option (C)

<class 'list'>
  Show Answer
4 .
What is the output when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]​

Correct Answer : Option (D)

o
  Show Answer
5 .
What is the output when following code is executed ?
>>>str1="helloworld"
>>>str1[::-1]

Correct Answer : Option (A)

dlrowolleh
  Show Answer
6 .
What will be printed:
def f(a, b):
 print(a, b)
f(b=1, *(2,))​

Correct Answer : Option (B)

2 1
  Show Answer
7 .
What is inheritance used for?

Correct Answer : Option (A)

To give a class the methods and variables of an interface
  Show Answer
8 .
What will be placed in a?
a = [1,2,3]
a[-3:-1] = 10,20,30,40

Correct Answer : Option (B)

[10, 20, 30, 40, 3]
  Show Answer
9 .
What does this function return?
def f(a,b):
 return a,b
f(**{'b':2,'a':1})​

Correct Answer : Option (A)

(1, 2)
  Show Answer
10 .
Which of these is not a Python datatype?

Correct Answer : Option (C)

decimal
  Show Answer