Friday, June 5, 2015

Kegiatan Bersih-bersih Hari 4

Nama: Vina Melinda
NIM: 1801380106
Tanggal kegiatan: 4 Juni 2015
Lokasi kegiatan: Print Screen (Ruko Palmyra Square 25A no.17, Ruko Jalur Sutera, Alam Sutera, Tangerang)

Tujuan kegiatan: Membantu membersihkan keadaan toko dengan mengepel, menyapu, mengelap kaca.

Hari ini merupakan hari keempat, dimana juga merupakan hari terakhir dari semua kegiatan bersih-bersih yang telah kami lakukan, pada kali ini kami kembali ke Print Screen untuk membersihkan toko tersebut
Seperti biasa tempat ini tidak terlalu kotor semua tertata rapi, kami pun juga berbagi tugas untuk membersihkan tempat ini seperti mengepel, mengelap dan menyapu.

Kelompok kami melakukan kegiatan seperti biasa, yaitu membersihkan kaca pintu, menyapu nagiam luar dan dalam toko serta mengepel bagian dalam toko. Seperti biasa tidak membutuhkan waktu lama untuk membersihkan tempat ini, setelah kegiatan selesai, kamipun hendak berterima kasih kepada para pegawai yang telah mengizinkan kami dalam melakukan kegiatan ini.



Thursday, June 4, 2015

Kegiatan Bersih-bersih Hari 3

Nama: Vina Melinda
NIM: 1801380106
Tanggal kegiatan: 3 Juni 2015
Lokasi kegiatan: Bakmi Bintang Gading (Ruko Palmyra Square Blok 25A No. 21 (Telaga Alam Sutera), Tangerang)


Tujuan kegiatan: Membantu membersihkan keadaan ditoko dengan menyapu, mengepel, mengelap, menata meja dan kursi.

Hari ketiga ini kami memutuskan untuk kembali membersihan restoran Bakmi Bintang Gading, kami pun kembali mengecek keadaan restoran, walaupun tidak separah sebelumnya tetapi sampah berserakan dimana-mana, meja berminyak, kursi tidak tertata rapi.
Kelompok kami kembali bergotong royong dalam membersihkan restoran dan berbagi tugas, ada yang mengepel, mengelap kaca, menata kursi, mengelap meja dan menyapu.
Tidak memerlukan waktu lama untuk membersihkan tempat tersebut karena keadaan restoran tidak terlalu kotor.




Pada akhirnya kami mengucapkan terima kasih kepada pegawai karena telah mengizinkan kami untuk membersihkan restoran tersebut.

Wednesday, June 3, 2015

Kegiatan Bersih-bersih Hari 2

Nama: Vina Melinda
NIM: 1801380106
Tanggal Kegiatan: 1 Juni 2015
Lokasi kegiatan: Print Screen (Ruko Palmyra Square 25A No.17, Ruko Jalur Sutera, Alam Sutera, Tangerang)


Tujuan kegiatan: Membantu membersihkan keadaan didalam toko dan diluar toko, menyapu, mengepel dan mengelap kaca pintu.

Keadaan toko ini tidak terlalu kotor sehingga kami tidan membutuhkan waktu yang lama untuk membersihkan toko ini, tempat ini sangat terjaga kebersihannya, kami merasa puas karena pegawai setempat juga bertanggung jawab dalam kegiatan kebersihan.



Tuesday, June 2, 2015

Kegiatan Bersih-bersih Hari 1

Nama: Vina Melinda
NIM: 1801380106
Tanggal kegiatan: 29 Mei 2015
Lokasi kegiatan: Bakmi Bintang Gading (Ruko Palmyra Square Blok 25A No. 21 (Telaga Alam Sutera), Tangerang)

Tujuan kegiatan: Membantu pegawai dalam membersihkan keadaan restoran, dengan menyapu, mengelap, mengepel dan mengatur meja serta kursi restoran.
Keadaan awal toko adalah terdapat banyak sampah berserakan serta kursi tidak tertata rapi, keadaan meja restoran pun masih berminyak walaupun telah dilap oleh pegawai restoran yang bertanggung jawab.

