The idea of Python was conceived by Guido van Rossum in the later 1980s at the Centrum Wiskunde & Informatica (CWI), Netherlands. It was seen to be a successor to the ABC programming language. It was inspired by SETL, and was capable of exceptional handling and interfacing with the Amoeba operating system.
Multiple Choice Questions (MCQs):
- When was Python released?
- 16 October, 2001
- 16 October 2000
- 17 October 2000
- 17 October 2001
Answer. b. 16 October 2000. The idea of Python was conceived in the later 1980s, but it was released on a. 16 October 2000.
- When was Python 3.0 released?
- 3 December 2008
- 4 December 2008
- 5 December 2008
- 3 December 2010
Answer. a. The new version of Python 3.0 was released on December 3, 2008.
- Who founded Python?
- Alexander G. Bell
- Vincent van Gogh
- Leonardo da Vinci
- Guido van Rossum
Answer. d. The idea of Python was conceived by Guido van Rossum in the later 1980s.
- What is Python?
- A programming language
- Computer language
- Binary language
- None of the above
Answer. a. Python is a programming language, basically a very high-level and a general-purpose language.
- What does the name Python signify?
- It is a snake
- It is very difficult to use
- Named after the British comedy group Monty Python
- All of the above
Answer. c. It is named after a British comedy group called the Monty Python to signify that it is very easy to use.
- What are the people who specialize in Python called?
- Pythonic
- Unpythonic
- Monty Python
- Pythoniasts
Answer. d. the people who specialize, or are great admirers of this programming language are called as Pythoniasts. They are extremely knowledgeable people.
- What is the type of programming language supported by Python?
- Object-oriented
- Functional programming
- Structured programming
- All of the above
Answer. d. Python is an interpreted programming language, supporting object-oriented, structured, and functional programming.
- When Python is dealing with identifiers, is it case sensitive?
- Yes
- No
- Machine dependent
- Can’t say
Answer. a. It is case sensitive.
- What is the extension of the Python file?
- .pl
- .py
- .python
- .p
Answer. b. The correct extension of python is .py and can be written in any text editor. We need to use the extension .py to save these files.
- All the keywords in Python are in_
- Lower case
- Upper case
- Capitalized
- None of the above
Answer. d. Only True, False and None are capitalized and all the others in lower case.
- What does pip mean in Python?
- Unlimited length
- All private members must have leading and trailing underscores
- Preferred Installer Program
- None of the above
Answer. c. Variable names can be of any length.
- The built-in function in Python is:
- Print ()
- Seed ()
- Sqrt ()
- Factorial ()
Answer. a. The function seed is a function which is present in the random module. The functions sqrt and factorial are a part of the math module. The print function is a built-in function which prints a value directly to the system output.
- Which of the following definitions is the one for packages in Python?
- A set of main modules
- A folder of python modules
- Set of programs making use of python modules
- Number of files containing python definitions and statements
Answer. b. A folder of python modules is called as package of modules
- What is the order in which namespaces in Python looks for an identifier?
- First, the python searches for the built-in namespace, then the global namespace and then the local namespace
- Python first searches for the built-in namespace, then local and finally the global namespace
- Python first searches for local namespace, then global namespace and finally the built-in namespace
- Python searches for the global namespace, followed by the local namespace and finally the built-in namespace.
Answer. C. Python first searches for the local namespace, followed by the global and finally the built-in namespace.
- Which of the following is not a keyword used in Python language?
- Pass
- Eval
- Assert
- Nonlocal
Answer. b. Eval is used as a variable in Python.
- Which of the following is the use of function in python?
- Functions do not provide better modularity for applications
- One can’t create our own functions
- Functions are reusable pieces of programs
- All of the above
Answer. c. Functions are reusable pieces of programs, which allow us to give a name to a particular block of statements, allowing us to run the block using the specified name anywhere in our program and any number of times.
- Which of the following is a feature of Python DocString?
- All functions should have a docstring in python
- DocStrings can be accessed by the _doc_ attribute on objects
- This feature provides a very convenient way of associating documentation with python modules, functions, classes and methods
- All of the above
Answer. d. Python has a nifty feature, which is referred to as the documentation strings, usually referred to by its abbreviated name of docstrings. They are important tools and one must use them as they help document the program better along with making it easier to understand.
- Which of the following is the use of the function id() in python?
- Every object does not have a unique id in Python
- The id function in python returns the identity of the object
- None
- All
Answer. b. Every function in Python has a unique id. The id() function helps return the id of the object
- What is the function of pickling in python?
- Conversion of a python object
- Conversion of database into list
- Conversion of byte stream into python object hierarchy
- Conversion of list into database
Answer. a. The process of pickling refers to sterilizing a Python object, which means converting a byte stream into python object hierarchy. The process which is the opposite of pickling is called unpickling.
- What is Python code-compiled or interpreted?
- The code is both compiled and interpreted
- Neither compiled nor interpreted
- Only compiled
- Only interpreted
Answer. b. There are a lot of languages which have been implemented using both compilers and interpreters, including C, Pascal, as well as python.