Dear E12 Trainees,
Update the status of Assignment 1 of Data structures with C on this post only.
Dear E12 Trainees,
Update the status of Assignment 1 of Data structures with C on this post only.
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
Have completed 10 questions of 1st assignment of ‘c’.
int x=1,z;
z=x/x++;
how will be the values are assigned to x in above expression….
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
in ques 5
x=3;
z=x/++x;
In this case o/p(value of z) should be 0 but we are getting 1.
int x=2,z;
z=–x/++x;
output(z) is one
and
z=++x/–x;
here, output(z)is also one…..
how..???
because compiler will read the value from right to left were ++x will become 4 and the value of x will then be 4 not 3(because now it is reading the next statement) so the answer will be 1 not 0.
so ans.
4/4=1
i want to know the preference order in the following
–x, x–, ++x, x++, x
because compiler will read the value from right to left were ++x will become 4 and the value of x will then be 4 not 3(because now it is reading the next statement) so the answer will be 1 not 0.
so ans.
4/4=1
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);
For question number 7 the execution will be
(z >=y) the result will be true as 4 == 4 when it is true it will check the condition of y>=x in which the statement is: 4>=3 which is true hence the output is 1
Sir reasons for ques no.6
that’s the problem sir,answer must be 1 bt it coming out to be 0;
i have completed till 5th ques…
..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…
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…
completed 14 questions and hving issues in 10 and 11 question…..not really getting whats happening while using %8.g
lets take an example
float fl = 123.4567
printf(“%3g”,fl); the output is: 123
printf(“%5g”,fl); the output is: 123.4
completed 20 questions but having problem in ques:15
completed assignment no1….facing problem in last question….
i have completed 1st assignment……
i had completed 5 questions
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]
for printing the address of multidimentional array write it like this:
(*(a+row)+column) in loop
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
int x=1,z;
z=x/x++;
how will be the values are assigned to x in above expression….
i have completed 6 question of first assignment
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
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
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?
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 ?
sir i hv done till ques5.
I also started Assignment No-1
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;
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
did 5 q?….
completed first 5 question of assignment 1..
what is the difference between %1.2f and %f?
done 12 questions on assignment no 1……..
x=1;
printf(“%d\n”,!x|x);
what is the output?
completed 14 question of assignment no. 1
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
i have done assignment 1.
done 10 questions of assingment 1
assingment no. 1 done…
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.
Sir,
Done Assignment 1 Successfully.
done upto 15 question successfully.