1.1 A variable declared within the for-loop has _________ scope.
a. local
b. global
c. block
d. private
1.2 Which of the following statements is equivalent to the following: while (value < 18)
a. while (value <= 18)
b. while (value >=18)
c. while (! (value > 18) )
d. while (value < 17)
1.3 Which of the following equations will deduct a discount of 7.5% from an amount?
a. amount = amount – 7.5%
b. amount = amount * .925;
c. amount = amount – (amount * 0.075)
d. amount = amount – amount * 0.75;
1.4 Which of the following statement is equivalent to?
result *= a + 5;
a. result = result * a + 5;
b. result = result * (a + 5);
c. result = (result * a ) + 5
d. results = a+ 5;
SOLUTION TO THE ABOVE QUESTIONS
1.1 A variable declared within the for-loop has _________ scope.
a. local
b. global
c. block
d. private
ANSWER.
c. block
1.2 Which of the following statements is equivalent to the following: while (value < 18)
a. while (value <= 18)
b. while (value >=18)
c. while (! (value > 18) )
d. while (value < 17)
ANSWER.
There is no answer in the given choices.
The statement equivalent to while (value < 18) is while (! (value >= 18) )
1.3 Which of the following equations will deduct a discount of 7.5% from an amount?
a. amount = amount – 7.5%
b. amount = amount * .925;
c. amount = amount – (amount * 0.075)
d. amount = amount – amount * 0.75;
ANSWER.
c. amount = amount – (amount * 0.075)
1.4 Which of the following statement is equivalent to?
result *= a + 5;
a. result = result * a + 5;
b. result = result * (a + 5);
c. result = (result * a ) + 5
d. results = a+ 5;
ANSWER.
b. result = result * (a + 5);
Comments
Leave a comment