Dezyne E’Cole College, Ajmer




                                 B.C.A (Part 1) Examination, 2013
                          Fundamental of C Programming
1. What will be the output of the following code
         int x=40000;

             printf (“%d”, x);

Ans: Garbage value

2. Arrange following operators in ascending order according to their precedence.
       a. &&
       b. ||
       c. !
       d. ? :
       e. & (Bitwise)

Ans: !,    &,           &&,      ||,       ?:

3. What will be the output of following code for

    (i=1, j=10; i<6; ++i, j--)

    printf (“%d %d”, i, j);

Ans:
             I      J
            1 10

            2      9

            3      8

            4      7

            5      6

4. What is the meaning of

    int (*P)[10];

Ans: P, Array of pointer (10 values)

5. What is the meaning of

    int *P [10];

Ans: P, 10 array of pointer, that stores 10 different addresses.

6. Find errors (if any) and remove them otherwise give output of the following
Dezyne E’Cole College, Ajmer



          Char C=’A’;

          int x=10, y;

          y=x+c;

          putchar(y);

Ans:      char C=’A’;

          int x=10,y;

          y=x+C;

          putchar(y);

          Output: K



   7. Find errors and remove them (if any) otherwise give output of the following

          printf(“%d”,++5);

       Ans: printf(“%d”,5);

          output: 5

   8. Find errors and remove them (if any) otherwise give output of the following

          printf[“%d”,sizeof(“”)];

       Ans: printf(“%d”,sizeof(“”));

          output: 1

   9. What will be the output of the following:

          int x=10, y=20;

          (x>y)? ++x: ++y;

          printf(“n x=%d, y=%d”,x,y);

       Ans: x=10, y=21

   10. if student structure is given as

          struct student

          {

                   char name[10];
Dezyne E’Cole College, Ajmer



             int E;

             int H;

             int M;

   }*pstu;

   then allocate memory to pstu pointer.

Ans: pstu= (student*) malloc (sizeof (student));

C programming (Part 1)

  • 1.
    Dezyne E’Cole College,Ajmer B.C.A (Part 1) Examination, 2013 Fundamental of C Programming 1. What will be the output of the following code int x=40000; printf (“%d”, x); Ans: Garbage value 2. Arrange following operators in ascending order according to their precedence. a. && b. || c. ! d. ? : e. & (Bitwise) Ans: !, &, &&, ||, ?: 3. What will be the output of following code for (i=1, j=10; i<6; ++i, j--) printf (“%d %d”, i, j); Ans: I J 1 10 2 9 3 8 4 7 5 6 4. What is the meaning of int (*P)[10]; Ans: P, Array of pointer (10 values) 5. What is the meaning of int *P [10]; Ans: P, 10 array of pointer, that stores 10 different addresses. 6. Find errors (if any) and remove them otherwise give output of the following
  • 2.
    Dezyne E’Cole College,Ajmer Char C=’A’; int x=10, y; y=x+c; putchar(y); Ans: char C=’A’; int x=10,y; y=x+C; putchar(y); Output: K 7. Find errors and remove them (if any) otherwise give output of the following printf(“%d”,++5); Ans: printf(“%d”,5); output: 5 8. Find errors and remove them (if any) otherwise give output of the following printf[“%d”,sizeof(“”)]; Ans: printf(“%d”,sizeof(“”)); output: 1 9. What will be the output of the following: int x=10, y=20; (x>y)? ++x: ++y; printf(“n x=%d, y=%d”,x,y); Ans: x=10, y=21 10. if student structure is given as struct student { char name[10];
  • 3.
    Dezyne E’Cole College,Ajmer int E; int H; int M; }*pstu; then allocate memory to pstu pointer. Ans: pstu= (student*) malloc (sizeof (student));