Python Programming Quiz


Play this Python quiz that will help you to excel in C++ certification exams, placements etc. This Python programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This Python programming test enables you to assess your knowledge of Python programming.

Take the Free Practice Test



Python MCQs

Practice Python MCQ Questions, which will help you to understand Python programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

Python Quiz

Try Free Python Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

Python Quiz

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

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

print(list1[1:7:2])
print(list1[0:7:2])
print(list1[1:8:2])
print(list1[0:8:2])

2. What will be output of this expression:

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

pq
rs
pqrs
pq12

3. Which of the following Python codes will give same output if
(i) dict.pop("book")
(ii) del dict["book"]
(iii) dict.update({"diary":1,"novel":5})

dict={"diary":1,"book":3,"novel":5}

i, ii, iii
i, ii
i, iii
ii, iii

4. Which of the following would result in an error?

def function1(var1=2, var2):
    var3=var1+var2
     return var3
    function1(3)

def function1(var1, var2):
    var3=var1+var2
    return var3
    function1(var1=2,var2=3)

def function1(var1, var2):
    var3=var1+var2
    return var3
    function1(var2=2,var1=3)

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

5. Function blocks begin with the keyword?

define
fun
function
def

6. Which of the following is False regarding loops in Python?

Loops are used to perform certain tasks repeatedly.
While loop is used when multiple statements are to executed repeatedly until the given condition becomes False
While loop is used when multiple statements are to executed repeatedly until the given condition becomes True.
for loop can be used to iterate through the elements of lists.

7. Which inheritance is a blend of more than one type of inheritance?

single inheritance
Hybrid inheritance
Multiple inheritance
Multilevel inheritance

8. What will be the output of below Python code?

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

["tom", "mary", "simon", 5]
["tom", "mary", "simon", 8]
[8, "tom", "mary", "simon"]
Error

9. What will be the output of the following Python code?

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

[1,2,3]
[1,3]
[2,3]
[1,2]

10. Which of the following is True regarding lists in Python?

Lists are immutable.
Size of the lists must be specified before its initialization
Elements of lists are stored in contagious memory location.
size(list1) command is used to find the size of lists.

Results