Need help with this review COSC 1436 3Sl MIDTERM EXAM Write
Need help with this review
COSC 1436 3Sl MIDTERM EXAM Write all answers on your own paper. Please write on only one side. Write your name on this sheet and turn it in with your exam. 1) State whether the following are valid statements. If they are not, state why they are not. Assume variables a, b.&care; declared as integer variables and have been given values (a 5, b 0, c 12) prior to each of the following statements. If they are valid explain what the statement will do. points each) a) if (a (b CO) a 1; else a -1; as first m pleatm b) a b bo c; at b faire g) ass-1: h) b i) int x lal. k) unsigned char m 5: val,d 28 at 23 n) a b +++c; 23 b f e. o) char N 0: N. t valid p) char LO abcd\' vald 2) What will the following section of code print? (5 pts) for (in 0: iSolution
Hi, I have reviewd first 2 problem and answered unanswered parts.
please repost others in separate post.
1)
f)   Valid
    a-=1 => a = a-1 = 5-1 = 4
h) b**b => Invalid, (**) is not a valid opeartion
j)   unexpected result (depends on compiler)
    multiple unsequenced modifications to \'a\'
    a = --a - a--
    Here, value of a = 0 (g++ compiler)
m) b++ = a , Not Valid, expression is not assignable
n) a += b++ + ++c; Valid
    a = 28, b=11, c=13
2)
    0
    4
    8
    12