Kami pun berinisiatif untuk membersihkan restoran dengan meminta izin terlebih dahulu, kami pun sebenarnya sering pergi ke restoran itu sehingga pegawai dengan senang hati memberikan izin kepada kelompok kami untuk membersihkan restoran.

Sebelum memulai kegiatan, kelompok kami memutuskan untuk membeli perlengkapan berish-bersih terlebih dahulu di supermarket terdekat. Setelah itu kami bergotong royong memberishkan restoran,ada yang mengelap meja, menyapu, mengelap kaca pintu dan mengepel.
Setelah selesai melakukan kegiatan ternyata kami disuguhi teh manis oleh pegawai secara gratis, kami pun merasa sangat senang.


Tuesday, March 17, 2015

Run for Leprosy 2015


Event Run for Leprosy ini diadakan pada Minggu, 15 Maret 2015 merupakan bentuk kepedulian masyarakat terhadap penderita penyakit kusta, merupakan charity event yang diadakan oleh Teach for Indonesia (TFI) yang bekerja sama dengan BINUS University.


Kesan dan Pesan setelah mengikuti event Run for Leprosy:
Saya termotivasi untuk hidup lebih sehat lagi, lebih peduli akan keadaan lingkungan sekitar, saya juga belajar untuk lebih menghargai hidup, berusaha untuk menjalani. hidup dengan lebih semangat lagi dengan mebawa harapan untuk mencapai masa depan yang lebih cerah nantinya. Acara ini sangat membantu untuk meningkatkan kepedulian diri dan lingkungan, saya mengalami banyak perubahan nyata.





Pengetahuan Tentang Penyakit Kusta:
          Kusta termasuk penyakit tertua. Kata kusta Berasal dari bahasa india Khusta dikenal sejak 1400 tahun sebelm masehi. Kata lepra ada disebut-sebut dalam kitab injil, terjemahan dari bahasa Hebrew Zaraath, yang sebenarnya mencakup beberapa kulit lainya. Ternyata bahwa berbagai deskriptip mengenai penyakit inisangat kabur, apalagi jika dibandingkan dengan kusta yang kita kenal sekarang ini.
         Kusta atau lepra merupakan penyakit yang menyerang sel saraf tepi, dan organ tubuh dalam jangka panjang mengakibatkan sebagian anggota tubuh penderita tidak dapat berfungsi dengan normal. kusta disebabkan oleh bakteri tahan yang  asam, gram positif, yaiu micobakterium Leprae. Penularan kusta dapt terjadi melalui kontak langsung dengan penderita dan udara pernafasan. Namun hal ini tergantung dari imunitas tubuh individu. Jika imunitas tinggi kemungkinana untuk menderita penyakit ini sangat jarang.
         Banyak masyarakat yang beranggapan bahwa penyakit kusta hanyalah sekedar sejarah kelam masa lalu. Kenyataannya tidak seperti anggapan  banyak orang,  penderita penyakit kusta di Indonesia justru meningkat.  Tantangan lain yang tidak kalah beratnya adalah aspek sosial psikologis yang ditanggung oleh para penderita penyakit kusta. Mereka mendapat stigma, dan kemudian menjadi korban tindakan diskriminatif, dikucilkan dari pergaulan sosial, dan sulit memasuki lapangan kerja secara fair.
        Selain itu, banyak masyarakat yang beranggapan bahwa penyakit kusta adalah kutukan dari Tuhan Yang maha Esa atas dosa-dosa yang pernah dibuat, dan kutukan itu diyakini dapat mendatangkan bencana. Penderita kusta terisolisasi dan dikucilkan dari masyarakat luas.  Bahkan,  mereka tidak diakomodir dengan baik oleh masyarakat umum dan juga beberapa instansi.  Mereka dianggap sebagai orang yang perlu dikasihani atau bahkan dihindari dalam artian tidak diberikan kesempatan untuk berapresiasi dalam hidup mereka. Kurangnya kesadaran dari penderita kusta untuk berobat juga merupakan alasan meningkatnya kusta di Indonesia.  Dan juga kurang sosialisasi dari tenaga kesehatan untuk memberikan pengetahuan kepada penderita kusta dan masyarakat yang sehat.




