Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Which symbol would be used in a flowchart for the following statement? Displa

ID: 638365 • Letter: 1

Question

1) Which symbol would be used in a flowchart for the following statement?
Display sum

a) Parallelogram
b) Diamond
c) Rectangle
d) Rounded rectangle

2) Assume that the variables num and rate are integer variables, and dept
is a string variable. Which of the following assignment statements is invalid?

a) num = 23
b) dept = 100
c) num = rate
d) None of the above

3) Which is the final value of y at the   of these statements?
            x = 10
            y = x - 1
            y = y + x

a) y = 8
b) y = 5
c) y = 11
d) y = 19

4) Which is a valid assignment statement for the following: Add 2 to x and store the result in z

a) 2 + x = z
b) z = x
c) z = x + 2
d) z + 2 = x

5) Evaluate the following expression.
100 MOD 5

a) 0
b) 5
c) 100
d) 20

6) Evaluate the following expression using the values x = 10, y = 5, and z = 3.

z + x / y - 1

a) 0
b) 5.5
c) 1.6
d) 4

7) List the inputs and outputs and write the psuedocode to solve the following problem:

The program will prompt the user for a sales amount and a discount percentage (input 10 for 10%). The program will calculate and display the amount of the sale after the discount is applied.

Explanation / Answer

1) Ans: a) Parallelogram
Exaplantion:
---------------

All print statements and display messages are specified in flowchart by Parallelogram symbol
===================================================================================
2) Ans: b)dept = 100
Exaplantion:
---------------

Assigning number directly to string varible is invalid, Since string varibles are assigned
with inclosed by quotes, for example dept="100" is valid but not dept=100.
===================================================================================

3) Ans: d) y=19

Exaplantion:
---------------
       x=10
       y=10-1 =>9
       y = 9 +10 =>19
===================================================================================

4) Ans: c) z = x + 2

Exaplantion:
---------------

       All assignment statemets only one target varible at left hand side. Hence, z = x + 2 is valid.
===================================================================================

5) Ans: a) 0

Exaplantion:
--------------

MOD is a modular operation, generally it is remainder value when two digits are divided
       100 MOD 5
       5)100(20
       100
       ----
       0 (Reminder is 0)
       ----  
===================================================================================

6) Ans: d)4

Exaplantion:
--------------

   z + x / y - 1
  
   In the above expression highest precedence is for /
   Hence first x/y is computed . i.e. 10/5 =>2
   Next precedence level are + and -
   3 + 2 -1
   =>4
===================================================================================

7) List the inputs and outputs and write the psuedocode to solve the following problem:

The program will prompt the user for a sales amount and a discount percentage (input 10 for 10%). The program will calculate and display the amount of the sale after the discount is applied.

Pesudocode
=============
BEGIN

   DECLARE salesAmount,discountPercentage,amount
   DIPLAY 'Enter sales amount and discount percentage'
  
   READ salesAmount
   READ discountPercentage
      
   amount = salesAmount - (salesAmount*discountPercentage)/100
  
   DISPLAY 'the amount of the sale after the discount is applied'
   DISPLAY amount
  
END
  
=====================
Sample Input and ouput is
=====================

Enter sales amount and discount percentage
100
10
the amount of the sale after the discount is applied
90