Core9X
Log inSign up

MBOSE Class XII Computer Science · Chapter 1

Python Revision Tour (Class XI Topics)

Opening soon

A quick refresher of the Python basics from last year, including data types, operators, loops, strings, lists, tuples and dictionaries.

18 lessons · 56 practice questions · unit "Computational Thinking and Programming" carries 40 marks

See classes open nowLog inMBOSE Class XII opens to new students soon.

What this chapter covers

  • Tokens
  • Data types
  • Mutable and immutable types
  • Operators and precedence
  • Expressions and type conversion
  • Input/output and print()
  • If, for, while, range()
  • Break, continue and loop else
  • Strings and slicing
  • Lists and list methods
  • Tuples
  • Dictionaries

Key terms

Token

Smallest unit of a program

Identifier

Name given to a variable, function or other object

Mutable

Can be changed in place (list, dictionary)

Immutable

Cannot be changed in place (number, string, tuple)

Type casting

Explicit conversion of one type into another

Precedence

Order in which operators are evaluated

Slice

Part of a sequence taken with [start:stop:step]

break

Ends a loop at once

continue

Skips to the next iteration

Dictionary

Collection of key : value pairs

Important questions with answers

10 of the 56 questions on this chapter, solved.

  1. Question 1 · Multiple choice · 1 mark

    Which of the following is a valid identifier?

    • (a) roll_no
    • (b) 2marks
    • (c) my name
    • (d) for

    Answer: (a) roll_no

    Identifiers cannot start with a digit, contain spaces or be keywords.

  2. Question 2 · Multiple choice · 1 mark

    The input() function always returns a value of type

    • (a) int
    • (b) float
    • (c) bool
    • (d) str

    Answer: (d) str

    Numbers must be converted with int() or float().

  3. Question 3 · Multiple choice · 1 mark

    What is the output of for i in range(3): print(i, end='')?

    • (a) 012
    • (b) 123
    • (c) 0123
    • (d) 0 1 2

    Answer: (a) 012

    end='' prints nothing between values.

  4. Question 4 · Multiple choice · 1 mark

    After L = [1, 2] and L.append([3, 4]), what is len(L)?

    • (a) 3
    • (b) 4
    • (c) 2
    • (d) an error

    Answer: (a) 3

    The list [3, 4] is added as one element.

  5. Question 5 · Assertion and reason · 1 mark

    Assertion (A): 2**2**3 evaluates to 256.

    Reason (R): The ** operator is evaluated from right to left.

    • (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.

    2**(2**3) = 2⁸.

  6. Question 6 · Short answer · 2 marks

    Distinguish mutable and immutable objects.

    Answer

    Mutable objects (list, dictionary) can be changed in place; immutable ones (int, str, tuple) cannot.

  7. Question 7 · Short answer · 2 marks

    What does "a b c".split() return?

    Answer

    The list ['a', 'b', 'c'].

  8. Question 8 · Short answer · 3 marks

    What is the output of for i in range(1, 4): print("*" * i)?

    Answer

    Three lines: *, **, ***.

  9. Question 9 · Long answer · 5 marks

    Explain any five list methods with examples.

    Answer

    Section 1.7; Section 8.2 (HSSLC 2023, Q3(e)).

  10. Question 10 · Long answer · 5 marks

    Explain break, continue and the loop else with examples.

    Answer

    Section 1.5; Section 8.2 (HSSLC 2024, Q3(a)).

Study the whole chapter

18 step-by-step lessons, all 56 practice questions with hints, flashcards and mock tests for MBOSE Class XII Computer Science.

See classes open nowLog inMBOSE Class XII opens to new students soon.