Skip to content

Federal (FBISE) · Chapter test · Free

2nd Year Computer Chapter 3 Test3. Programming Fundamentals

30 marks · 40 minutes · 21 questions. Covers: 3. Programming Fundamentals.

Your school name

2nd Year Computer Chapter 3 Test

2nd Year · Computer · Federal (FBISE)

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

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

  1. Python’s built-in framework for testing code automatically is:
    1. Pytest
    2. unittest
    3. debugpy
    4. testlib
  2. Main purpose of the programming paradigm is _______.
    1. Increase code length
    2. Complexity reduction
    3. Eliminate bugs
    4. Improve hardware performance
  3. Functional programming supports:
    1. Sequential processing
    2. Parallel and concurrent programming
    3. Random execution
    4. None
  4. The try-except block is used for:
    1. File creation
    2. Error handling
    3. Data sorting
    4. Data merging
  5. The term “programming paradigm” refers to:
    1. Coding language
    2. Compilation method
    3. Process for creating and organizing code
    4. Program output
  6. Which function is used to close a file in Python?
    1. end()
    2. stop()
    3. close()
    4. quit()
  7. Watchpoints are used to:
    1. Mark breakpoints
    2. Track changes in variables
    3. Print matrix
    4. Pause loops
  8. Which data type is used to avoid duplicate keys?
    1. List
    2. Tuple
    3. Dictionary
    4. String
  9. In Python list, elements are stored in:
    1. Random order
    2. Sequential order
    3. Reverse order
    4. Tree form
  10. Inheritance allows creation of:
    1. New subclasses from existing classes
    2. Arrays from loops
    3. Methods from attributes
    4. Programs from functions

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

  1. What does the inner loop perform in the matrix transpose example?
  2. What is the role of the assert statement in a test function?
  3. What is a binary file?
  4. What is the importance of Disk I/O?
  5. What is meant by file handling?
  6. Define Primary Key.
  7. What is the purpose of the count() method in tuples?
  8. What types of objects can be dictionary keys?

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

  1. Write a Python program highlighting the use of functions to simplify a problem.For example, create a program that calculates the average of a list of numbers and by using separate functions to add and without repeating values.
  2. Create a Python dictionary to store student names as keys and their grades as values.Write a program to add new students, update existing students’ grades, and remove students from the dictionary.
  3. What is Data Normalization in databases? Describe 1NF, 2NF, and 3NF in detail along with suitable examples,