EmbLogic's Blog

E12: Assignment No.1

Dear E12 Trainees,

Update the status of Assignment 1 of Data structures with C on this post only.

47 Responses to E12: Assignment No.1

  1. Have completed 10 questions of 1st assignment of ‘c’.

  2. trilok.singh says:

    int x=1,z;
    z=x/x++;
    how will be the values are assigned to x in above expression….

    • msiddarth says:

      In this snippet of code, the precedence of operator is taken care. Hence the execution will be:
      z = ( x / (x++))
      therefore
      z = 1 / 1
      output: 1
      if we check the value of x in the next statement the value of x will be updated i.e. x will be 2

  3. completad the assignment with few problems as stated under-
    Ques6 last printf statement answer coming -1 as it should be 1 according to me
    int y=-1;
    y>>=;printf(“%d\n”,y);
    Ques7 last printf statement ans should be zero but it’s coming 1
    x=3,y=z=4;
    printf(“%d\n”,z>=y && y>=x);

  4. deepak1 says:

    i have completed till 5th ques…

    • deepak kumar says:

      ..not able to access internet on system. hardly 2 or 3 syestems on which intrnt accessibility had possible.and bharat was unable to rectify d problem…completed array programming successfully…

    • deepak kumar says:

      i hav completed till 15th except 9,10,11,15.
      doubts..if y=-1;y<<=3;
      pf("%d",y); n how we r geeting…
      if x=3,y=3;
      pf("%d",z+=x<y?x++:y++); n how we rgeeting…

  5. saranjeet singh says:

    completed 14 questions and hving issues in 10 and 11 question…..not really getting whats happening while using %8.g

  6. Nishant says:

    i have completed 1st assignment……

  7. chhavi garg says:

    i had completed 5 questions

  8. chhavi garg says:

    As per with your instruction i had done array but i am facing problem i multidimensional array as i am not able print the value of address of a[row][column]

    • saranjeet.singh says:

      for printing the address of multidimentional array write it like this:

      (*(a+row)+column) in loop

      • chhavi garg says:

        Hello Sir I had completed my assigment 1,but facing problem in some ques:
        Ques 10-erreo coming as “expected expression before double”.
        Ques 11- what does #o and #x mean.
        Ques 21-error coming segmentation fault.
        And I am not able to do Ques 26

  9. trilok.singh says:

    int x=1,z;
    z=x/x++;
    how will be the values are assigned to x in above expression….

  10. sandeep.swami says:

    i have completed 6 question of first assignment

  11. Ankit Bhasin says:

    Sir ,
    I have completed 5 ques but having issue in ques 4 that,
    x*=3+2 , here x=x*3+2 that means if x=2 then first 2*3 then add +2 to it this gives 8 but answer is 10.
    and in ques 3 : x=3+4%5-6 , here I thought -3 but answer is 1

    • msiddarth says:

      the execution of the above statement is:
      x = (x * (3 + 2)) as per the precedence operator.

      If the numerator is less then denominator the result will always be numerator. Therefore 4%5 the result is 4 which will add with 3 and then the result is subtracted with 6. Hence the output is 1

      • Ankit Bhasin says:

        Sir,
        I have COMPLETED 22 questions of assignment 1, but issues in some ques.
        1: In ques (4):if x=40&y=z=4,then x=y==z; and x==(y=z); is 1 in both cases how?
        2: In ques (5): if x=3 and z=0 ,then if z=x/++x; z=1 how?
        3: In ques (6): if y=-1 then y>>=3; here y=1101 1111 but answer is -1 how?
        4: In ques (7): printf(“%d”,z>=y>=x?1:0); where x=3,y=z=4; ans is 0 how?
        5: problem in ques 9
        6: In ques (11) if we use %#o then it gives value with initialization of 0 & if we use %#x then it have ox . why?

        • Ankit Bhasin says:

          Sir,
          Previous blog is resolved.
          I have Completed ASSIGNMENT 1 Successfully.
          Problems:
          1: In Ques (4):if x=40 and y=z=4; then how x==(y=z) is 1 ?
          2: In ques (6):if y=-1 then ques says to print y>>=3;here not able to get the answer -1 ?
          3: don’t know about how to use %g in double format in ques no.(9)
          4: In ques (11) if we use %#0 it gives value initialized with 0 and if we use %#x then it is initialized with 0x Why ?

  12. shrey.nagpal says:

    sir i hv done till ques5.

  13. Deepa garg says:

    I also started Assignment No-1

  14. willy.jacob says:

    unable to understand how we got the output of the following code:

    ++x&&++y||++z;printf(“%d\t%d\t%d\n”,x,y,z);

    as 2 2 1 when x=y=z=1;
    and 0 -1 0 when x=y=z=-1;

    • msiddarth says:

      The execution is from left to right. On this basis the compiler starts executing first ++x which comes out to be 2 and compiler treat this value as TRUE i.e.1 as it has to perform AND operation it will also check the condition of ++y which comes out to be 2 hence both the statements are TRUE it won’t check the condition of ++z as it has to do OR operation and in OR operation if first statement is true it won’t check the next statement whereas in AND operation if the first statement is true it will check the next statement.
      If the statement A is false in AND condition it won’t check the next statement. As in the next stage value of x becomes 0 hence it won’t check the next statement Y which makes the entire statement as FALSE (0) and this result has to do OR operation hence it will check the next statement z which comes out to be 0 that is the reason you will get the result as 0

  15. vikas sharma says:

    did 5 q?….

  16. vaibhav chahal says:

    completed first 5 question of assignment 1..

  17. anil says:

    what is the difference between %1.2f and %f?

  18. er.mohit says:

    done 12 questions on assignment no 1……..

  19. anil says:

    x=1;
    printf(“%d\n”,!x|x);
    what is the output?

  20. ravi shankar says:

    completed 14 question of assignment no. 1

  21. deepak.garg says:

    Sir I getting problem in
    Ques-3-Here I getting the error
    a.c:(.text+0×21): undefined reference to `prinf’
    collect2: ld returned 1 exit status
    Plz suggest me how to resolve it

  22. sunil110 says:

    i have done assignment 1.

  23. RAHUL SRIVASTAVA says:

    done 10 questions of assingment 1

  24. Ravi Soam says:

    Sir,
    I have done 10 ques successfully of assignment 1, but having issues :
    In Question:(4)- that if x=40 and y=z=4; then how x==(y=z) is 1.
    and also in ques no.9 ,here what %g do and how it work with Double.

  25. Abhishek Bist says:

    done upto 15 question successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>