MBOSE Class XI Informatics Practices · Chapter 3
Brief Overview of Python
Opening soonA quick tour of Python for data work: names and values, data types, operators, input and output, errors, decisions with `if` and repetition with `for` and `while`.
18 lessons · 66 practice questions
What this chapter covers
- Basics of Python programming
- Execution modes: interactive and script mode
- The structure of a program, indentation, identifiers, keywords, constants, variables, types of operators, precedence of operators, data types, mutable and immutable data types, statements, expression evaluation, comments, input and output statements, data type conversion, debugging
- Control statements:
if-else,if-elif-else,whileloop,forloop
Key terms
- Interpreter
Executes Python code line by line
- Identifier
Name of a variable, function etc.
- Keyword
Reserved word such as
iforwhile- Variable
Name that refers to a value
- Mutable / immutable
Can / cannot be changed after creation
- Operand, operator
Value acted on / symbol that acts
- Iteration
Repeating statements with a loop
- Syntax, logical, run-time error
Grammar mistake / wrong answer / failure while running
Important questions with answers
10 of the 66 questions on this chapter, solved.
Question 1 · Multiple choice · 1 mark
Python is a(n)
- (a) compiled language
- (b) interpreted language
- (c) machine language
- (d) assembly language
Answer: (b) interpreted language
An interpreter runs Python statements one by one.
Question 2 · Multiple choice · 1 mark
In Python, True + True equals
- (a) 1
- (b) 2
- (c) True
- (d) error
Answer: (b) 2
True behaves as 1.
Question 3 · Multiple choice · 1 mark
What is printed by print(int(7.9))?
- (a) 8
- (b) 7
- (c) 7.9
- (d) error
Answer: (b) 7
int()cuts off the fraction.Question 4 · Multiple choice · 1 mark
The end of the
if x > 5line must carry- (a) a semicolon
- (b) a bracket
- (c) a full stop
- (d) a colon
Answer: (d) a colon
A colon introduces the block.
Question 5 · Assertion and reason · 1 mark
Assertion (A): Python is case sensitive.
Reason (R):
Nameandnameare different identifiers.- (a) Both A and R are true, and R is the correct explanation of A.
- (b) Both A and R are true, but R is not the correct explanation of A.
- (c) A is true, but R is false.
- (d) A is false, but R is true.
Answer: (a) Both A and R are true, and R is the correct explanation of A.
R explains A.
Question 6 · Short answer · 1 mark
Name the function used to display output in Python.
Answer
print().Question 7 · Short answer · 2 marks
What is an identifier? State two rules for naming it.
Answer
A name for a variable, function etc. It must start with a letter or underscore and cannot be a keyword (no spaces or special symbols).
Question 8 · Short answer · 3 marks
Explain syntax error, logical error and run-time error with an example of each.
Answer
Syntax:
print("Hi"(missing bracket). Logical:avg = a + b / 2for an average. Run-time:10 / 0. (1 each)Question 9 · Long answer · 5 marks
Explain the features of Python and the two modes of working.
Answer
Section 1.1.
Question 10 · Long answer · 5 marks
Explain all operators of Python with examples and the order of precedence.
Answer
Section 1.4.
Study the whole chapter
18 step-by-step lessons, all 66 practice questions with hints, flashcards and mock tests for MBOSE Class XI Informatics Practices.