1.Write a program to illustrate the use of symbolic constants in a real-life application 2. Given the statement int a = 10, b = 20, c; determine whether each of the following statements are true or...

1.Write a program to illustrate the use of symbolic constants in a real-life application

2. Given the statement int a = 10, b = 20, c;


determine whether each of the following statements are true or false.


(a) The statement a = + 10, is valid.


(b) The expression a + 4/6 * 6/2 evaluates to 11.


(c) The expression b + 3/2 * 2/3 evaluates to 20.


(d) The statement a + = b; gives the values 30 to a and 20 to b.


(e) The statement ++a++; gives the value 12 to a


(f) The statement a = 1/b; assigns the value 0.5 to a


3. Declared a as int and b as float, state whether the following statements are true or false.


(a) The statement a = 1/3 + 1/3 + 1/3; assigns the value 1 to a.


(b) The statement b = 1.0/3.0 + 1.0/3.0 + 1.0/3.0; assigns a value 1.0 to b.


(c) The statement b = 1.0/3.0 * 3.0 gives a value 1.0 to b.


(d) The statement b = 1.0/3.0 + 2.0/3.0 assigns a value 1.0 to b.


(e) The statement a = 15/10.0 + 3/2; assigns a value 3 to a.


4. Which of the following expressions are true?


(a) !(5 + 5 >=10)


(b) 5 + 5 = = 10 || 1 + 3 = = 5


(c) 5 > 10 || 10 <>


(d) 10 ! = 15 && !(10 30


5. Which of the following arithmetic expressions are valid? If valid, give the value of the


expression; otherwise give reason.


(a) 25/3 % 2 (e) –14 % 3


(b) +9/4 + 5 (f) 15.25 + – 5.0


(c) 7.5 % 3 (g) (5/3) * 3 + 5 % 3


(d) 14 % 3 + 7 % 2 (h) 21 % (int)4.5


6. Write C assignment statements to evaluate the following equations:



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here