Wednesday, 31 July 2013

Topic -1 (Compilation)-31-07-2013 & 01-08-2013

Dear Students from Section-2
Compile your 1st topic here.

10 comments:

  1. ouestion1>What is data structure?
    answer> Data structure is mainly the systematic arrangement of data in various forms like array, tree, stack, link list etc, in order to get some desired output.

    ReplyDelete
  2. question>What is an array?
    Answer>Arrays are a data type that are used to
    represent a large number of homogeneous values, that is values that are
    all of the one data type. The data type could be of type char, in which
    case we have a string. The data type could just as easily be of type int,
    float or even another array.

    ReplyDelete
  3. question>What is a pointer?
    answer>Simply stated, a pointer is an address. Instead of being a variable, it is a
    pointer to a variable stored somewhere in the address space of the
    program. It is always best to use an example, so examine the given
    program [POINTER.C] which has some pointers in it.
    #include "stdio.h"
    /* illustration of pointer use */
    void main( )
    {
    int index, *pt1, *pt2;
    index = 39; /* any numerical value */
    pt1 = &index; /* the address of index */
    pt2 = pt1;
    printf("The value is %d %d %d\n", index, *pt1, *pt2);
    *pt1 = 13; /* this changes the value of index */
    printf("The value is %d %d %d\n", index, *pt1, *pt2);
    }

    ReplyDelete
  4. question>What is Structure>
    answer>
    A structure is a user-defined data type. We can define a
    new type of data considerably more complex than the types we have
    been using. A structure is a collection of one or more variables, possibly
    of different types, grouped together under a single name for convenient
    handling. Structures are called “records” in some languages, notably
    Pascal. Structures help organise complicated data, particularly in large
    programs, because they permit a group of related variables to be treated
    as a unit instead of as separate entities.
    The best way to understand a structure is to look at an example
    [STRUCT1.C].
    #include "stdio.h"
    void main( )
    {
    struct {
    char initial; /* last name initial */
    int age; /* childs age */
    int grade; /* childs grade in school */
    } boy, girl;
    boy.initial = 'R';
    boy.age = 15;
    boy.grade = 75;
    girl.age = boy.age - 1; /* she is one year younger */
    girl.grade = 82;
    girl.initial = 'H';
    printf("%c is %d years old and got a grade of %d\n",
    girl.initial, girl.age, girl.grade);
    printf("%c is %d years old and got a grade of %d\n",
    boy.initial, boy.age, boy.grade);
    }
    The program begins with a structure definition. The key word struct is
    followed by some simple variables between the braces, which are the
    components of the structure. After the closing brace, we will find two
    variables listed, namely boy, and girl. According to the definition of a
    structure, boy is now a variable composed of three elements: initial,
    age, and grade. Each of the three fields are associated with boy, and
    each can store a variable of its respective type. The variable girl is also
    a variable containing three fields with the same names as those of boy
    but are actually different variables. We have therefore defined 6 simple
    variables.

    ReplyDelete
  5. Que-What are the types of data structure?
    Ans- Basically there are two types of data structure-

    1. Linear Data structures
    2. Non-Linear Data Structures

    1. Linear Data structures- In these data structures the elements form a sequence. Such as Arrays, Linked Lists, Stacks and Queues are linear data structures.

    2. Non-Linear Data Structures- In these data structures the elements do not form a sequence. Such as Trees and Graphs are non-linear data structures.

    ReplyDelete
  6. Que-Explain the specification of algorithm?
    Ans-
    An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition, all algorithms must satisfy the following criteria:

    (1)Input. There are zero or more quantities that are externally supplied.
    (2)Output. At least one quantity is produced.
    (3)Definiteness. Each instruction is clear and unambiguous.
    (4)Finiteness. If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after a finite number of steps.
    (5)Effectiveness. Every instruction must be basic enough to be carried out, in principle, by a person using only pencil and paper. It is not enough that each operation be definite, it also must be feasible.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Q. What is data structure?
    Ans: Data structure is an arrangement of data that can be used to store a collection of data in computer's memory or sometimes in disk. It must be simple enough so that it can effect efficiently.
    There are two kind of data structure-- linear and non-linear data structure.

    ReplyDelete
  9. Q. What is algorithm? Describe its properties.
    Ans: The method of solving a problem is known as an algorithm. More precisely, an algorithm is a sequence of instructions that act on some input data to produce some output in a finite number of steps.
    An algorithm must have the following properties:
    (a) INPUT: An algorithm must receive some input data supplied externally.
    (b) OUTPUT: An algorithm must produce at least one output as the result.
    (c) FINITENESS: No matter what is the input, the algorithm must terminate after a finite number of steps.
    (d) DEFINITENESS: The steps to be performed in the algorithm must be clear and unambiguous.
    (e) EFFECTIVENESS: One must be able to perform the steps in the algorithm without applying any intelligence.

    ReplyDelete
  10. Q.What are the features of algorithm?
    => The important features of algorithms are:
    a) it should be free of ambiguity
    b) it should be con-size
    c) it should be efficient

    ReplyDelete

Note: only a member of this blog may post a comment.