1 can constants ever be dynamically bound ina Compiled langu


1: can constants ever be dynamically bound ina. Compiled language? Explain.

2: explain the difference between a variables scope and it\'s lifetime.


3: what is the difference between pointer and reference data types? Give an example of a language with pointers and a language with references.


4:
4:

5:

6:
5pts) Python dictionaries are equivalent to associative arrays or hashes in other In general, long would vou, expect it to to element by its the size of the array n? Your answer should be in terms of the order of the time it would take, e.g., O(n), O(og n), etc. Explain your answer.

Solution

2: explain the difference between a variables scope and it\'s lifetime.

sol:

scope is a part of the program for declartion effect
there are different type of scope
=>if it is a local scope then it is visible with in the function
=>if it is a class scope then it is seen by class members
=>if it is a namespace scope then it is available with in namespace
=>if it is gobal scope it is available every where

life time is span of time for variable which a memory valid (it is also know an allocation method)
there are different life times for different ype of variable
=>if it is a static variable it life time up to program exection
=>if it is local variable then its life time with in function execution only
=>if it is dynamic variable its life time ended when it memory is deallocated

3: what is the difference between pointer and reference data types? Give an example of a language with pointers and a language with references.

sol:pointer is a memory address of an variable or an object but a reference is an alias of an object

for example
int chegg =6; //it is an variable
int &students= chegg; // here we are assigning chegg value to the address of the students (here students is alias of chegg)
students=7; //then variable chegg will be also 7

c++ is one of the language which is capable of using both pointer and references

 1: can constants ever be dynamically bound ina. Compiled language? Explain. 2: explain the difference between a variables scope and it\'s lifetime. 3: what is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site