Question
For each of the following, convert the base 10 numbers to binary (base2), and do the addition or subtraction in base 2. Show all calculations.
- For each of the following, convert the base 10 numbers to binary (base2), and do the addition or subtraction in base 2. Show all calculations. Double-check your work by converting your result back to base 10:
- 10+5
- 24-15
- How would the floating-point number -43232.1234 be represented internally within the computer in a floating-point data type?
For Q#12-22, determine the most appropriate data type to use for a variable to represent the data, and then give the C#.NET declaration required for the variable.
- A variable "Phone" which will take on values of a users phone number (including hyphen's, as in 225-578-5374).
- A variable that can take on values from -10 to 100.
- A variable that can take on values from 0 to 100000.
- A variable "Acquired" which will hold the value of the date a painting is acquired by a museum.
- A variable "Cost" which will be used for financial calculations (representing dollar amounts down to the cent).
- A variable "IsFullTime" which will represent whether a student is or is not currently a full-time student.
- A variable "Quantity" which will only numeric integer values between 0 and 10000.
- A variable "Force" which must be able to take on values of magnitude as large as 100E+100 with at least 10 decimal positions of precision.
- A variable that can represent the US government's current national debt (in integer dollars).
- A variable that can take on values of people's family names.
- A variable that can take on any integer, real, date, or string value.
- Write the C# statement to declare integer X, double Y, and date Z on one line.
- Write the C# statement to declare a string S with initial value "Geaux LSU!".
- You are writing a program that needs to use Euler's Constant (0.57721566). Indicate how you would declare this value in C#.
For Q#26-32, evaluate the C# assignment statements and give the final resulting value assigned to the left-hand-side variable.
- int N = Convert.ToInt32(18.5);
- int X = Math.Ceiling(43 % 4 + Math.Pow(14.3, 3) / 70 1000 * Math.PI / 5 );
- string Y ="20"+"14";
- double A = Math.Floor(5 - 12.74);
- double A = Math.Round(5 1.74);
- double A = Math.Round(5 - 1.74 , 1) ;
- int X = 2; X*=X+4;
- Evaluate the following C# assignment statement and give the resulting value assigned to the left-hand-side variable:
int x1 = Convert.ToInt32(Math.Ceiling(43 % 6 + 23 / Math.Pow(2,7) - 1000 / 26 ));
- Find the final value of X:
int X=0, N=0;
Single M = (Single) 42.3;
N = 3;
X = Convert.ToInt32(X + Math.Pow((M / N), N) + Math.Log(M) / Math.Pow(8.3, 2.0) + 12 * M);
- Given that double X=4.5, Y=3.2, Z=1 and Boolean B=False, evaluate each of the following Boolean expression:
X<=5 | ((Z/2) > 1 & ! B)
- Given: int A = 3, B=5; double C=3.14; string S = "123"; object R=4.32; Indicate if the following assignments are correct or, if not, correct them with any needed conversions and/or typecasts. For each, assume the variable values given above, not the values from the previous subparts.
- C = A;
- A = C;
- A = S;
- C = R;
- Write a console program to calculate the number of square feet of shingles needed to cover a gable (upside down V) roof. From the user, read in a) the length of the roof, b) the width of the roof, and c) the rise (number of feet roof rises vertically for every foot horizontally). To simplify, assume there are no eaves (overhang).
- Repeat the previous problem using Python.
Please answer however many question you know, it doesn't have to be all of them! Thanks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started