Session 4 - GSLC
Saturday, 14 october 2017
Today is the fourth session of Programming Language Concept and it's GSLC. Miss gave us assignment to answer some questions for this GSLC. The questions are :
1. What are the advantages and disadvantages of decimal data types?
2. How does a decimal value waste memory space?
3. In what way is static type checking better than dynamic type checking?
4. What is coercion in programming languages?
5. Explain how coercion rules can weaken the beneficial effect of strong typing?
I searched from many sources on the internet and answered :
1. The advantage is decimal data types allow you to store decimal value accurately while the disadvantage are decimal data types is no exponents are allowed and the reservation in memory is wasteful.
2. Decimal values store numeric information as digits encoded using the four bit binary equivalents, 4-bit per digit for decimal values.
3. Static type checking is when the type of variable is known at compile time instead of at runtime. The static type checking is better because it allows many type errors to be caught early. It result in compiled code that executes more quickly.
4. In most of programming languages, we can convert variable/value into another of a different data type. Data conversions can be done implicitly or explicitly. The implicit conversion is called coercion.
5. Strong typing allows the detection of the misuses of variable. Coercion rules strongly affect strong typing because they can weaken the type error detection ability considerably
No comments:
Post a Comment