1. What will be the output of the following program? Explain. a = 2*3-6 print(a) Answer: 0 Explanation: step 1: 2*3=6 step 2: 6-6 =0 Multiplication has higher priority, its executed first 2. What will be the output of the following program? Explain. a = 2**3-6*2 b=2%3 print(a) print(b) Explanation: 1. 2**3=8, 2. 6*2=12, 3. 8-12=-4, a=-4 b=2%3=2 Answer: -4 2 3. What will be the output of the following program? Explain. a = 7/2 = 3.5 regular division b=7//2 = 3 integer division c=7%2 = 1 remainder sum=a+b+c sum=3.5+3+1=7.5 - float number print(a) 3.5 print(b) 3 print(c) 1 print(sum) 7.5 Final output: 3.5 3 1 7.5 4. What will be the output of the following program? Explain. a = 123 b=123%10 = 3 c=123//10 = 12 d=c%10 = 12%10=2 e=c//10 = 12//10=1 k=e%10 = 1%10=1 sum=b+d+k = 3+2+1=6 print(a) print(b) print(c) print(d) print(e) print(k) print(sum) Output: 123 3 12 2 1 1 6 What this program is calculating? This program finds sum of digits of the number 123, which is 1+2+3=6 5. What will be the output of the following program? Explain. a = 257 b=257%2 = 1 c=257//2 = 128 d=257/2 = 128.5 e=((a-b)%2 - 3)**2 1. (a-b) = 257-1=256 2. (a-b)%2=256%2=0 3.((a-b)%2 - 3)=(0-3)=-3 4.(-3)**2=9 e=9 product=e*10=9*10=90 print(a) print(b) print(c) print(d) print(e) print(product) output: 257 1 128 128.5 9 90 6. For the program below, answer the following questions: How many variables are in this program? 8 For each variable, write NAME, TYPE and VALUE. Provide brief explanation. X = "C++" C = "Java" D = C+X E = 15, name is E, value is 15, type - integer K = 2, name is K, value is 2, type - integer M = E/K=15/2=7.5, name is M, value is 7.5, type is float Y = E//K**2 = 15//2**2= 15//(2**2)=15//4=3, name Y, value 3, type integer Z = Y%10 = 3%10 = 3, name Z, value 3, type integer