Page 96 - modular4.0
P. 96

Chapter Profile
                         SOME MORE PROGRAMS


                  Program 5: To subtract two numbers entered by the user


                      Program5.py
                   File  Edit  Format   Run    Options   Window    Help

                   #Program to compute the difference between two numbers entered by the user
                   a = int (input ("Enter the first number: " ))
                   b = int (input ("Enter the second number: " ))
                   sub = a - b
                   print ("Difference of two numbers is :" , sub)




                  Program 6: To calculate the average marks of three subjects

                      Program6.py
                   File  Edit  Format    Run   Options   Window    Help

                   #Program to calculate the average marks of three subjects                                                                Exercise
                   sub1 = int (input ("Enter the marks of first subject: " ))
                   sub2 = int (input ("Enter the marks of second subject: " ))                                                              A.   Tick ( ) the correct option.
                   sub3 = int (input ("Enter the marks of third subject: " ))
                                                                                                                                                 1.  What is the only language that can be understood by computers?
                   avg= (subl + sub2 + sub3)/3
                                                                                                                                                     a.  High-level Language                         b.  Assembly Language
                   print ("Average of marks is :" , avg)
                                                                                                                                                     c.  Machine Language                            d.  Natural Language
                                                                                                                                                 2.   Assembly  Language  consists of  program codes  in  the form of  alphanumeric  symbols  called
                  Program 7: To calculate the volume and surface area of cylinder                                                                               .
                                                                                                                                                     a.  Bits                                        b.  Mnemonics
                      Program7.py

                   File  Edit  Format    Run   Options   Window    Help                                                                              c.  Symbolic form                               d.  High level form
                                                                                                                                                 3.  Which of the following is not a third generation language?
                   #Program to calculate the volume and surface area of cylinder
                   pi = 22/7                                                                                                                         a.  SQL                                         b.  C++
                   radius = float (input ("Enter the radius of the cylinder: " ))
                                                                                                                                                     c.  Java                                        d.  C#
                   height = float (input ("Enter the height of the cylinder: " ))
                   volume = pi * radius * radius * height                                                                                        4.  Which program converts the source program into machine language line by line?
                   total_surface_area= ((2 * pi * radius) * (radius + height))
                                                                                                                                                     a.  Assembler                                   b.  Compiler
                   print ("The volume of the cylinder is:" , volume)
                   print ("Surface area is :", total_surface_area)                                                                                   c.  Interpreter                                 d.  All of these
                                                                                                                                                 5.  Which of the following statement is not true about Python?
                                                                                                                                                     a.  It is object oriented language.             b.  It is open source language.

                                                                                                                                                     c.  It is a compiled language.                  d.  It is easy to code.








                94   Modular (Ver. 4.0)-VI
   91   92   93   94   95   96   97   98   99   100   101