KnowledgeBoat Logo

Class - 12 CBSE Computer Science Important Output Questions 2025

  • Python Dictionaries

    Predict the output of the following code:

    d = {"apple": 15, "banana": 7, "cherry": 9} 
    str1 = "" 
    for key in d: 
        str1 = str1 + str(d[key]) + "@" + "\n"
    str2 = str1[:-1] 
    print(str2) 
    

  • Python List Manipulation

    Predict the output of the following code:

    line = [4, 9, 12, 6, 20] 
    for I in line: 
       for j in range(1, I%5): 
           print(j, '#', end="") 
       print() 
    
    View Answer

    11 Likes


  • Python Functions

    Find and write the output of the following python code :

    def Call(P = 40, Q = 20):
        P = P + Q
        Q = P - Q 
        print(P, '@', Q)
        return P
    R = 200
    S = 100
    R = Call(R, S)
    print(R, '@', S) 
    S = Call(S)
    print(R, '@', S)
    
    View Answer

    44 Likes


  • Python Functions

    What will be the output of following program ?

    num = 1
    def myfunc():
        return num
    print(num)
    print(myfunc())
    print(num)
    

  • Python Functions

    What will be the output of following program ?

    num = 1
    def myfunc():
        num = 10
        return num
    print(num)
    print(myfunc())
    print(num)
    
    View Answer

    13 Likes


  • Python Functions

    What will be the output of following program ?

    num = 1
    def myfunc():
        global num
        num = 10
        return num
    print(num)
    print(myfunc())
    print(num)
    

  • Python Functions

    What will be the output of following program ?

    def display():
        print("Hello", end='')
    display()
    print("there!")
    

  • Python Functions

    Predict the output of the following code :

    a = 10
    y = 5
    def myfunc(): 
        y = a
        a = 2
        print("y =", y, "a =", a) 
        print("a + y =", a + y) 
        return a + y
    print("y =", y, "a =", a)
    print(myfunc())  
    print("y =", y, "a =", a)
    
    View Answer

    15 Likes


  • Python Functions

    Find and write the output of the following python code :

    a = 10
    def call(): 
        global a
        a = 15
        b = 20
        print(a) 
    call()
    

  • Python Functions

    What is the output of following code fragments ?

    def increment(n):
        n.append([4])
        return n
    L = [1, 2, 3]
    M = increment(L)
    print(L, M)
    

Showing 41 - 50 of 98 Questions