Homework Question help 1. Given the numeric value 338,788.7768 , in the space pr
ID: 3855580 • Letter: H
Question
Homework Question help
1. Given the numeric value 338,788.7768, in the space provided enter the currency value which would be generated by the appropriate Visual Logic function.
2. Given the following pseudocode:
start
Declarations
num departmentCode = 5
string departmentName = "CSCI"
...
if (departmentCode = "5") then
output "The department is: ", departmentName
endif
stop
The program displays the message: The department is: CSCI
The program displays the message: The department is:
The pseudocode has an illegal comparison.
3. Given the following pseudocode:
start
Declarations
num employeeSalary = 35000.0
num clerkSalary = 29000.0
num dentistSalary = 300000.0
if (clerkSalary > dentistSalary) AND (employeeSalary < dentistSalary) then
output "true."
else
output "false."
endif
stop
The program displays the message: true.
The program displays the message: false.
4. Given the following pseudocode:
start
... (set of instructions before the if-statement)
if 21 > 21 then
... (instructions in the if-statement)
endif
... (set of instructions after the if-statement)
stop
Does the condition stated in the if-statement contribute to the overall solution of the problem?
Yes, the condition stated in the if-statement contribute to the overall solution of the problem.
No, the condition stated in the if-statement does not contribute to the overall solution of the problem.
5. The following two pseudocode if-statements are equivalent:
if A < B AND C > D then
output "A < B and C > D."
endif
if A < B then
if C > D then
output "A < B and C > D."
endif
endif
True
False
6. Given the following pseudocode:
start
Declarations
num employeeSalary = 35000.0
num clerkSalary = 29000.0
num dentistSalary = 300000.0
if (clerkSalary > dentistSalary) OR (employeeSalary < dentistSalary) then
output "true."
else
output "false."
endif
stop
The program displays the message: true.
The program displays the message: false.
7. When using Visual Logic, the rounded value of the expression 21/2 + 3.9 / 7.8 is:
8. Given the following pseudocode:
start
Declarations
num TAX = 0.9
num HIGH_PAY_BRACKET = 250000.0
num annualSalary
string stateName
output "Enter the annual salary: "
input annualSalary
output "Enter the name of the state: "
input stateName
if (annualSalary > HIGH_PAY_BRACKET OR stateName) then
output "The person is reach."
else
output "The person is poor."
endif
stop
The program displays the message: The person is rich.
The program displays the message: The person is poor.
It is not possible to predict the output.
The pseudocode has an invalid statement.
9. Given the following pseudocode:
Declarations
num counter = 0
num TAX = 0.07
while NOT (counter < 5)
output "The tax value is: ", TAX
counter = counter + 1
endwhile
The program displays 5 times the message: The tax value is: 0.07
The program displays 4 times the message: The tax value is: 0.07
The program displays nothing.
a.The program displays the message: The department is: CSCI
b.The program displays the message: The department is:
c.The pseudocode has an illegal comparison.
Explanation / Answer
1. 338,788.7768 gets rounded to 2 digits for currency and hence it is 338,788.78, Further in the visual logic it can be prefixed by the currency symbol e.g. $ 338,788,78
2. In the expression (departmentCode = "5") it is checking whether departmentCode is 5, at the time of declaration this has been intialized to 5 and hence the condition is True. So the output will be as per option a, the department Name CSCI gets displayed after the string "The department is: ",
The program displays the message: The department is: CSCI
3. After the initilizations, there is a comparision as below
29000 > 300000 AND...
As the first comparision fails, the expression will be false and hence
The program displays the message: false.
4. if 21 > 21 then
... (instructions in the if-statement)
As 21 can never be greater than 21, this comparision is never going to be true
This does not contribute to the overall solution to the problem.
a.The program displays the message: The department is: CSCI
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.