Page 264 - Computer Science V2.0 Class 11
P. 264

Q = 20
                        P = myfunc(Q)
                        print(P, "###", Q)
                        Q = myfunc()
                        print(P, "###", Q)
                 5.  What will be the output produced on the execution of the following code?
                    import math
                    number = 57
                    while number >= 10:
                        localNumber = number // 10
                        if localNumber % 2 == 0:
                            break
                        else:
                            print(math.factorial(localNumber))
                        number = number - 5
                 6.  What will be the output produced on the execution of the following code?
                    import math
                    x = divmod(42, 4)
                    y = int(math.fmod(10, 3))
                    z = x + (y,)
                    print(z)
                 7.  In each of the following cases, give a function call/ expression that will yield the desired output:
                    a.  An even random integer from the first 500 natural numbers.
                    b.  A randomly chosen multiple of five from the first 500 natural numbers.
                    c.  Value of pi upto 4 decimal places.
                    d.  log (100)
                         2
                    e.  log (1000)
                         10
                    f.  log (1000)
                         e
                    g.  Sine of an angle having degree 90.
                    h.  Cosine of an angle having degree 90.
                    i.  Greatest common divisors of 20 and 34.
                    j.  Mean age of five children having ages 50, 54, 60, 61, and 65 cm .
                    k.  Factorial of the number 10.
                 8.  Write a function call that would randomly generate 0 or 1. Write a Python script that makes use of the function call 20
                    times. How many times do you get 0? Repeat the experiment 10 times. Do you get the same result every time? Interpret
                    the result.
                 9.  For each of the following patterns, write a function that accepts a parameter nRows - the number of rows in the pattern
                    and prints the pattern.












                             Half Pyramid                      Inverted                     Hollow Inverted
                                                             Half Pyramid                    Half Pyramid

               250   Touchpad Computer Science (Ver. 2.0)-XI
   259   260   261   262   263   264   265   266   267   268   269