2019 CBSE Class 12 Computer Science Question Paper with Detailed Solutions

 

This is the Class 12 CBSE Final Term Computer Science Question Bank. The students’ challenges are met through a set of questions and answers that cut across all topics. The questions are divided into sections including multiple choice, very short answer, short answer and long answer questions so as to enhance the revision. Detailed answers are interspersed in any patient section that can be disclosed. Use this question bank for revising the concepts, practicing important questions or preparing for the final examination.

Note: These questions are based on the latest syllabus updates and include previous year questions for reference. Ensure to review the solved examples provided to grasp complex topics with ease.

  1. Question: Write the names of any four data types available in Python.
    SHOW ANSWER
    Answer:
    • Integer
    • Float
    • String
    • Boolean
  2. Question: Name the Python Library modules which need to be imported to invoke the following functions:
    • (i) sqrt()
    • (ii) start() (This might refer to another function)
    SHOW ANSWER

    Answer:

    • import math for sqrt()
    • Note: There is no start() function in the standard library. It may refer to another function.
  3. Question: Rewrite the following code in Python after removing all syntax errors:
    
    250 = Number
    WHILE Number <= 1000: if Number => 750:
            print Number
            Number = Number + 100
        else:
            print Number * 2
            Number = Number + 50
            
    SHOW ANSWER

    Corrected code:

    
    Number = 250
    while Number <= 1000: if Number >= 750:
            print(Number)
            Number += 100
        else:
            print(Number * 2)
            Number += 50
            
  4. Question: Find and write the output of the following Python code:
    
    Msg1 = "WeLcOME"
    Msg2 = "GUeSTs"
    Msg3 = ""
    for I in range(0, len(Msg2) + 1):
        if Msg1[I] >= "A" and Msg1[I] <= "M": Msg3 = Msg3 + Msg1[I] elif Msg1[I] >= "N" and Msg1[I] <= "Z":
            Msg3 = Msg3 + Msg2[I]
        else:
            Msg3 = Msg3 + "*"
    print(Msg3)
            
    SHOW ANSWER

    Output:

    WeL**ME*
  5. Question: Write four features of object-oriented programming.
    SHOW ANSWER
    • Encapsulation
    • Inheritance
    • Polymorphism
    • Abstraction
  6. Question: Write the output of the following Python code:
    
    class Box:
        L = 10
        Type = "HARD"
        
        def __init__(self, T, TL=30):
            self.Type = T
            self.L = TL
            
        def Disp(self):
            print(self.Type, Box.Type)
            print(self.L, Box.L)
    
    B1 = Box("SOFT", 20)
    B1.Disp()
    
    Box.Type = "FLEXI"
    B2 = Box("HARD")
    B2.Disp()
            
    SHOW ANSWER

    Output:

    SOFT HARD
    20 10
    HARD FLEXI
    30 10
    
  7. OR: Write the output of the following Python code:
    
    class Target:
        def __init__(self):
            self.X = 20
            self.Y = 24
            
        def Disp(self):
            print(self.X, self.Y)
            
        def __del__(self):
            print("Target Moved")
            
    def One():
        T = Target()
        T.Disp()
        
    One()
            
    SHOW ANSWER

    Output:

    20 24
    Target Moved
    
  8. Question: Define a class HOUSE in Python with the following specifications:
    • Instance Attributes: Hno, Nor, Type
    • Methods/Functions:
      • AssignType(): Assigns house type based on Nor
      • Enter(): Allows user input for Hno and Nor
      • Display(): Displays the house details
    SHOW ANSWER
    
    class HOUSE:
        def __init__(self):
            self.Hno = None
            self.Nor = None
            self.Type = None
    
        def AssignType(self):
            if self.Nor <= 2:
                self.Type = "LIG"
            elif self.Nor == 3:
                self.Type = "MIG"
            else:
                self.Type = "HIG"
    
        def Enter(self):
            self.Hno = int(input("Enter House Number: "))
            self.Nor = int(input("Enter Number of Rooms: "))
            self.AssignType()
    
        def Display(self):
            print(f"House No: {self.Hno}, Rooms: {self.Nor}, Type: {self.Type}")
            
  9. Question: Show the first, second, and third pass of selection sort for the list:
    106, 104, 106, 102, 105, 10
    SHOW ANSWER

    Answer:

    • 1st Pass: [10, 104, 106, 102, 105, 106]
    • 2nd Pass: [10, 102, 106, 104, 105, 106]
    • 3rd Pass: [10, 102, 104, 106, 105, 106]
  10. OR: Show the first, second, and third pass of bubble sort for the list:
    106, 104, 106, 102, 105, 107
    SHOW ANSWER

    Answer:

    • 1st Pass: [106, 106, 104, 105, 102, 107]
    • 2nd Pass: [106, 106, 105, 104, 102, 107]
    • 3rd Pass: [106, 106, 105, 104, 107, 102]
  11. Question: Write a Python function to count how many times the value Val is present in the list ID.
    
    ID = [115, 122, 137, 110, 122, 113]
    Val = 122
            
    SHOW ANSWER

    Answer:

    
    def HowMany(ID, Val):
        count = ID.count(Val)
        print(f"{Val} found {count} times")
    
    ID = [115, 122, 137, 110, 122, 113]
    Val = 122
    HowMany(ID, Val)
            
  12. OR: Write Python methods for queue operations QueueUp() to add a client and QueueDel() to delete a client.
    SHOW ANSWER
    
    def QueueUp(queue, client):
        queue.append(client)
    
    def QueueDel(queue):
        if queue:
            return queue.pop(0)
        else:
            return "Queue is empty"
    
    queue = []
    QueueUp(queue, "Client1")
    QueueUp(queue, "Client2")
    QueueDel(queue)
            
  13. Question: Write the SQL queries to:
    • (i) Display details of all Trains which Start from New Delhi.
    • (ii) Display the PNR, PNAME, GENDER, and AGE of all Passengers whose AGE is below 50.
    SHOW ANSWER

    Answers:

    (i) SELECT * FROM TRAINS WHERE START = 'New Delhi';

    (ii) SELECT PNR, PNAME, GENDER, AGE FROM PASSENGERS WHERE AGE < 50;

Disclaimer

The question bank provided on this website is meant to be a supplementary resource for final term exam preparation. While we strive to offer accurate and relevant content, students should not rely solely on these answers. It is essential to conduct further research and consult teachers, school authorities, or subject experts to ensure thorough understanding and preparation. The solutions here are based on general interpretations and may not reflect the exact responses expected by examination boards. We are not responsible for any discrepancies or outcomes in exams resulting from the use of this material. By using this resource, you acknowledge that your academic success depends on comprehensive preparation, including active engagement with school materials and guidance from educators.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More