Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

  1. 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:
    1. 10+5
    2. 24-15
  2. 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.

  1. A variable "Phone" which will take on values of a users phone number (including hyphen's, as in 225-578-5374).
  2. A variable that can take on values from -10 to 100.
  3. A variable that can take on values from 0 to 100000.
  4. A variable "Acquired" which will hold the value of the date a painting is acquired by a museum.
  5. A variable "Cost" which will be used for financial calculations (representing dollar amounts down to the cent).
  6. A variable "IsFullTime" which will represent whether a student is or is not currently a full-time student.
  7. A variable "Quantity" which will only numeric integer values between 0 and 10000.
  8. 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.
  9. A variable that can represent the US government's current national debt (in integer dollars).
  10. A variable that can take on values of people's family names.
  11. A variable that can take on any integer, real, date, or string value.
  12. Write the C# statement to declare integer X, double Y, and date Z on one line.
  13. Write the C# statement to declare a string S with initial value "Geaux LSU!".
  14. 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.

  1. int N = Convert.ToInt32(18.5);
  2. int X = Math.Ceiling(43 % 4 + Math.Pow(14.3, 3) / 70 1000 * Math.PI / 5 );
  3. string Y ="20"+"14";
  4. double A = Math.Floor(5 - 12.74);
  5. double A = Math.Round(5 1.74);
  6. double A = Math.Round(5 - 1.74 , 1) ;
  7. int X = 2; X*=X+4;
  1. 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 ));

  1. 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);

  1. 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)

  1. 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.
    1. C = A;
    2. A = C;
    3. A = S;
    4. C = R;
  2. 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).
  1. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions