Page 31 - CloudGPT_C6_Flipbook
P. 31

Coding           uiz   01

                                                                                                      Subject Enrichment
                    State whether the following statements are true (T) or false (F).

                    a.  Part of the code in which the variable can be used is scope.

                    b.  Variable name must begin with a special character.





                 DATA TYPES
                 Variables contain the values on which the operations are performed. Every variable needs
                 to be assigned to a specific data type to make it accessible for the computer.

                 Data type  identifies  the type  of  data which  the  declared  variable can  hold.  It  helps  the
                 computer to understand what operations need to be performed on the declared variables.

                 The common data types are:


                     Data Type                       Description                   Declaration         Example

                  Integer (int)           It represents whole numbers  x=4                         5, 10, 988
                                           (zero, positive, negative value, not
                                           the decimal value)/integer value).
                                          Assigning non-integer value to
                                           integer type variable returns error.
                                          Integer type variable holds only a
                                           single value.


                  Floating Point          It  represents  real numbers  with  x= 5.1               4.65, 8.05, 10.1
                  Numbers (float)          decimal values or fractions.           x= 9.99*8.88
                                          Another  type  of  floating-point
                                           number  is  'double'  data  type,  to
                                           store even bigger values.


                  Character (char)        It holds a single letter. (e.g., a.b.c.) x='y'           90  (in  ASCII,  90
                                          The syntax of declaring a character                      is a upper case
                                           type variable is specific to the                        'Z')
                                           programing language.
                                          It is the smallest data type by size.
                                          Assigning a non-character type
                                           value to a character type variable
                                           returns error.



                                                                                 Variables Using  Block Coding   29
   26   27   28   29   30   31   32   33   34   35   36