Python is a/an .......... language.
- High level
- Object oriented
- procedural
- difficult
Answer
High level, Object oriented
Reason — Python is a high level, object oriented language.
Python uses a/an .......... to convert source code to object code.
- Interpreter
- Compiler
- Combination of Interpreter and compiler
- Special virtual engine
Answer
Interpreter
Reason — Python uses an interpreter to convert source code to object code.
Python code can run on a variety of platforms, it means Python is a .......... language.
- Graphical
- Cross-platform
- independent
- all of these
Answer
Cross-platform
Reason — Python is a cross-platform language because it can run on various operating systems like Windows, macOS, and Linux.
Python programs are typed in
- Interactive mode
- Script mode
- A combination of interactive and script modes
- All of these
Answer
Script mode
Reason — Python programs are typed in script mode, where the code is written in a file and executed all at once.
The .......... mode of Python gives instant result of typed statement.
- Interactive mode
- Script mode
- Combination of interactive and script modes
- All of these
Answer
Interactive mode
Reason — The interactive mode of Python gives instant results for typed statements, as we type commands one by one and get the results one by one.
Which of the following is not a Python IDE ?
- IDLE
- Spyder
- Jupyter Notes
- Sublime Text
Answer
Sublime Text
Reason — Sublime Text is not a Python IDE but a general text editor. In contrast, IDLE, Spyder, and Jupyter Notes are Python IDE.
To print the value of a variable, Python uses
- Print statement
- Print() function
- print statement
- print() function
Answer
print() function
Reason — Python uses the print() function to print the value of a variable.
You don't have to pay for Python and you can view its source code too. It means Python is ..........
- Free and open source
- freeware
- open source
- shareware
Answer
Free and open source
Reason — Python is classified as "free and open source" because it can be freely used, modified, and distributed.
Python is a high level language.
Python's two working modes are : interactive mode and script mode.
The shortcut key to run a Python program from script mode is F5.
Python programs/scripts are stored in files with .py extension.
Python's default distribution's IDE is called IDLE.
Python is the fastest language.
Answer
False
Reason — Python is not considered the fastest programming language because it is an interpreted language, which makes it slower than compiled languages like C or C++.
Python code is compiled before running.
Answer
False
Reason — Python code is an interpreted language, that is, all the commands we write are interpreted and executed one by one.
You can create programs in Python's interactive mode.
Answer
False
Reason — In Python's script mode, we can write complete programs in a text file, which can be executed all at once.
You can create programs in Python's script mode.
Answer
True
Reason — In Python's script mode, we can write complete programs in a text file, which can be executed all at once.
Python is an interpreted language.
Answer
True
Reason — Python code is an interpreted language, that is, all the commands we write are interpreted and executed one by one.
Assertion (A): In Python, one can work in interactive mode and script mode.
Reasoning (R): Interactive mode gives the outputs of commands interactively while script mode doesn't.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
In Python, one can work in both interactive and script modes. Interactive mode provides immediate feedback by displaying the output of commands as they are entered, while script mode executes code written in files without showing outputs until the entire script runs.
Assertion (A): One cannot create programs/scripts in interactive mode of Python.
Reasoning (R): Interactive mode instantly gives outputs of commands.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
One cannot create programs or scripts in Python's interactive mode. In Python's script mode, we can write complete programs in a text file, which can be executed all at once. The interactive mode provides instant results for typed statements, allowing us to input commands one by one and receive results immediately.
Assertion (A): Script mode of Python is suitable for creating programs.
Reasoning (R): The working of interactive mode can be saved for later, with a name, as a program.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Answer
A is true but R is false.
Explanation
In Python's script mode, we can write complete programs in a text file, which can be executed all at once. In contrast, the interactive mode does not allow saving the session as a program with a name.
When was Python released ?
Answer
Python was developed in February 1991.
Who was Python's developer and which two languages contributed to Python as a programming language?
Answer
Guido Van Rossum is the developer of Python. ABC language and Modula-3 contributed to Python as a programming language.
What is a cross-platform software?
Answer
A cross-platform software is a software that can run well on a variety of platforms like Windows, Linux/Unix, Macintosh, etc.
What are the advantages of Python programming language?
Answer
Advantages of Python programming language are:
- Easy to Use — Python is compact, programmer-friendly and very easy to use object oriented language with very simple syntax rules.
- Expressive Language — Python is an expressive language, it takes fewer lines of codes to represent the same syntax.
- Interpreted Language — Python is an interpreted language, not a compiled language. It makes Python an easy-to-debug language and thus suitable for beginners to advanced users.
- Completeness — Python has a rich standard library that provides modules for most types of required functionality like emails, web-pages, databases, GUI development, network connections, etc.
- Cross-platform Language — Python can run equally well on variety of platforms — Windows, Linux/UNIX, Macintosh, supercomputers, smart phones, etc.
- Free and Open Source — Python language is freely available along with its source-code.
- Variety of Usage/Applications — Python has evolved into a powerful, complete and useful language over these years. These days Python is being used in many diverse fields/applications, some of which are Scripting, Web Applications, Game development, Database Applications, System Administrations, Rapid Prototyping, GUI Programs.
What are some limitations of Python programming language?
Answer
Some limitations of Python programming language are:
- Not the Fastest Language — As Python is an interpreted language so its execution-times are not that fast compared to some compiled languages.
- Lesser Libraries than C, Java, Perl — Library collection of C, Java, Perl is better than Python.
- Not strong on Type-Binding — Python interpreter is not very strong on catching 'Type-Mismatch' issues.
- Not easily convertible — Translating Python programs to other languages is difficult due to its lack of syntax.
In how many different ways, can you work in Python?
Answer
We can work in Python in two ways:
- Interactive mode (also called Immediate mode)
- Script mode
What are advantages/disadvantages of working in Interactive mode in Python?
Answer
Interactive mode is useful for testing code. We can type the commands one by one and get the result of error immediately for each command. Disadvantages of Interactive mode are that it does not save commands in form of a program and also output is sandwiched between commands.
What are the advantages/disadvantages of working in script mode in Python?
Answer
Script mode is useful for creating programs and then run the programs later and get the complete output. It is not suitable for testing code.
Write instructions to get the following result :
Math is Fun so don't be resistant
Just learn the rules, the rules are consistent
And most important, you must be persistent !
Adding fractions, get common denominators.
Multiply by missing factors to get the denominators.
Add numerators only, NOT denominators.
Do it in both interactive mode and script mode.
Answer
>>> print("Math is Fun so don't be resistant")
Math is Fun so don't be resistant
>>> print("Just learn the rules, the rules are consistent")
Just learn the rules, the rules are consistent
>>> print("And most important, you must be persistent !")
And most important, you must be persistent !
>>> print("")
>>> print("Adding fractions, get common denominators.")
Adding fractions, get common denominators.
>>> print("Multiply by missing factors to get the denominators.")
Multiply by missing factors to get the denominators.
>>> print("Add numerators only, NOT denominators.")
Add numerators only, NOT denominators.
>>>
print("Math is Fun so don't be resistant")
print("Just learn the rules, the rules are consistent")
print("And most important, you must be persistent !")
print("")
print("Adding fractions, get common denominators.")
print("Multiply by missing factors to get the denominators.")
print("Add numerators only, NOT denominators.")Math is Fun so don't be resistant
Just learn the rules, the rules are consistent
And most important, you must be persistent !
Adding fractions, get common denominators.
Multiply by missing factors to get the denominators.
Add numerators only, NOT denominators.