Programming with Objects

The arithmetic operators manipulate numerical values and the assignment operator stores a value to a variable.
Answer It is often a requirement of a program to group items of same type say sales of an item X in Northern Region in one element to achieve preciseness and to make programming clearer, therefore sometimes repetitive data structures like array are used to group items of same type. Also, separate declaration of data element of similar type would make a program long and difficult to understand.
Answer Record data structures , as the name suggests are the objects that implement a real life record for example the record would typically represent a students attributes ,like his roll number ,name , date of birth and marks obtained in a particular subject or subjects . Here various attributes like name, roll number, date of birth etc are different types of data elements, but they are grouped together through record data structures.
Answer If a programmer needs to implement programmatically a real life scenario, like maintaining a file of different students, and then perform operations like calculating their average age, or arranging their names alphabetically then he needs to combine repetitive and record data types to achieve the desired logic.
The packed attri
7. What are the four attributes of a variable
Answer Four attributes are currently defined for variables: aligned, mode, packed, and section.
Aligned (alignment)
This attribute specifies a minimum alignment for the variable or structure field, measured in bytes.
Mode (mode)
This attribute specifies the data type for the declaration—whichever type corresponds to the mode.
Packed
The packed attribute specifies that a variable or structure field should have the smallest possible alignment—one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute.
Section ("section-name")
Normally, the compiler places the objects it generates in sections like data and bss. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section.
8. In some computing books you will find that the execution of an algorithm described as a mechanical process. What do you think this means
Answer An

You Might Also Like