0% found this document useful (0 votes)
3 views3 pages

Python Basics: MCQs and Key Concepts

This document contains multiple choice questions, fill-in-the-blank exercises, and short answer questions related to Python programming. It covers topics such as Python's creator, file extensions, variable characteristics, and the importance of comments. Additionally, it highlights Python's features like portability, readability, and the use of an interpreter.

Uploaded by

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

Python Basics: MCQs and Key Concepts

This document contains multiple choice questions, fill-in-the-blank exercises, and short answer questions related to Python programming. It covers topics such as Python's creator, file extensions, variable characteristics, and the importance of comments. Additionally, it highlights Python's features like portability, readability, and the use of an interpreter.

Uploaded by

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

5 GETTING STARTED WITH PYTHON

Multiple Choice Questions (MCQs) 7. What is the extension for a Python script file?
1. Who created Python? (A) .pyt (B) .ptn
(A) Guido Van Rossum (C) .script (D) .py
(B) Dennis Ritchie Ans: (D) .py
(C) James Gosling 8. Which statement is true about Python
variables?
(D) Bjarne Stroustrup
(A) They cannot contain numbers
Ans: (A) Guido Van Rossum
2. Which feature of Python means it can run on (B) They must begin with an uppercase letter
various operating systems? (C) They refer to objects stored in memory
(A) Case Sensitivity (D) They must be declared before use
(B) High-Level Language Ans: (C) They refer to objects stored in memory
(C) Portability 9. What does the id() function return in Python?
(D) Rich Standard Library (A) The data type of a variable
Ans: (C) Portability (B) The value of a variable
3. In Python, what is the symbol >>> known (C) The identity of an object
as? (D) The size of an object
(A) Interpreter (B) Prompt Ans: (C) The identity of an object
(C) Shell (D) Script 10. Which of the following is used to add
Ans: (B) Prompt comments in Python?
4. How are Python blocks defined? A) // B) #
(A) Brackets (B) Indentation C) /* D) --
(C) Semicolons (D) Curly Braces Ans: B) #
Ans: (B) Indentation Fill in the Blanks
5. Which of the following is NOT a Python
keyword? 1. Python was created by __________ during
his tenure at CWI (Centrum Wiskunde &
(A) def (B) for Informatica).
(C) sum (D) while Ans: Guido Van Rossum
Ans: (C) sum 2. Python was released in __________ and was
6. Which mode in Python allows the execution named after the BBC comedy series “Monty
of individual statements instantaneously? Python’s Flying Circus.”
(A) Script Mode Ans: 1991
(B) Batch Mode 3. Python supports both procedural and
(C) Interactive Mode __________ programming approaches.
(D) Compile Mode Ans: object-oriented
Ans: (C) Interactive Mode 4. Python programs are executed by an
__________, making it an interpreted
language.
Ans: interpreter

1
HAND BOOK
2

5. Python is case-sensitive, meaning that 2. What are Python keywords and give two
NUMBER and __________ are treated as examples?
distinct identifiers. Ans: Python keywords are predefined reserved words
Ans: number that have special meanings and are used to define
6. Python includes a rich __________ of the syntax and structure of the Python language.
predefined functions. Examples include if, else, while, for, def.
Ans: standard library
7. To write and run a Python program, you need Three Marks Questions
to have a Python __________ installed on 1. Describe the difference between Interactive
your computer. mode and Script mode in Python.
Ans: interpreter Ans: o Interactive mode: Allows execution of
8. The symbol __________ is the Python prompt, individual statements instantaneously at
which indicates that the interpreter is ready the Python prompt (>>>). It is useful for
to take instructions. testing and experimenting with short pieces
Ans: >>> of code.
9. Python scripts are saved as files where the file o Script mode: Involves writing Python
name has the extension __________. programs in a file with a .py extension.
Ans: .py The scripts can be saved and executed
10. In Python programming language, there are later, allowing for the development of more
a set of predefined words called __________ complex programs.
which cannot be used as the names of o Usage: Interactive mode is ideal for
variables, functions, and classes. quick tests, while script mode is used for
Ans: keywords developing complete programs.
11. The name of an identifier should begin with 2. List and explain three features of Python.
an uppercase (A-Z), lowercase alphabet (a-z), Ans: o High-Level Language: Python is easy
or an __________ sign. to read and write, abstracting low-level
Ans: underscore operations.
12. In Python, a comment starts with a _________. o Interpreted Language: Python code is
Ans: # executed line-by-line by an interpreter,
13. Each object in Python is given a unique which makes debugging easier.
__________ that remains constant for the o Portability: Python can run on various
object’s lifetime. platforms without modification, making it
Ans: identity (ID) highly versatile.
14. The __________ function returns the identity Five Marks Questions
of an object.
1. Explain the importance of comments in
Ans: id()
Python and how they are used. Provide an
15. In Python, every value or data item, whether example.
numeric, string, or another type, is treated as
an __________. Ans: o Importance: Comments are crucial for
making the code understandable to others
Ans: object and for reminding yourself of the code’s
Two Marks Questions purpose and functionality at a later date.
They help in documenting the logic,
1. Explain the concept of Python’s readability. input, output, and purpose of code blocks,
Ans: Python’s readability refers to its clearly defined especially in large projects with multiple
syntax and relatively simple structure, making it contributors.
easy to understand and maintain code. This helps
both in writing and reviewing code.
I PUC - Computer Science
3

o Usage: Comments are added using the # 2. Explain the any five features of Python
symbol in Python. Everything after the # 1. High-Level Language: Python is a high-
on that line is ignored by the interpreter. level programming language that is free
o Example: and open-source.
python 2. Interpreted Language: Python programs
Copy code are executed by an interpreter, making it an
interpreted language.
# This is a comment
3. Readability: Python programs are easy
# The following line assigns a to understand due to their clearly defined
value to a variable syntax and relatively simple structure.
amount = 1500 # Variable 4. Case Sensitivity: Python is case-sensitive,
amount is the total spending on meaning that `NUMBER` and `number`
books
are treated as distinct identifiers.
# Adding marks of three tests 5. Portability: Python is portable and
totalMarks = test1 + test2 + platform-independent, capable of running
test3 # totalMarks is the sum on various operating systems and hardware
of marks in all the tests platforms.
o Types of Comments: 6. Rich Standard Library: Python includes
o Single-Line Comments: Start with #. a rich library of predefined functions.
o Multi-Line Comments: Although Python 7. Web Development: Python is useful in
doesn’t have a specific syntax for multi- web development, with many popular web
line comments, they can be created using services and applications built using the
consecutive # symbols or by using triple- language.
quoted strings (“”” or ‘’’) which are often 8. Indentation: Python uses indentation to
used as docstrings. define blocks and nested blocks, ensuring a
o Documentation: Proper commenting is part clean and readable code structure.
of good programming practices, making 9. Easy to use: It is easy to learn and use
code easier to maintain and collaborate on.

You might also like