Python Online Quiz Test-Latest By 2021

Python Online Quiz Test-Programming Language

Python Online Quiz is one of the largest searchable categories across the world. keep reading and practicing for tests, exams, and interviews for professional fields. there are thousands of selected questions with answers.

Python History | Data Types | Variables And Operators | Conditionals And Loops | Functions | Arguments | String in Python | Python List | Python Tuple | Python Dictionary | Python Sets | Python oops | Classes and Objects | Inheritance | Regular Expressions | Exception Handling

 

 

Python was developed by

A. Guido van Rossum
B. James Gosling
C. Dennis Ritchie
D. Bjarne Stroustrup

Answer

Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming. It was created by Guido van Rossum, and first released on February 20, 1991

 

Python was developed in which year?

A. 1972
B. 1995
C. 1989
D. 1981

Answer
D

It was created by Guido van Rossum, and first released on February 20, 1991. While you may know python as a large snake, the name of the Python programming language comes from an old BBC television comedy sketch series called Monty Python’s Flying Circus.

 

Python is written in which language?

A. C
B. C++
C. Java
D. None of the above

Answer
C

Python is written in C (actually the default implementation is called CPython). Python is written in English. But there are several implementations: PyPy (written in Python)

 

What is the extension of the python file?

A. .p
B. .py
C. .python
D. None of the above

Answer
B

The python file is saved with an extension .py. So, Option B is correct.

 

Python is an Object-Oriented Programming Language.

A. True
B. False
C. Neither true nor false
D. None of the above

Answer
A

Yes, Python is an object-oriented language but not pure. It does not support strong encapsulation while it is one of the core features of an “object-oriented” programming language. So, Option A is correct.

 

Python 3.0 is released in which year?

A. 2000
B. 2008
C. 2011
D. 2016

Answer
B

December 3rd, 2008
Python 3.0 final was released on December 3rd, 2008. Python 3.0 (a.k.a. “Python 3000” or “Py3k”) is a new version of the language that is incompatible with the 2. x line of releases.

 

Which of the following statements is true?

A. Python is a high-level programming language.
B. Python is an interpreted language.
C. Python is an object-oriented language
D. All of the above

Answer
D

Python is a high-level, object-oriented, and interpreted programming language. So, Option D is correct.

 

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

A. Parenthesis
B. Indentation
C. Curly braces
D. None of the above

Answer
B

Python uses indentation to define blocks of code. Indentations are simply Blank spaces or Tabs which is used as an indicator that the indented code is the child part. As curly braces are used in C/C++/Java.. So, Option B is correct.

 

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

A. *
B. @
C. #
D.!

Answer
C

# is used for single line is made comment in Python. So, Option C is correct.

 

What is a python file with a .py extension called?

A. package
B. module
C. directory
D. None of the above

Answer
B

Like Scripts, you have a have something called Module which is a Python script imported and used in another Python script. The Python script is saved with a . py extension which informs the computer that it is a Python program script

 

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

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

A. 1
B. 5
C. 0
D. None of the above

Answer
D

The output of the following python code x. Therefore the output is none of the above.

 

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.

A. i, ii
B. i, iv
C. ii, iii
D. ii, iv

Answer
B

Python is a high-level programming language and the Python program is compiled before it is interpreted as the correct statement.

 

Which of the following is the incorrect variable name in Python?

A. variable_1
B. variable1
C. 1variable
D. _variable

Answer
C

1variable is incorrect variable name in Python.The Option C is correct.

 

Which of the following is not a relational operator in Python?

A. >=
B. <=
C. =
D. !=

Answer
C

= is not considered as a relational operator in Python. So Option C is correct.

 

Suppose we have two sets A & B, then A < B is:

A. True if len(A) is less than len(B).
B. True if A is a proper subset of B.
C. True if the elements in A when compared are less than the elements in B.
D. True if A is a proper superset of B.

Answer
B

If A is a proper subset of B then hen all elements of A are in B but B contains at least one element that is not in B.

 

Which of the following will result in an error?

  1. list1[3]=list1[2]
  2. list1[3]=list1[4]
  3. list1.insert(1,78)
  4. list1.pop(50)
If list1=[10,20,60,50]

A. i, iii
B. i, iv
C. ii, iv
D. ii, iii

Answer
C

list1[3]=list1[4] and list1.pop(50) will result in error. So Option C is correct.

 

If str1=”Programming Language” What does str1.find(“m”) return?

A. Number of occurances of “m” in string str1.
B. Index positions of “m” in the string str1.
C. It returns the whole string str1 if it contains “m”.
D. It returns the index position of the first occurance of “m” in the string str1.

Answer
D

It returns the index position of the first occurrence of “m” in the string str1. So Option D is correct.

 

Which of the following is incorrect?

A. List is a built-in data structure in Python
B. List can only have elements of the same data type.
C. List is mutable.
D. Index of lists can be positive as well as negative.

Answer
B

The list can only have elements of the same data type is incorrect.

Leave a Reply