In: Computer Science
1. What is the purpose of level numbers in COCOL records?
2.What are design issues for character string types?
3.What are two common problems with pointers?
4.What is a C++ reference type, what is its common use, and why are they better than pointers for formal parameters?
5.What is a type error?
1. The level numbers play a very important role in the programming using COBOL records.The general purpose of level numbers in the COBOL records are:
2. The two most important design issues in the character string types are:
Is it a primitive type or just a special kind of array?
Should the length of strings be static or dynamic.
2. The two most important design issues in the character string types are:
Is it a primitive type or just a special kind of array?
Should the length of strings be static or dynamic?
3. There are some of the problems faced with pointers.The two most common problems with the pointers are explained.One of the common problem with pointers is the dangling pointer, or dangling reference which is a pointer that contains the address of a heap-dynamic variable that has been deallocated. The other common problem with the pointer is a lost heap-dynamic variable which is an allocated heap-dynamic variable that is not longer accessible to the user program, i.e. it hasn’t a pointer. Such variables are called garbage because they are unusable.
4. C++ includes a special kind of pointer type, called a reference type. The C++ reference type variable is a constant pointer that is always implicitly dereferenced and is used primarily for the formal parameters in function definitions.Because a C++ reference type variable is a constant, it must be initialized with the address of some variable in its definition, and after initialization a reference type variable can never be set to reference any other variable.This is the reason why they are better than pointers for formal parameters.
5.Type error is more specific to the Javascript language. TypeError is an object in Javascript that represents an error when any value is not of the expected type.This TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or function.