Punjab School Education Board

Class 11 Computer Science (2025-26)

Dear students. In this article, you can practice of all the lessons of computer science of Class 11. You can note the exercise of these lessons by clicking on the links of the relevant lessons given below.

    Subject:- Computer Science

    Class: 11th

    Lesson: 1 Number System

    Exercise

    A. Multiple Choice Questions:

    1. Which of the following numbers is the smallest in the hexadecimal system?

    a) 0        b) 1        c) A        d) F

    2. What is the binary number of the decimal number 15?

    a) 0111                b) 1111               c) 0101                d) 0011

    3. Which number system is most widely used in everyday mathematics?

    a) Binary             b) Decimal        c) Hexadecimal              d) Octal

    4. What is the base/radix of the hexadecimal number system?

    a) 2        b) 5        c) 8        d) 16

    5. (38CB)16, which number system is an example of?

    a) Binary             b) Decimal         c) Hexadecimal             d) Octal

    a. Select True or False from the following:

    1. The binary number 1111 represents the decimal number 15. True ✔️

    2. The hexadecimal system uses 2 as its base/radix. False

    3. The word octal comes from the Latin word Oct which means 8. True ✔️

    4. The binary number system can represent any number using only the digits 0 and 1. True ✔️

    5. The digit '9' is a valid digit in the octal number system. False

    6. In the hexadecimal system, the letter 'B' represents 12 in the decimal number system. False

    7. The Roman numeral system is an example of a positional number system. False

    c. Short Answer Questions:

    Question:1. What is a number system? Write the names of the basic categories of number systems?

    Answer: A number system is a way in which numbers are represented. It uses different digits that help in calculations and management of numbers.

    Basic categories of number systems:

    1. Binary System – Base 2

    2. Decimal System – Base 10

    3. Hexadecimal System – Base 16

    4. Octal System – Base 8

    Question:2. Explain decimal number system?

    Answer: Decimal Number System:- Decimal number system is a positional number system whose base is 10. The digits from 0 to 9 are used in this system. It is the most widely used number system, which we recognize as numbers in daily life.

    Example: 

    3  2  1  0

    👇👇👇

    1  2  3  4

    It can be written as 1 × 10³ + 2 × 10² + 3 × 10¹ + 4 × 10⁰ in decimal system.

    Key Features:

    • Base 10

    • 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

    • Positional system – The position of each digit affects its value.

    Question:3. What is binary number system? Who is the inventor of this number system?

    Answer: Binary Number System:- Binary number system is a positional number system whose base is 2. Only two digits 0 and 1 are used in this system. Binary system is also called digital system, as it is used for information communication and storage in computers and digital circuits.

    Example: 1011 (Binary Number)

    This is equivalent to 11 in decimal, and can be written as 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰.

    Inventor: The binary number system was invented by Gottfried Wilhelm Leibniz. He described the properties of this system in 1679 and used this number system to establish the basic concepts of mathematics and logic.

    Question:4. Explain the octal number system?

    Answer: Octal Number System:- The octal number system is a positional number system whose base is 8. The digits from 0 to 7 are used in this system. Octal number system is used to convert from binary easily because 3 binary bits (digits) can be converted into one octal digit.

    Example: 27 (octal number)

    This is equivalent to 2 × 8¹ + 7 × 8⁰ = 16 + 7 = 23 in decimal.

    Key features:

    • Base 8

    • 8 digits (0, 1, 2, 3, 4, 5, 6, 7)

    • Positional system – The position of each digit affects its value.

    • Connection between binary and octal – It is very easy to convert binary to octal, because 3 binary bits make up one octal digit.

    Question:5. What is hexadecimal number system?

    Answer: Hexadecimal Number System:- The hexadecimal number system is a positional number system with base 16. This system consists of 16 digits:

    The numbers 0 to 9 and the letters A to F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

    The hexadecimal number system is widely used, especially in computer science and digital electronics, because it is related to the binary system and represents binary numbers in a short and easy way.

    Example: 1A3 (hexadecimal number)

    This is equivalent to 1 × 16² + A × 16¹ + 3 × 16⁰ = 1 × 256 + 10 × 16 + 3 × 1 = 256 + 160 + 3 = 419 in decimal.

    Key Features:

    • Base 16

    • 16 digits (0-9 and A-F)

    • Positional system – The position of each digit affects its value.

    • Relationship between binary and hexadecimal – A hexadecimal digit can be represented by 4 binary bits.

    Q. Complete the number system conversion:

    1. (25)₁₀ = ( )₂ = ( )₈ = ( )₁₆

    Answer: (25)₁₀ = (11001)₂ = (31)₈ = (19)₁₆

    2. (10111)₂ = ( )₁₀ = ( )₈ = ( )₁₆

    Answer: (10111)₂ = (23)₁₀ = (27)₈ = (17)₁₆

    3. (47)₈ = ( )₁₀ = ( )₂ = ( )₁₆

    Answer: (47)₈ = (39)₁₀ = (100111)₂ = (27)₁₆

    4. (A4)₁₆ = ( )₁₀ = ( )₂ = ( )₈

    Answer: (A4)₁₆ = (164)₁₀ = (10100100)₂ = (244)₈


    Lesson : 2 Introduction to Python

    Exercise

    A. Multiple Choice Questions.

    1. ____ is a default editor that comes with Python.

    A. IDLE               B. IPLE                 C. Text Editor     D. Notepad

    2. ____ is the shell prompt where we type our commands.

    A. <<                    B. >>                    C. >>>                  D. <<<

    3. The full name of IDE is _______

    A. Integrated Direct Environment                          B. Integrated Development Environment

    C. Information Development Environment    D. None of these

    4. To run script file code in Python, we can use_________ shortcut keys.

    A. FI                      B. F2                    C. F5                    D. F7

    5. _____ are like words and punctuation marks in English language.

    A. Literals         B. Identifiers     C. Variables       D. Tokens

    6. ____ are names given to program elements (such as: variables, functions, lists, tuples, etc.) to identify them.

    A. Literals           B. Identifiers    C. Variables       D. Tokens

    7. Literals are _____ values ​​used in source code.

    A. Constants   B. Boolean         C. String             D. Float

    8. They are identifiers that are used to store values ​​and we can also change their value during run time.

    A. Constants     B. Variables      C. Lists                D. Tokens

    9. A comment is basically a text that describes the program code.

    A. Execution      B. Compilation                C. Explanation                              D. About the above

    10. We can display program data on the console in Python with the _____ function.

    A. input()            B. print()                            C. output()                        D. show()

    B. Short Answer Questions:

    Question:1. What do you know about Python?

    Answer: Python is a high-level programming language that is simple and easy to read. It is interpreter-based and supports object-oriented programming. Python has many built-in libraries that are used in areas such as web development, data science, and machine learning. Its wide use and simple syntax make it ideal for learning a new language.

    Question:2. What is an IDE?

    Answer: An IDE (Integrated Development Environment) is a software that provides convenience for programming. It includes a source code editor, compiler/interpreter, debugger, and build tools. The main purpose of an IDE is to make the process of writing, testing, and debugging code simple and fast. Some popular IDEs are PyCharm, Eclipse and Visual Studio.

    Question:3. How can you view the list of keywords using Python cell? Write some examples of keywords.

    Answer: You can view the list of keywords using the keyword module in Python cell. For this, import keyword and print(keyword.kwlist) command are used. Python keywords like if, else, while, def, class, and True are used in a special way and have special meaning in Python language.

    Some examples: If, else, while, for, def, class, try, return, import, True, False, None

    Question:4. How will you declare variables in Python? Give examples.

    Answer: In Python, no special keyword is required to declare variables, you just give the variable a name and assign it a value.

    Examples:

    x = 10                                  # Integer type variable

    name = "John"                 # String type variable

    is_active = True               # Boolean type variable

    height = 5.9                      # Float type variable

    Here, x is assigned to 10, name to "John", is_active to True, and height to 5.9. Variables in Python can be used in this way wherever needed.

    Question:5. Why is the print() function used in Python programs?

    Answer: The print() function is used in Python programs to display data on the console or screen. Its main purpose is to show the result of any input or calculation to the user.

    Example:

    name = "John"

    print("Hello, " + name) # Output: Hello, John

    Here, the print() function displays "Hello, John" on the console. With this, the developer or user can easily see the result of the code.

    C. Long Answer Questions:

    Question:1. Define tokens? Describe the different tokens used in Python.

    Answer: Tokens are the main components in Python that are used to read, analyze and create code. They are implemented to understand and transform Python's code internally. Each token represents a specific syntax group.

    Different tokens used in Python:

    1. Keywords: These are words that have a specific meaning in the Python language and are used specifically in the program. Such as if, else, while, def.

    2. Identifiers: These are the names of variables, functions or classes in the code. For example, name, age, total_sum.

    3. Literals: These are the values ​​that are given in the code as constants. For example, 5 (integer), "Hello" (string), True (boolean).

    4. Operators: These tokens are used to perform calculations or organization. For example, + (addition), - (subtraction), * (multiplication), / (division).

    5. Delimiters: These tokens are used to establish the structure and composition of the code. For example, () (parenthesis), [] (bracket), {} (colon), , (comma), ; (serial).

    6. Comments: These are tokens in the program that are not involved in any program operation, but are used to provide additional information. In Python, a comment begins with #.

    These tokens are fundamental to writing, reading and understanding Python code.

    Question: 2. What are Identifiers? Write their different naming rules.

    Answer: Identifiers are names that are used to identify objects, functions, variables, classes, modules and other elements used in code. They represent any type of data in Python. Identifiers are specifically used in Python programming, such as variable names, function names, class names etc.

    Naming Rules for Identifiers:

    1. Identifiers must start with:

    ·        An identifier can only start with a letter or an underscore (_).

    ·        It cannot start with a digit (Example: 123abc is incorrect).

    2. Each identifier can contain only letters, numbers and underscores:

    ·        Letters (in English), numbers and underscores (_) can be used in identifiers.

    ·        However, identifiers cannot contain some special characters (like @, #, $).

    3. Keywords cannot be used as identifiers in Python:

    ·        Like if, else, while, return etc.

    4. Case Sensitivity in identifiers:

    ·        Python identifiers are case-sensitive, i.e. name and Name are different.

    5. There is no limit to length:

    ·        Identifiers can be made of any length, but for its ease of reading and understanding, short and descriptive identifiers should be used.

    Example:

    age = 25                             # Valid identifier

    first_name = "John"       # Valid identifier

    total_sum = 100              # Valid identifier

    123abc = 10                     # Invalid identifier (starts with a number)

    if = 5                                    # Invalid identifier (reserved keyword)

    Thus, properly naming identifiers makes the code better, readable and easier to understand.

    Question:3. What are literals? Create a chart showing the different types of literals used in Python.

    Answer: Literals are values ​​that are passed directly into Python code. They are actual values ​​that are used to process a command and act directly in place of a variable or function. Literals mean constant values ​​that are used directly as part of the code.

    Different types of literals used in Python:

    Literal Type

    Example

    Description

    Integer Literal

    10, -50, 0

    These are simple positive or negative numbers.

    Float Literal

    3.14, -0.001, 2.0

    These are decimal numbers with digits.

    String Literal

    "Hello", 'Python'

    These are words or sentences written with quotation marks.

    Boolean Literal

    True, False

    These can only hold two values, True or False.

    None Literal

    None

    These represent the absence of any variable or value.

    Example:

    age = 25 # Integer literal

    pi = 3.14 # Float literal

    name = "John" # String literal

    is_active = True # Boolean literal

    data = None # None literal

    These literals represent actual values ​​in Python that are directly given in the code.

    Question:4. What are Comments? Write different ways to write comments in Python.

    Answer: Comments are texts that are added to the program code to enhance the reader's understanding or to temporarily ignore a part. Comments are not part of the execution of the program and are only there to help the code reader. Writing comments in Python makes our code easier to analyze and document.

    Ways to write comments in Python:

    1. Single-line comment:

    The # symbol is used to write a single comment in Python. All text written after this is a comment and is not understood by the program.

    Example:

    # This is a single comment

    age = 25 # This line is also a comment

    2. Multi-line comment:

    To write a multi-line comment, text is written with ''' or """ . It does not directly close the code, but is used to comment on multiple lines.

    Example:

    '''

    This is a multi-line comment

    where we can give more information in multiple lines.

    '''

    or

    """

    This is another multi-line comment

    where we can write any special information.

    """

    Benefits of comments:

    • Comments help in understanding the code.

    • They are helpful in documenting parts of the program.

    • They are used to temporarily unread or debug the code at some point.


    Lesson 3 Data Types, Operators and Expressions in Python

    Excercise

    Multiple Choice Questions:

    1. Which of the following program elements stores values ​​in memory?

    a) Variables b) Comments c) Operators d) All of the above

    2. Which of the following is not a standard numeric data type in Python?

    a) Integer b) Floating c) Boolean d) Complex

    3. Which of the following types represents a mapping type in Python?

    a) List b) Dictionary c) Tuple d) Set

    4. In Python? - The keyword is used to indicate a null value or no value

    a) Nothing  b) Null) c) Zero  d) None

    5. In Python, functions are used to indicate True/False values.

    a) bool b) Boolean c) Boolean d) None

    6. To create a list in Python, we write data items in.

    a) Parenthesis b) Curly Brackets            c) Square Brackets d) Angular Brackets

    7. In Python, ____ is used to indicate Unicode values.

    a) String             b) Tuple               c) List   d) Set

    8. Types are types whose values ​​can be changed even after they are created.

    a) Mutable b) Immutable c) None d) Mapping

    9. Which of the following is not an arithmetic operator in Python?

    a)/          b) //       c)**       d) ++

    10. Which of the following functions is used for type conversion?

    a)int()    b) float()              c) str()                  d) All of the above

    1. Write True or False for the following statements.

    1. The symbol % represents the modulus operator which is used to get the remainder after dividing two numbers. True

    2. Relational operators return True or False after comparison. True

    3. Operators are special symbols which are used to perform simple operations on operands. True

    4. An ordered collection of values ​​separated by commas in square brackets is called a set. False

    5. Sequence is an ordered collection of data items of the same or different types. True

    3. Short Answer Questions:

    Question 1. What are floating point numbers? Give examples.

    Answer:- Floating point numbers are numbers that have a decimal point. These numbers represent real values ​​such as measurements, divisions, etc. The float type is known as float in Python. Examples include 3.14, 0.5, -7.25, etc.

    Question 2. What do you know about Python's Boolean data type?

    Answer:- Boolean data type represents only two values ​​True and False in Python. This type is used in logical or comparative tests. Boolean values ​​are obtained through the bool keyword. This is very important for testing conditions or situations.

    Question 3. What are Sequence data types in Python? Write their names.

    Answer:- Sequence data types are those that store data in a sequential manner. In these, data is accessed through index. The major sequence types in Python are: string, list, tuple, and range. They are used in loops, indexing, and slicing.

    Question 4. Explain operands with suitable examples.

    Answer:- Operands are the elements or values ​​on which operators work. For example, 5 + 3 has 5 and 3 operands and + is the operator. They are used in expressions. Operands can be variables, numbers, or strings.

    Question 5. What are arithmetic operators? Give examples.

    Answer:- Arithmetic operators are symbols used for mathematical calculations. The main arithmetic operators in Python are: + (addition), - (subtraction), * (multiplication), / (division), % (remainder), ** (exponential), and // (floor division). They are used on numbers.

    Question 6. What is an Expression?

    Answer:- An expression is a combination that produces a value or result. It can include operands, operators, and variables. For example, a + b * 2 is an expression. Every expression in Python has some output.

    4. Long Answer Questions:

    Question 1. What do you mean by Data Types? Draw a chart showing the common standard data types used in Python.

    Answer:- Data types are categories that represent the type of any variable or value. They determine what kind of data is being stored and what operations can be performed on it. There are many types of data types used in Python which are shown in the chart below:

    Class                  Data Types

    Numeric             int, float, complex

    Sequence          str, list, tuple, range

    Mapping             dict

    Set                        set, frozenset

    Boolean              bool

    Binary                  bytes, bytearray, memoryview

    Null Type            NoneType

    A proper understanding of these data types is very important in writing and running Python code.

    Question 2. What is the difference between Mutable and Immutable types?

    Answer:- Mutable data types are those which can be changed, i.e., their internal values ​​can be modified even after being created. For example, list, dict, and set are mutable. Like adding or removing a new item from a list can be done easily.

    On the other hand, immutable data types are those which cannot be changed once created. Like int, float, str, tuple etc. If you try to change their value, a new variable is created. They are generally used to store static data. This difference is very important to remember while writing programs.

    Question 3. What are operators? Describe any two types of operators used in Python.

    Answer:- Operators are special symbols or groups of symbols that are used to perform some operation on variables or values. There are many types of operators in Python such as arithmetic, assignment, logical, comparison, bitwise etc.

    For example, arithmetic operators +, -, *, / etc. are used to perform mathematical operations on numbers. For example a + b adds.

    On the other hand, comparison operators such as ==, !=, >, <, >=, <= compare any two values ​​and return True or False values. These operators are used to make conditions or decisions in programs.