Skip to content

Punjab (PTB) · Chapter test · Free

10th Class Computer Chapter 4 TestUNIT 04: CONTROL STRUCTURES IN PYTHON

30 marks · 40 minutes · 21 questions. Covers: UNIT 04: CONTROL STRUCTURES IN PYTHON.

Your school name

10th Class Computer Chapter 4 Test

10th Class · Computer · Punjab (PTB)

Name: ____________Roll No: ________Class/Section: ________Date: ________Total marks: 30Time: 40 minutes

Q1. Multiple choice questions (Attempt all · 10 × 1 = 10)

  1. Items inside a Python list are separated from each other using which punctuation?

    1. Semicolon(;)

    2. Colon(:)

    3. Commas(,)

    4. Dot(.)

  2. What does the function random.randint(1, 10) do?

    1. Generates a floating-point number between 1 and 10

    2. Generates a random integer between 1 and 10 inclusive

    3. Adds 1 and 10 together

    4. Finds the maximum value

  3. PDB is a:

    1. Python Translator

    2. Python Module

    3. Python Debugger

    4. None of them

  4. if statement within an if statement:

    1. Multiple if

    2. if-elif-else

    3. if-else

    4. Nested if

  5. Which built-in Python function is used to generate a sequence of numbers, often used with for loops?

    1. print( )

    2. input( )

    3. range( )

    4. loop( )

  6. Output of the following code: for i in range(3): print(i)

    1. 0 1 2 3

    2. 0 1 2

    3. 1 2 3

    4. 3 2 1 0

  7. What is the purpose of the range( ) function?

    1. To create a list of numbers

    2. To generate a sequence of numbers

    3. To calculate the range of values

    4. To sort numbers

  8. Control Structure is essential because:

    1. Help us to manage Decision Making

    2. Help us to manage Repetition task

    3. Help us to manage complex programs

    4. All

  9. List can contain:

    1. Same items

    2. Single items

    3. Different items

    4. None of them

  10. Which function is used to arrange items in a specific order?

    1. append( )

    2. remove( )

    3. sort( )

    4. reverse( )

Q2. Short questions (Attempt any 6 of 8 · 6 × 2 = 12)

  1. What is the purpose of regression testing?

  2. What is the purpose of the end parameter in print( )?

  3. What are control structures? Name their main types.

  4. Can a Python list contain items of different data types? Give an example.

  5. Define a loop and the named types of loops used in Python.

  6. Define a list in Python and write its basic syntax.

  7. How can we access an element from the list?

  8. Define testing in Python programming and named its types.

Q3. Long questions (Attempt any 2 of 3 · 2 × 4 = 8)

  1. Write down the syntax to import the random library and generate a random number between 1 and 10.

  2. What is control structure? Explain its importance.

  3. How do Python libraries enhance programming efficiency? Provide an example.