Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Pick one of the following languages: Python, Modula, Ada, C#, or Perl. After con

ID: 3580928 • Letter: P

Question

Pick one of the following languages: Python, Modula, Ada, C#, or Perl. After consulting an authoritative reference, discuss each of the following requirements for that language: (a) Declaration before use. (b) Overloading of operators for programmer-defined types. (c) Binding time of array size. (d) What constitutes a scope? (e) Location of a declaration within a scope. How does a decimal value waste memory space? Assume the following JavaScript program was interpreted using static-scoping rules. What value of x is displayed in function sub 1? Under dynamic-scoping rules, what value of x is displayed in function sub 1? var x; function sub1() {document.write("x = " + x + "");} function sub2() {var x; x = 10; sub1();} x = 5; sub2();

Explanation / Answer

6) Here I am describing these in context of c++

1) Declaration before use : As there are rules for name look up and which are sorted by declare before use rule, suppose you have two functions written in a header file and they also call each other so to resolve the conflict which one to be picked up its better to declare one of them as per your requirement beforehand.

2) What constitute of scope - Scope is the like area till where a particular function/variable can be used and called like local scope variable can only use where it is defined like inside a function.

3) Location of declaration within a scope - It’s like local scope so it could be declared inside function, class variable location of their declaration is inside class , mostly the first thing declared and then global , location is after including header files.