Komitmen terhadap penyakit Kusta:
1. Tidak mengucilkan penderita kusta.
2. Merangkul penderita kusta agar mereka dapat menyesuaikan diri terhadap longkungan.
3. Menghargai penderita kusta itu sendiri.
4. Meningkatkan kesadaran akan penyakit kusta itu sendiri.


Saran mengenai bentuk sosialisai yang baik untuk penyakit kusta:
1. Melakukan sosialisasi pada penduduk setempat.
2. Melakukan kampanye.
3. Melakukan event sejenis untuk penderita penyakit kusta, saya kira akan sangat membantu para penderita.






Tuesday, February 3, 2015

Q&A Assignment #16 Chapter 14 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106


Untuk kali ini saya akan menjawab Assignment #16 Problem Set dan Review Questions dari Chapter 14 dari Sebesta.


Review Question:


6. Q: What are the possible frames for exceptions in Ada?
A: The frame of an exception handler in Ada is either a subprogram body, a package body, a task, or a block.

7. Q: Where are unhandled exceptions propagated in Ada if raised in a subprogram?
A block? A package body? A task?
A: If the block or unit in which an exception is raised does not have a handler for that exception, the exception is propagated elsewhere to be handledProcedures – propagate it to the caller
Blocks – propagate it to the scope in which it appears
Package body – propagate it to the declaration part of the unit that declared the package (if it is a library unit, the program is terminated)
Task – no propagation; if it has a handler, execute it; in either case, mark it “completed”.

8. Q: Where does execution continue after an exception is handled in Ada?
A: Control simply continues after the exception clause.

9. Q: How can an exception be explicitly raised in Ada?
A: Exception handlers may be grouped at the end of a block, subprogram body, etc. A handler is any sequence of statements that may end:
- by completing;
- by executing a return statement;
- by raising a different exception (raise e;);
- by re-raising the same exception (raise;).

Suppose that an exception e is raised in a sequence of statements U (a block, subprogram body, etc.).
If U contains a handler for e: that handler is executed, then control leaves U.
If U contains no handler for e: e is propagated out of U; in effect, e is raised at the "point of call” of U.

So the raising of an exception causes the sequence of statements responsible to be abandoned at the point of occurrence of the exception. It is not, and cannot be, resumed.

10. Q: What are the four exceptions defined in the Standard package of Ada?
A: Constraint_Error, Program_Error, Storage_Error, and Tasking_Error.


Problem Set:


6. Q: In languages without exception-handling facilities, it is common to have
most subprograms include an “error” parameter, which can be set to
some value representing “OK” or some other value representing “error
in procedure.” What advantage does a linguistic exception-handling
facility like that of Ada have over this method?
A: There are several advantages of a linguistic mechanism for handling exceptions, such as that found in Ada, over simply using a flag error parameter in all subprograms. One advantage is that the code to test the flag after every call is eliminated. Such testing makes programs longer and harder to read. Another advantage is that exceptions can be propagated farther than one level of control in a uniform and implicit way. Finally, there is the advantage that all programs use a uniform method for dealing with unusual circumstances, leading to enhanced readability.

7. Q: In a language without exception-handling facilities, we could send an
error-handling procedure as a parameter to each procedure that can
detect errors that must be handled. What disadvantages are there to this
method?
A: There are several disadvantages of sending error handling subprograms to other subprograms. One is that it may be necessary to send several error handlers to some subprograms, greatly complicating both the writing and execution of calls. Another is that there is no method of propagating exceptions, meaning that they must all be handled locally. This complicates exception handling, because it requires more attention to handling in more places.

8. Q: Compare the methods suggested in Problems 6 and 7. Which do you
think is better and why?
A: When an exception occurs, the normal flow of execution is abandoned and the exception is handed up the call sequence until a matching handler is found. Any declarative region (except a package specification) can have a handler. The handler names the exceptions it will handle. By moving up the call sequence, exceptions can become anonymous; in this case, they can only be handled be the other handler.

9. Q: Write a comparative analysis of the throw clause of C++ and the
throws clause of Java.
A: Throw statement is used to retrieve the name of the class with the actual parameter, while the throws clause of Java specifies that exception class or any of its descendant exception classes can be thrown but no handled by the method.

10. Q: Compare the exception-handling facilities of C++ with those of Ada.
Which design, in your opinion, is the most flexible? Which makes it possible
to write more reliable programs?
A: Features introduced in C++ include declarations as statements, function-like casts, new/delete, bool, reference types, const,inline functions, default arguments, function overloading,namespaces, classes (including all class-related features such as inheritance, member functions, virtual functions, abstract classes, and constructors), operator overloading, templates, the:: operator, exception handling, run-time type identification, and more type checking in several cases. Comments starting with two slashes ("//") were originally part of BCPL, and were reintroduced in C++. Several features of C++ were later adopted by C, including const, inline, declarations in for loops, and C++-style comments (using the // symbol).

Monday, January 26, 2015

Q&A Assignment #15 Chapter 13 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106


Untuk kali ini saya akan menjawab Assignment #15 Problem Set dan Review Questions dari Chapter 13 dari Sebesta.


Review Question:


6. Q: Describe the logical architecture of a vector processor.
A: Vector processor have groups of registers that store the operands of a vector operation in which the same instruction is executed on the whole group of operands simultaneously. Originally, the kinds of programs that could most benefit from this architecture were in scientific computation, an area of computing that is often the target of multiprocessor machines.

7. Q: What is the difference between physical and logical concurrency?
A: Physical concurrency is a multiple independent processors (multiple threads of control). While logical concurrency is the appearance of physical concurrency is presented by time-sharing one processor (software can be designed as if there were multiple threads of control)

8. Q: What is a thread of control in a program?
A: A thread of control in a program is the sequence of program points reached as control flows through the program.

9. Q: Why are coroutines called quasi-concurrent?
A: They are called quasi-concurrent because they have a single thread of control.

10. Q: What is a multithreaded program?
A: A multi-threaded program is a program designed to have more than one thread of control.


Problem Set:


6. Q: Suppose two tasks, A and B, must use the shared variable Buf_Size. Task A adds 2 to Buf_Size, and task B subtracts 1 from it. Assume that such arithmetic operations are done by the three-step process of fetching the current value, performing the arithmetic, and putting the new value back. In the absence of competition synchronization, what sequences of events are possible and what values result from these operations? Assume that the initial value of Buf_Size is 6.
A: The add and subtract operations are not atomic and could be interrupted in mid-operation when the other task could then run. If A runs to completion, then B runs to completion, Buf_Size has the value 7 (6 + 2 – 1). Similarly if B runs to completion then A runs to completion. If A or B get interrupted in the middle of adding or subtracting, then whichever task finishes last will determine the value in Buf_Size. If A runs but is interrupted after it fetches Buf_Size but before it stores the modified value (allowing B to fetch Buf_Size), or if B runs first and is interrupted after the fetch but before the store, allowing A to fetch Buf_Size, then if A finishes last Buf_Size will have value 8, and if B finishes last Buf_Size will have value 5.

7. Q: Compare the Java competition synchronization mechanism with that of Ada.
A: Java methods (but not constructors) can be specified to be synchronized. A synchronized method called through a specific object must complete its execu- tion before any other synchronized method can run on that object. Competition synchronization on an object is implemented by specifying that the methods that access shared data are synchronized. The competition synchronization mechanism of the Ada Language is intended to provide a facility for tasks to synchronize their actions.

8. Q: Compare the Java cooperation synchronization mechanism with that of Ada.
A: In Java, cooperation synchronization is implemented with the wait, notify, and notifyAll methods, all of which are defined in Object, the root class of all Java classes. Every object has a wait list of all of the threads that have called wait on the object. While in Ada, cooperation synchronization is required between two tasks that when the second task must wait for the first task to finish executing before it may proceed.

9. Q: What happens if a monitor procedure calls another procedure in the same monitor?
A: Implementation of a monitor can be made to guarantee synchronized access by allowing only one access at a time. Calls to monitor procedures are implicitly blocked and stored in a queue if the monitor is busy at the time of the call.

10. Q: Explain the relative safety of cooperation synchronization using semaphores and using Ada’s when clauses in tasks.
A: We need to take steps to make sure that different threads don't interact in negative ways. If one thread is operating on some data or structure, we don't want another thread to simultaneously operate on that same data/structure and corrupt the results; when Thread A writes to a variable that Thread B accesses, we need to make sure that Thread B will actually see the value written by Thread A; we don't want one thread to hog, take or lock for too long a resource that other threads need in order to make progress.

Thursday, January 22, 2015

Q&A Assignment #14 Chapter 12 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106


Untuk kali ini saya akan menjawab Assignment #14 Problem Set dan Review Questions dari Chapter 12 dari Sebesta.


Review Question:


6. Q: Describe a situation where dynamic binding is a great advantage over its absence.
A: Consider the following situation: There is a base class, A, that defines a method draw that draws some figure associated with the base class. A second class, B, is defined as a subclass of A. Objects of this new class also need a draw method that is like that provided by A but a bit different because the subclass objects are slightly different. So, the subclass overrides the inherited draw method. If a client of A and B has a variable that is a reference to class A’s objects, that reference also could point at class B’s objects, making it a polymorphic reference. If the method draw, which is defined in both classes, is called through the polymorphic reference, the run-time system must determine, during execution, which method should be called, A’s or B’s.

7. Q: What is a virtual method?
A: A virtual method is a declared class method that allows overriding by a method with the same derived class signature. Virtual methods are tools used to implement the polymorphism feature of an object-oriented language, such as C#. When a virtual object instance method is invoked, the method to be called is determined based on the object's runtime type, which is usually that of the most derived class.

8. Q: What is an abstract method? What is an abstract class?
A: An abstract method is a method which all descendant classes should have. An abstract class is a class which has abstract method.

9. Q: Describe briefly the eight design issues used in this chapter for objectoriented languages.
A: 1. What non-objects are in the language?
2.Are Subclasses Subtypes? If so, derived objects can be legally used wherever a parent object could be used.
3. Type Checking and Polymorphism
4. Single and Multiple Inheritance. Inherit from 1 (or more than 1) parent.
5. Object Allocation and Deallocation. Are objects allocated from heap or stack.
6. Dynamic and Static Binding. When are messages bound to methods, before or during run-time?
7. Nested Classes. Can a class be nested inside another class?
8. Initialization of Objects. Are objects initialized when created? Implicit or explicit?

10. What is a nesting class?
A: A nesting class is a class defined inside another class.


Problem Set:


6. Q: Compare the multiple inheritance of C++ with that provided by interfaces in Java.
A: C++ inheritance is implementation inheritance. That is, a class inheriting from two of more superclasses actually inherits the code from those classes. Java’s interface mechanism is an interface inheritance. That is, a class implementing two or more interfaces simply inherits (and must provide its own implementations for) the methods of the interface.

7. Q:What is one programming situation where multiple inheritance has a significant advantage over interfaces?
A: Interface just carry "method signatures", whereas classes carry actual behaviour. Multiple inheritance greatly helps to reduce boilerplate code.

8. Q: Explain the two problems with abstract data types that are ameliorated by inheritance.
A: The problems solved are reusability of code and "extensibility". Reusability because one won't have to copy/paste his code from one data type to another, allowing for a greater readability. Extensibility because a method can accept a certain class as an argument, and get a child class of this one. This will allow the user to have a wider set of functionality, but the method will still be able to know that the entities it relies on are present.

9. Q: Describe the categories of changes that a subclass can make to its parent class.
A: Subclasses can add things (variables, methods). Subclass in C++ can effectively remove a method using "private" inheritance. Inherited methods can be overridden.

10. Q: Explain one disadvantage of inheritance.
A: Subclass is dependent upon its base class (which might change over time). Means one cannot be used independent of each other.

Tuesday, January 13, 2015

Q&A Assignment #13 Chapter 11 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #13 Problem Set dan Review Questions dari Chapter 11 dari Sebesta.


Review Question:


6. Q: Explain how information hiding is provided in an Ada package.
A: Data type representations can appear in the package specification but be hidden from clients by putting them in the private clause of the package. The abstract type itself is defined to be private in the public part of the package specification. Private types have built-in operations for assignment and comparison for equality and inequality.

7. Q: To what is the private part of an Ada package specification visible?
A:  The representation of the type appears in a part of the specification called the private part, which is introduced by the reserved word private. The private clause is always at the end of the package specification. The private clause is visible to the compiler but not to client program units.

8. Q: What is the difference between private and limited private types
in Ada?
A: Types that are declared to be private are called private types. Private data types have built-in operations for assignment and comparisons for equality and inequality. Any other operation must be declared in the package specification. An alternative to private types is a more restricted form: limited private types. Nonpointer limited private types are described in the private section of a package specification, as are nonpointer private types. The only syntactic difference is that limited private types are declared to be limited private in the visible part of the package specification. that defined the type.

9. Q: What is in an Ada package specification? What about a body package?
A: The encapsulating constructs in Ada are called packages. A package can have two parts, each of which is also is called a package. These are called the package specification, which provides the interface of the encapsulation (and perhaps more), and the body package, which provides the implementation of most, if not all, of the entities named in the associated package specification.


10. Q: What is the use of the Ada with clause?
A: The with clause makes the names defined in external packages visible; in this case Ada.Text_IO, which provides functions for input and output of text.



Problem Set:


6. Q: Discuss the advantages of C# properties, relative to writing accessor
methods in C++ or Java.
A: One of the advantages of C# properties relative writing accessor methods in C++ or Java is it can control access to the fields

7. Q: Explain the dangers of C’s approach to encapsulation.
A: The main problem is that the biggest part of encapsulation is done via hiding, rather than protection. This is achieved through definition hiding: a header file is preprocessed (which is a synonym for copy-pasted) into the implementation file. Anyone with this header file will be able to access any method or public variable of a the client related to the header, left apart any "static" method / variable.

8. Q: Why didn’t C++ eliminate the problems discussed in Problem 7?
A: Because in C++ these problems can be handled by allowing nonmember functions to be “friends” of a class. Friend functions have access to the private entities of the class where they are declared to be friends. However, it didn't eliminate the problem because it evolved from C. Hence, it kept a lot of backward compatibility, and the same way of doing basic things. While some problems where solved (like the protected access, which is in-between normal and static in C), some stay, as the symbol access using wrong datatype (inherent to the linker, which doesn't do type-checking).

9. Q: What are the advantages and disadvantages of the Objective-C approach to syntactically distinguishing class methods from instance methods?
A: Instance methods use an instance of a class, whereas a class method can be used with just the class name. A class is like the blueprint of a house: You only have one blueprint and (usually) you can't do that much with the blueprint alone. An instance (or an object) is the actual house that you build based on the blueprint: You can build lots of houses from the same blueprint. You can then paint the walls a different color in each of the houses, just as you can independently change the properties of each instance of a class without affecting the other instances.

10. Q: In what ways are the method calls in C++ more or less readable than
those of Objective-C?
A: In Objective C, all method calls are essentially virtual. This makes it a bit easier on the programmer, but it comes at a possible performance decrease. Hence sometimes methods call in C++ can be more or less readable than those of Objective-C.

Monday, January 5, 2015

Q&A Assignment #12 Chapter 10 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #12 Problem Set dan Review Questions dari Chapter 10 dari Sebesta.


Review Question:


6. Q: What is the difference between an activation record and an activation
record instance?
A: An activation record is the format, or layout, of the moncode part of a subprogram, whereas an activation record instance is a concrete example of an activation record, a collection of data in the form of an activation record.

7. Q: Why are the return address, dynamic link, and parameters placed in the
bottom of the activation record?
A: because the entried must appear first.

8. Q: What kind of machines often use registers to pass parameters?
A: RISC machines, parameters are passed in registers.

9. Q: What are the two steps in locating a nonlocal variable in a static-scoped
language with stack-dynamic local variables and nested subprograms?
A:

10. Q: Define static chain, static_depth, nesting_depth, and chain_offset.
A:


Problem Set:

6. Q: Although local variables in Java methods are dynamically allocated at the
beginning of each activation, under what circumstances could the value
of a local variable in a particular activation retain the value of the previous
activation?
A: If the variable is declared as static. Static modifier is a modifier that makes a variable history – sensitive.

7. Q: It is stated in this chapter that when nonlocal variables are accessed in a
dynamic-scoped language using the dynamic chain, variable names must
be stored in the activation records with the values. If this were actually
done, every nonlocal access would require a sequence of costly string
comparisons on names. Design an alternative to these string comparisons
that would be faster.
A: Using approach that uses an auxiliary data structure called a display. Or, to write variable names as integers. These integers act like an array. So when the activation happens, the comparisons will be faster.

8. Q: Pascal allows gotos with nonlocal targets. How could such statements
be handled if static chains were used for nonlocal variable access? Hint:
Consider the way the correct activation record instance of the static parent
of a newly enacted procedure is found (see Section 10.4.2).
A: Based on the hint statement, the target of every goto in a program could be represented as an address and a nesting_depth, where the nesting_depth is the difference between the nesting level of the procedure that contains the goto and that of the procedure containing the target. Then, when a goto is executed, the static chain is followed by the number of links indicated in the nesting_depth of the goto target. The stack top pointer is reset to the top of the activation record at the end of the chain.

9. Q: The static-chain method could be expanded slightly by using two static
links in each activation record instance where the second points to the
static grandparent activation record instance. How would this approach
affect the time required for subprogram linkage and nonlocal references?
A: Including two static links would reduce the access time to nonlocals that are defined in scopes two steps away to be equal to that for nonlocals that are one step away. Overall, because most nonlocal references are relatively close, this could significantly increase the execution efficiency of many programs.

10. Q: Design a skeletal program and a calling sequence that results in an activation
record instance in which the static and dynamic links point to different
activation-recorded instances in the run-time stack.
A:
\emph{Answer}:\\
procedure Main\_2 is\\
\verb+ + X : Integer;\\
\verb+ +procedure Bigsub is\\
\verb+ +\verb+ + A, B, C : Integer;\\
\verb+ +\verb+ + procedure Sub1 is\\
\verb+ +\verb+ +\verb+ + A, D : Integer;\\
\verb+ +\verb+ +\verb+ + begin -- of Sub1\\
\verb+ +\verb+ +\verb+ + A := B + C; $\longleftarrow$ 1\\
\verb+ +\verb+ +\verb+ + ...\\
\verb+ + end; -- of Sub1\\
\verb+ + procedure Sub2(X : Integer) is\\
\verb+ +\verb+ + B, E : Integer;\\
\verb+ +\verb+ + procedure Sub3 is\\
\verb+ +\verb+ +\verb+ + C, E : Integer;\\
\verb+ +\verb+ +\verb+ + begin -- of Sub3\\
\verb+ +\verb+ +\verb+ + ...\\
\verb+ +\verb+ +\verb+ + Sub1;\\
\verb+ +\verb+ +\verb+ + ...\\
\verb+ +\verb+ +\verb+ + E := B + A; $\longleftarrow$ 2\\
\verb+ +\verb+ + end; -- of Sub3\\
\verb+ +\verb+ + begin -- of Sub2\\
\verb+ +\verb+ + ...\\
\verb+ +\verb+ + Sub3;\\
\verb+ +\verb+ + ...\\
\verb+ +\verb+ + A := D + E; $\longleftarrow$ 3\\
\verb+ + end; -- of Sub2\\
\verb+ + begin -- of Bigsub\\
\verb+ +\verb+ + ...\\
\verb+ +\verb+ + Sub2(7);\\
\verb+ +\verb+ + ...\\
\verb+ + end; -- of Bigsub\\
begin -- of Main\_2\\
\verb+ + ...\\
\verb+ + Bigsub;\\
\verb+ + ...\\
end; -- of Main\_2\\
\\
The sequence of procedure calls is:\\
Main\_2 calls Bigsub\\
Bigsub calls Sub2\\
Sub2 calls Sub3\\
Sub3 calls Sub1\\
\\
The activation records with static and dynamic links is as follows:\\
\begin{figure}
\centering
\includegraphics[scale=0.5]{ari}

\end{figure}