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

HCF=x
                        LCM=(num1*num2)/HCF
                        return LCM, HCF
                    num1 = int(input('Enter first number:  '))
                    num2 = int(input('Enter second number:  '))
                    LCM, HCF = computeHCF_LCM(num1,  num2)
                    print('The LCM of ',  num1,   ' and ',   num2,   ' is ',   LCM)
                    print('The HCF of ',  num1,   ' and ',   num2,   ' is ',   HCF)




                                                        Assessment


              A.  Multiple Choice questions.
                 1.  Which of the following will return a sequence of numbers within a specified range?
                    a.  range()              b. Range()             c. Sequence()         d. sequence()
                 2.  Which of the following options is the correct sequence that will be returned by the function range(-4, 8, 4)?
                    a.  [-4,   0,   4]       b. [4,    0,    -4]    c. [-4,   0,   4,   8]   d. [8,    4,   0,   -4]
                 3.  Which of the following options represents the correct sequence that will be returned by the function range(20,   15)?
                    a.  [20,  19,  18,  17,  16,  15]
                    b.  [20,  19,  18,  17,  16]
                    c.  []
                    d.  [15,  16,  17,  18,  19]

                 4.  What will be the output produced on the execution of the following code?
                    city = 'Chennai'
                    for c in city:
                        print(c.upper(),   end='#')
                    a.  CHENNAI#             b. C#h#e#n#n#a#i#      c. C#H#E#N#N#A#I#     d. Chenai#

                 5.  Which of the following statements is equivalent to range(5)?
                    a.  range(0, 5)          b. range(1, 5)         c. range(0, 5, 0)     d. range(1, 5, 1)

                 6.  How many numbers will the following loop print ?
                    for i in range(-3):
                        print(i)
                    a.  2                    b. 3                   c. 0                  d. Will result in an error

                 7.  What will be the value of num after the following code is executed?
                    for num in range(10,   5,   -2):
                        break
                    a.  -2                   b. 5                   c. 6                  d. 10

                 8.  Which of the following  is not a valid construct?
                    a.  while-else           b. if-else             c. def-else           d. for-else
                 9.  What will be the output produced on the execution of the following code?

                    value = 1
                    while value<=4:
                        value = 1
                    print(value)
                    a.  4                    b. 5                   c. 6                  d. No output


               320   Touchpad Computer Science (Ver. 2.0)-XI
   329   330   331   332   333   334   335   336   337   338   339