https://academicheroes.com/wp-content/uploads/2020/12/logo.png00Munene davidhttps://academicheroes.com/wp-content/uploads/2020/12/logo.pngMunene david2020-02-19 11:00:552020-02-19 11:00:55(TCO 2) Given the following list of classes, attributes and methods,
(TCO 2) When a program evaluates mathematical expressions, which of the following operators (or mathematical
operations) has the highest precedence?
(Points : 5)
Subtraction
Addition
Parentheses
All have equal precedence.
(TCOs 2, 7) Which one of the following is not a valid assignment statement in a program?
(Points : 5)
b = -b
x – 6 = a
a = a + 1
None of the above
(TCO 2) Which value will be contained in the variable x after the following statement is executed?
x = 20 – 10 * 2 / (5 – 1)
(Points : 5)
0
10
5
15
If you use a loop to sum up a number of test scores, you will need a variable to act as a(n) _____.
(Points : 5)
flag
symbol
counter
accumulator
(TCO 4) For maximum efficiency, which question should be asked first when working with an Or decision?
(Points : 5)
The one less likely to be true
The one most likely to be true
The one that involves fewer comparisons
There is not enough information to determine the answer.
(TCOs 3, 4, and 8) In the following pseudocode, which raise will an employee in Department 6 receive?
If department < 2 then
Set raise = 1000
Else
If department < 6 then
Set raise = 2500
Else
Set raise = 3000
EndIf
EndIf
(Points : 5)
1,000
2,500
3,000
0
(TCOs 3 and 4) Which of the selection structures determine whether the user enters a number within a range of 5 and 15?
(Points : 5)
If commission <> 15
If commission <= 15
If (commission < 5) || (commission >15)
If (commission >=5) && (commission <= 15)
Question 4.4. (TCOs 3, 4, and 8) Which value gets displayed for the variable Z?
Set balance = 800
Set stateCode = 8
Set creditCode = 9
If (balance <> 800) AND (stateCode <> 6) AND (creditCode <> 7) then
Set Z = 3
Else
Set Z = 2
EndIf
Display Z
(Points : 5)
6
2
3
7
Question 5.5. (TCO 5) Whether or not the loop body is executed is controlled by a(n) _____.
(Points : 5)
Boolean expression
arithmetic expression
loop iteration
assignment statement
Question 6.6. (TCO 5) Which loop must execute the body of the loop at least once?
(Points : 5)
A pretest loop
A post-test loop
A sequence structure
A selection structure
Question 7.7. (TCO 5) In the following code, how many times will the loop body be executed?
int num;
for (num = 10; num <= 20;num+=5)
{
Console.WriteLine(num);
}
(Points : 5)
0
3
4
6
Question 8.8. (TCOs 3, 5, and 8) In the following code, how many times will the loop body be executed?
int x=6;
while(x<=6)
{
Console.WriteLine(x);
x = x + 1;
}
(Points : 5)
0
1
6
7
Question 9.9. (TCO 6) Which is an array element?
(Points : 5)
A specific value in an array
An alternate name for an array
A number that indicates the position of a particular item within an array
A number that represents the highest value stored within an array
Question 10.10. (TCO 6) Which is the value of the index used to access the first element in a C# array declared as the following?
int[] num = new int[20];
(Points : 5)
20
9
1
0
Question 11.11. (TCOs 5 and 6) Which control structure can be used to process every element of an array?
(Points : 5)
Selection control structure
While loop
For loop
B or C
Question 12.12. (TCO 6) A zero-based array named sales has been declared and loaded with the values 100, 1100, 3400, 5550, 3000, 22300, and 1200. Which value(s) will be stored in the array element sales[0]?
(Points : 5)
100
1100
3400
100, 1100
Question 13.13. (TCOs 7 and 8) Which type of error occurs when an array subscript’s value goes beyond the total number of elements in the array?
(Points : 5)
Syntax error
Runtime error
Logic error
Out-of-bounds error
Question 14.14. (TCOs 3 and 8) Which of the following is not an advantage of modular design?
(Points : 5)
It increases complexity.
Modules can be reused.
It is easier to work in teams — different people completing different modules.
All of the above are advantages.
(TCO 2) When a program evaluates mathema±cal expressions, which of the following operators (ormathema±cal opera±ons) has the highest precedence?(Points : 5)Subtrac±onAddi±onParenthesesAll have equal precedence.(TCOs 2, 7) Which one of the following is not a valid assignment statement in a program?(Points : 5)b = -bx – 6 = aa = a + 1None of the above(TCO 2) Which value will be contained in the variable x aFer the following statement is executed?x = 20 – 10 * 2 / (5 – 1)(Points : 5)010515If you use a loop to sum up a number of test scores, you will need a variable to act as a(n) _____.(Points : 5)²agsymbolcounteraccumulator
https://academicheroes.com/wp-content/uploads/2020/12/logo.png00Munene davidhttps://academicheroes.com/wp-content/uploads/2020/12/logo.pngMunene david2020-02-19 10:59:142020-02-19 10:59:14(TCO 2) When a program evaluates mathematical expressions, which of the following operators (or mathematical operations) has the highest precedence?
(TCOs 1–6) TicketsRUs needs an application to calculate ticket prices. There are three ticket
prices:
· Orchestra $85 each
· Mezzanine $70 each
· Balcony $45 each
There is also a 15% discount on matinee performances.
Your application has the GUI shown below.
With the following named components:
Component
Type
Purpose
txtNum
JTextField
Input for number of tickets
chkMatinee
JCheckBox
Check if matinee performance
radOrchestra
JRadioButton
Check for orchestra tickets
radMezzanine
JRadioButton
Check for mezzanine tickets
radBalcony
JRadioButton
Check for balcony tickets
btnCalc
JButton
Click to calculate price
txtEach
JTextField
Displays price of each ticket
txtTotal
JTextField
Displays total price
Clicking the CalcPrice button should determine the price per ticket and the total price based on the user’s input and display in txtEach and txtTotal. You should make sure the number of tickets is entered and a ticket type is selected, otherwise give an error message.
The action listener for btnCalc is set up as follows.
btnCalc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
calcPrice(); //write the code for this method
}
});
Write the calcPrice method that is called by the action listener. This class method has access to all of the GUI components. You DO NOT HAVE TO CODE THE GUI. ONLY write the code for this method which does all the work. The header for the method is:
private void calcPrice
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
Need some help with some simple java programming tests:
Test 1: The java coding that accepts a
distance it kilometers, sends it to a method which converts it to miles, and then displays the result.
Test 2: The java coding that accepts the cost of a building, sends it to a method which calculated the recommended insurance, and then displays the result in currency format.
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
https://academicheroes.com/wp-content/uploads/2020/12/logo.png00Munene davidhttps://academicheroes.com/wp-content/uploads/2020/12/logo.pngMunene david2020-02-19 10:42:592020-02-19 10:42:59Need some help with some simple java programming tests: