0% found this document useful (0 votes)
7 views4 pages

Python Basics: MCQs and Answers

The document provides a comprehensive overview of Python programming, including multiple choice questions, fill-in-the-blanks, true/false questions, and short answer questions. Key topics covered include Python's characteristics, advantages, limitations, and modes of operation. It also includes practical examples of using Python in both interactive and script modes.

Uploaded by

ektasingla78
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Python Basics: MCQs and Answers

The document provides a comprehensive overview of Python programming, including multiple choice questions, fill-in-the-blanks, true/false questions, and short answer questions. Key topics covered include Python's characteristics, advantages, limitations, and modes of operation. It also includes practical examples of using Python in both interactive and script modes.

Uploaded by

ektasingla78
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Getting Started with Python

Multiple Choice Questions


Q1. Python is a/an .......... language.
a. High level ✓ c. Object oriented ✓
b. Procedural d. difficult
Q2. Python uses a/an .......... to convert source code to object code.
a. Interpreter ✓ c. Compiler
b. Combination of Interpreter and compiler d. Special virtual engine
Q3. Python code can run on a variety of platforms, it means Python is a .......... language.
a. Graphical c. Cross-platform ✓
b. independent d. all of these
Q4. Python programs are typed in
a. Interactive mode c. Script mode ✓
b. A combination of interactive and script modes d. All of these
Q5. The .......... mode of Python gives instant result of typed statement
a. Interactive mode ✓ c. Script mode
b. Combination of interactive and script modes d. All of these
Q6. Which of the following is not a Python IDE ?
a. IDLE b. Spyder c. Jupyter Notes d. Sublime Text ✓
Q7. To print the value of a variable, Python uses
a. Print statement c. Print( ) function
b. print statement d. print( ) function ✓
Q8. You don't have to pay for Python and you can view its source code too. It means Python
is ..........
a. Free and open source ✓ c. freeware
b. open source d. shareware

Fill in the Blanks

Q1. Python is a high level language.

Q2. Python's two working modes are : interactive mode and script mode.

Q3. The shortcut key to run a Python program from script mode is F5.

Q4. Python programs/scripts are stored in files with .py extension.

Q5. Python's default distribution's IDE is called IDLE.


True/False Questions
Q1. Python is the fastest language. False
Q2. Python code is compiled before running. False
Q3. You can create programs in Python's interactive mode. False
Q4. You can create programs in Python's script mode. True
Q5. Python is an interpreted language. True
Type A: Short Answer Questions
Q1. When was Python released ?
Ans Python was developed in February 1991.
Q2. Who was Python's developer and which two languages contributed to Python as a
programming language?
Ans Guido Van Rossum is the developer of Python. ABC language and Modula-3 contributed
to Python as a programming language.
Q3. What is a cross-platform software?
Ans A cross-platform software is a software that can run well on a variety of platforms like
Windows, Linux/Unix, Macintosh, etc.
Q4. What are the advantages of Python programming language?
Ans Advantages of Python programming language are:
1. Easy to Use — Python is compact, programmer-friendly and very easy to use object
oriented language with very simple syntax rules.
2. Expressive Language — Python is an expressive language, it takes fewer lines of codes to
represent the same syntax.
3. 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.
4. 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.
5. Cross-platform Language — Python can run equally well on variety of platforms —
Windows, Linux/UNIX, Macintosh, supercomputers, smart phones, etc.

6. Free and Open Source — Python language is freely available along with its source-code.
7. 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.
Q5. What are some limitations of Python programming language?
Ans Some limitations of Python programming language are:
1. Not the Fastest Language — As Python is an interpreted language so its execution-times
are not that fast compared to some compiled languages.
2. Lesser Libraries than C, Java, Perl — Library collection of C, Java, Perl is better than
Python.
3. Not strong on Type-Binding — Python interpreter is not very strong on catching 'Type-
Mismatch' issues.
4. Not easily convertible — Translating Python programs to other languages is difficult due
to its lack of syntax.
Q6. In how many different ways, can you work in Python?
Ans We can work in Python in two ways:
1. Interactive mode (also called Immediate mode) 2. Script mode

Q7. What are advantages/disadvantages of working in Interactive mode in Python?


Ans 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.
Q8. What are the advantages/disadvantages of working in script mode in Python?
Ans 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.
Type B: Application Based Question
Q1. 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.

Ans Interactive Mode

>>> 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.
>>>
Script Mode
Solution
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.")
Output
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.

You might also like