I. What is the output of the following poorly indented code fragments?
1. somenumber = 100;
if (somenumber > 50)
System.out.print("first "); System.out.print("second "); System.out.print("third");
2. somenumber = 40;
if (somenumber > 50)
System.out.print("first "); System.out.print("second "); System.out.print("third");
3) somenumber = 100;
if (somenumber > 50)
{
System.out.print("first "); System.out.print("second ");
}
System.out.print("third");
4) somenumber = 40;
if (somenumber > 50)
{
System.out.print("first "); System.out.print("second ");
}
System.out.print("third");
5) somenumber = 100;
if (somenumber > 50)
System.out.print("first ");
else
System.out.print("second "); System.out.print("third");
6) somenumber = 40;
if (somenumber > 50)
System.out.print("first ");
else
System.out.print("second "); System.out.print("third");
7) if ((5.2 > 3.3 && 6.2 < 9.9) && (6.2 < 3.5 || 4.2 = = 3.1 || 3.1 ! = 3.14)) System.out.print("TRUE");
else
System.out.print("FALSE");
II. Answer Yes or No:
8) If the body of the if contains only a single statement then are braces required around the statement?
9) Is the expression !(x > 10) equivalent to the expression x < 10?
SOLUTION:-
I. What is the output of the following poorly indented code fragments?
ANSWERS:- Answers are given below:-
(1) OUTPUT: first second third
(2) OUTPUT: second third
(3) OUTPUT: first second third
(4) OUTPUT: third
(5) OUTPUT: first third
(6) OUTPUT: second third
(7) OUTPUT: TRUE
II. Answer Yes or No:
(8) CORRECT ANSWER: NO
(9) CORRECT ANSWER: NO
I. What is the output of the following poorly indented code fragments? 1. somenumber = 100;...
Q1: Which of the following is a double-selection control statement? do…while for if…else if. Q2: Which of the following is not a Java keyword? do next while for Q3: What is output by the following Java code segment? int temp; temp = 200; if ( temp > 90 ) System.out.println( "This porridge is too hot." ); if ( temp < 70 ) System.out.println( "This porridge is too cold." ); if ( temp == 80 ) System.out.println( "This...
• 1. What are the quarterly growth rates (Percentage Change From Preceding Period in Real Gross Domestic Product) for the U.S. economy for the last six quarters? Report those numbers in your submission 2. What is the average of those 6 quarters? . 3. Is the average of those growth rates above or below the long-run U.S. annual growth rate of 3.5 percent? Bureau of Economke Analysis Table 1.1.1. Percent Change From Preceding Period in Real Gross Domestic Product Percent...
QUESTION 1 What will be displayed as a result of executing the following code? int x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points QUESTION 2 What will be the displayed when the following code...
Please answer and explain thank you. Question 1 What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x); Group of answer choices 45678.259 0,045,678.26 45,678.26 45,678.3 Question 2 What will be printed when the following code is executed? double x = 45678.259; String output = String.format("%,.1f", x); System.out.println(output); Group of answer choices 45678.259 45,678.259 45,678.26 45,678.3 Question 3 What will be the value of ans after the following code has been executed? int ans=0;...
1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout << list[j]; (Points : 4) 0 1 2 3 4 0 5 10 15 0 5 10 15 20 5 10 15 20 Question 2.2. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j...
Please help to resolve my error. This Java code is supposed to evaluate one line equation of the form X Operator =Z where X is any name of a variable and Y and Z are integers By user in equation solver window. Currently the code executes expressions such as Y Operator(+,-,*,/) Z package Equations; /** * This program evaluates arithmetic expressions */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.StringTokenizer; public class EquationSolver extends JFrame implements ActionListener { private JTextField...
QUESTION 7 The data set Beer Large, which can be found in StatCrunch Shared Data Sets, gives the Alcohol, Carbohydrates and Calories for different brands of beer. The explanatory variable is x + Carbohydrates and the response variable is Y - Calories. Use this information to answer: Calculate the correlation between carbohydrates and calories. (4 decimal places) Row vars varo var var 8 var9 var 10 2 الميا ABV 4.1 5.4 4.43 4.13 5.9 4.9 Carbs 2.6 13.7 5.8 5...
Please solve problem 1 and show formulas used Tables for reference: Homework 6- Chapter 9 Problem 1: A crawler hoe having a 2 -cy bucket and whose cost per hour, including the wages to an operator, is $109 will excavate and load haul units under each of the stated conditions. The maximum digging depth of the machine is 22 ft. Determine the cost per bank cubic yard for each condition. (Condition 1: 315 bey/hr, S0.346/bcy; condition 2: 289 bey/hr, S0.377/bcy;...
What is answer of #10?? Report: Hydroboration of 1-Methylcyclohexene Mechanism / GC Analysis / Calculations 1. After reviewing the GC and 'H NMR spectra, what is the major product of the reaction? + 3 a. BH: . THF 3 b. 3 H2O2 OH + 3 OH c. NaOH MOH OH racemic racemic major 2. Draw the complete curved arrow mechanism for the reaction to produce the major product, including both the hydroboration and oxidation steps. Repetitive steps need only be...
These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....