Hello guys, well, it's been a long time since my last post, and when I read it again it's like, LOL. I have said that I want to give some effort to keep this blog alive, but.... It IS already 3 years. so maybe you guys need to wait some time more longer for the next post ! XD. But now, I'm renewing my motivation. I need to write, because I want to share something, and to improving myself. Nowadays I spend a lot of time to play a game, an online game, and it takes a lot of time. And, I have been thinking, I need to include some time to improve myself more.
I need to go back reading again.
Yeah, reading, I used to love reading, when I have the money and go to a bookstore, each book like "BUY ME !, BUY ME !, YOU WILL REGRET IT IF YOU DONT BUY ME!" Aaaaaaanndd, I'm planning to buy just one book, and somehow I have 3 books by I reach the cashier.
That's just one simple example how I love books so much.
One time I was reading Eragon series (It's really good, if you like fiction) I do not realize, I haven't change my position for 6 hours straight, and you guess what ? My body scream in pain after I finished reading.
Now, so much time have passed, not only what I do is changing, now my occupation also changing.
Before I am an university student. Now I am already a fresh graduate seeking for job (unemployed for the moment). There are so much thing, that become a dilemma for me, having nothing to do means I have a lot of free time, but not so productive, but when I come for a job interview, it's like, I'm afraid losing my freedom.
Well, that's enough for now, I will continue this blog eventually, and I will learn much more thing.
See ya. :)
Ryan Dratama's Blog
Thursday, 7 April 2016
Thursday, 7 November 2013
My Second Family
Nah, kenapa sih judulnya itu "My Second Family", kenapa saya tidak tulis, My Family, apa sih maksud dari keluarga kedua itu ? Kalo menurut saya, keluarga kedua itu adalah sebuat komunitas dimana saya diterima dan diakui di dalam komunitas ini, puji Tuhan saya punya sebuah komunitas yang luar biasa yang memberkati saya setiap minggunya.
Komunitas itu bernama PD OMPKK St. Alfonsus ( Persekutuan Doa Orang Muda Pembaharuan Katolik Karismatik St. Alfonsus Rodriguez), nama yang cukup panjang, tetapi tidak masalah karena saya bukan mau menjelaskan tentang nama dari komunitas itu ataupun promosi, disini saya ingin membagikan sebuah sharing dari seorang yang kami undang pada acara persekutuan doa kami, dan sharing itu tentang komunitas, dan terutama komunitas kristiani, bagaimana sebuah komunitas dapat memberkati kita setiap minggunya, kita dapat merasa diterima, dan juga tentuka kita mendapatkan banyak teman.
Sharing ini berasal dari ko Cello, nah di sini saya akan memberi rekaman, kalian dapat mendengarkan sendiri apa aja sih intinya komunitas itu, dan juga ada ringkasan singkat yang saya buat sendiri dari pengajaran ko cello
http://www.4shared.com/mp3/5hVvDnhH/my_second_family_by_ko_cello.html
ini file rekamannya
Berdasarkan dari hukum kasih.
Kita tidak bisa mencintai orang lain, jika kita belum mencintai diri kita sendiri.
Bagaimana ? Kita harus mencintai Allah. Kita harus mengerti isi hati Tuhan
Jika kita mengerti isi hati Allah, maka sesuai kitab kejadian kita "serupa" dengan Allah,
jika kita tidak mengerti karakter dari Allah kita tak bisa mencintai sesama
Bagaimana orang berteman, kalau tidak mengikuti ajaran Yesus kalau sekali disakiti, tidak mau
mengampuni.
Kita harus belajar akan hal ini, agar ketika setiap kita masuk ke keluarga kita, dimanapun
biar menjadi mulus.
Apa yang spesial dari keluarga ?
Apa yang membuat kita mau mengambil bagian dari sebuah keluarga ?
Keluarga merupakan institusi paling tua dan berasal dari Tuhan.
Apa yang membuat keluarga kedua menjadi penting bagi kita juga ?
F A M I L Y :
F = Faith
[inti dari komunitas Kristiani, dimana kita belajar dari Firman, Doa, dan Sahabat kita]
Komunitas merupakan tempat kita dibentuk oleh Tuhan.
Belajar tentang Yesus melalui orang" di sekitar kita
A = Acceptance
[bagaimana kita diterima melalui komunitas]
Kita semua orang berdosa, tidak ada yang sempurna, kita harus menanamkan bahwa,
Allah menciptakan kita dengan berbagai keunikan, berbagai bakat, talenta, karunia
tetapi dari semua ras, golongan, latar belakang, disini kita belajar untuk belajar saling menerima
Dimana kita saling mensupport, mendoakan, meneguhkan.
M = Maturity
[Untuk bergabung dengan komunitas Kristiani diperlukan kedewasaan]
Orang Dewasa = orang yang sanggup merespon segala sesuatu dengan ajaran/firman Tuhan
Kedewasaaan untuk mengampuni, bersikap sesuai ajaran Yesus
Orang yang bisa mengampuni = orang yang dewasa
I = Intimacy
[bagaimana kita belajar mengenal saudara seiman kita di dalam komunitas]
bagaimana kita bisa menolong, mensupport jika kita tak mengenal dengan baik saudara kita
hubungan yang dekat didapat dari komunikasi yang baik
Jangan cuma mau deket ama beberapa orang tertentu, kalau begini bisa terjadi perpecahan
Jangan biarkan status sosial menjadi kendala
"We cannot giving without loving, and loving without giving"
L = Laugh
[We need time to have fun together too, but in the way of God]
kita butuh untuk fellowship dengan satu sama lain
Bagaimana kita membagikan sukacita dengan yang lain
Y = You
Kita [Karena kitalah yang Tuhan panggil untuk melakukan semua itu]
setiap individu dipanggil untuk yang lain
Dan juga terutama karena
Pembaharuan Karismatik Katolik membahas bagaimana kita diperbaharui dengan Roh Allah sehingga kita memancarkan karunia - karunia[karisma] dari Roh Kudus. Dan karunia yang terbesar adalah Kasih.
because we are a Family in God
"True friend, Good Friendship, Make the Future"
Komunitas itu bernama PD OMPKK St. Alfonsus ( Persekutuan Doa Orang Muda Pembaharuan Katolik Karismatik St. Alfonsus Rodriguez), nama yang cukup panjang, tetapi tidak masalah karena saya bukan mau menjelaskan tentang nama dari komunitas itu ataupun promosi, disini saya ingin membagikan sebuah sharing dari seorang yang kami undang pada acara persekutuan doa kami, dan sharing itu tentang komunitas, dan terutama komunitas kristiani, bagaimana sebuah komunitas dapat memberkati kita setiap minggunya, kita dapat merasa diterima, dan juga tentuka kita mendapatkan banyak teman.
Sharing ini berasal dari ko Cello, nah di sini saya akan memberi rekaman, kalian dapat mendengarkan sendiri apa aja sih intinya komunitas itu, dan juga ada ringkasan singkat yang saya buat sendiri dari pengajaran ko cello
http://www.4shared.com/mp3/5hVvDnhH/my_second_family_by_ko_cello.html
ini file rekamannya
Berdasarkan dari hukum kasih.
Kita tidak bisa mencintai orang lain, jika kita belum mencintai diri kita sendiri.
Bagaimana ? Kita harus mencintai Allah. Kita harus mengerti isi hati Tuhan
Jika kita mengerti isi hati Allah, maka sesuai kitab kejadian kita "serupa" dengan Allah,
jika kita tidak mengerti karakter dari Allah kita tak bisa mencintai sesama
Bagaimana orang berteman, kalau tidak mengikuti ajaran Yesus kalau sekali disakiti, tidak mau
mengampuni.
Kita harus belajar akan hal ini, agar ketika setiap kita masuk ke keluarga kita, dimanapun
biar menjadi mulus.
Apa yang spesial dari keluarga ?
Apa yang membuat kita mau mengambil bagian dari sebuah keluarga ?
Keluarga merupakan institusi paling tua dan berasal dari Tuhan.
Apa yang membuat keluarga kedua menjadi penting bagi kita juga ?
F A M I L Y :
F = Faith
[inti dari komunitas Kristiani, dimana kita belajar dari Firman, Doa, dan Sahabat kita]
Komunitas merupakan tempat kita dibentuk oleh Tuhan.
Belajar tentang Yesus melalui orang" di sekitar kita
A = Acceptance
[bagaimana kita diterima melalui komunitas]
Kita semua orang berdosa, tidak ada yang sempurna, kita harus menanamkan bahwa,
Allah menciptakan kita dengan berbagai keunikan, berbagai bakat, talenta, karunia
tetapi dari semua ras, golongan, latar belakang, disini kita belajar untuk belajar saling menerima
Dimana kita saling mensupport, mendoakan, meneguhkan.
M = Maturity
[Untuk bergabung dengan komunitas Kristiani diperlukan kedewasaan]
Orang Dewasa = orang yang sanggup merespon segala sesuatu dengan ajaran/firman Tuhan
Kedewasaaan untuk mengampuni, bersikap sesuai ajaran Yesus
Orang yang bisa mengampuni = orang yang dewasa
I = Intimacy
[bagaimana kita belajar mengenal saudara seiman kita di dalam komunitas]
bagaimana kita bisa menolong, mensupport jika kita tak mengenal dengan baik saudara kita
hubungan yang dekat didapat dari komunikasi yang baik
Jangan cuma mau deket ama beberapa orang tertentu, kalau begini bisa terjadi perpecahan
Jangan biarkan status sosial menjadi kendala
"We cannot giving without loving, and loving without giving"
L = Laugh
[We need time to have fun together too, but in the way of God]
kita butuh untuk fellowship dengan satu sama lain
Bagaimana kita membagikan sukacita dengan yang lain
Y = You
Kita [Karena kitalah yang Tuhan panggil untuk melakukan semua itu]
setiap individu dipanggil untuk yang lain
Dan juga terutama karena
Pembaharuan Karismatik Katolik membahas bagaimana kita diperbaharui dengan Roh Allah sehingga kita memancarkan karunia - karunia[karisma] dari Roh Kudus. Dan karunia yang terbesar adalah Kasih.
because we are a Family in God
"True friend, Good Friendship, Make the Future"
Hi :)
It's already a long time ago since I last posted, actually this blog purpose was to fulfill my university assignment, but now I think, I need to use this blog for something more good, since it already here, I already made it, why I doesn't use it for a better purpose ?
So now i reach my conclusion, I need to do something with this blog, I want to reach a higher level, and now I want to post more, more mystery, and I want to fulfill one more thing, I want to share what I believe all this time, I want to share what I get every week, as a young catholic guy, I want to share my passion about Jesus Christ with more people, so more people get Blessed too !
I don't know I would post regularly or not, but I will keep my best to share what I get, more and more
thanks for visiting, don't forget to visit next time, because more article would fill up this blog.
God Bless.
So now i reach my conclusion, I need to do something with this blog, I want to reach a higher level, and now I want to post more, more mystery, and I want to fulfill one more thing, I want to share what I believe all this time, I want to share what I get every week, as a young catholic guy, I want to share my passion about Jesus Christ with more people, so more people get Blessed too !
I don't know I would post regularly or not, but I will keep my best to share what I get, more and more
thanks for visiting, don't forget to visit next time, because more article would fill up this blog.
God Bless.
Friday, 28 June 2013
Chapter 16 of Concept of Programming Languages
Review Questions :
2.What are the two parts of a compound term?
A compound term is composed of two parts, a functor and an ordered list of parameter
5. What are the antecedents? Consequent?
The right side of a clausal form proposition is called the antecendent. The left side is called the consequent because it is the consequence of the truth antecendent
7. What are the forms of Horn clauses?
Horn clauses can be in only two forms: they have either a single atomic proposition on the left side or an empty left side.
8. What is the basis concept of declarative semantics?
The basic concept of this semantics is that there is a simple way to determine the meaning of each statement, and it does not depend on how the statement might be used to solve a problem
10. What are the three forms of a Prolog term?
A prolog term is a constant, a variable, or a structure
11. What is an uninstantiated variable?
A variable that has not been assigned a value is called uninstantiated
Problem Set :
1. ”All predicate calculus propositions can be algorithmically converted to clausal form”. Is this
statement true or false? Explain
The statement is true. this was proven by Nilsson (1971) by using a simple conversion algorithm
2. Describe how a logic programming language is different from a general programming language
Logical programming language uses a form of symbolic logic, the syntax of logic programming logic is remarkably different from that of the imperative and functional languages.
2.What are the two parts of a compound term?
A compound term is composed of two parts, a functor and an ordered list of parameter
5. What are the antecedents? Consequent?
The right side of a clausal form proposition is called the antecendent. The left side is called the consequent because it is the consequence of the truth antecendent
7. What are the forms of Horn clauses?
Horn clauses can be in only two forms: they have either a single atomic proposition on the left side or an empty left side.
8. What is the basis concept of declarative semantics?
The basic concept of this semantics is that there is a simple way to determine the meaning of each statement, and it does not depend on how the statement might be used to solve a problem
10. What are the three forms of a Prolog term?
A prolog term is a constant, a variable, or a structure
11. What is an uninstantiated variable?
A variable that has not been assigned a value is called uninstantiated
Problem Set :
1. ”All predicate calculus propositions can be algorithmically converted to clausal form”. Is this
statement true or false? Explain
The statement is true. this was proven by Nilsson (1971) by using a simple conversion algorithm
2. Describe how a logic programming language is different from a general programming language
Logical programming language uses a form of symbolic logic, the syntax of logic programming logic is remarkably different from that of the imperative and functional languages.
Chapter 15 of Concept of Programming Languages
Review Questions
2. What does a lambda expression specify?
The predicate function is often given as a lambda expression, which in ML is defined exactly like a function, except with the fn reserved word, instead of fun, and of course the lambda expression is nameless.
5. Explain why QUOTE is needed for a parameter that is a data list.
To avoid evaluating a parameter, it is first given as a parameter to the primitive function QUOTE, which simply returns it without change.
6. What is a simple list?
A list which membership of a given atom in a given list that does not include sublists.
7. What does the abbreviation REPL stand for?
REPL stand for read-evaluate-print loop.
11. What are the two forms of DEFINE?
The simplest form of DEFINE is one used to bind a name to the value of an expression. This form is
(DEFINE symbol expression)
The general form of such a DEFINE is
(DEFINE (function_name parameters)
(expression)
)
13. Why are CAR and CDR so named?
The names of the CAR and CDR functions are peculiar at best. The origin of these names lies in the first implementation of LISP, which was on an IBM 704 computer. The 704’s memory words had two fields, named decrement and address, that were used in various operand addressing strategies. Each of
these fields could store a machine memory address. The 704 also included two machine instructions, also named CAR (contents of the address part of a register) and CDR (contents of the decrement part of a register), that extracted the associated fields. It was natural to use the two fields to store the two pointers
of a list node so that a memory word could neatly store a node. Using these conventions, the CAR and CDR instructions of the 704 provided efficient list selectors. The names carried over into the primitives of all dialects of LISP.
18. What is tail recursion? Why is it important to define functions that use recursion to specify repetition to be tail recursive?
A function is tail recursive if its recursive call is the last operation in the function. This means that the return value of the recursive call is the return value of the nonrecursive call to the function. It is important to specify repetition to be tail recursive because it is more efficient(increase the efficiency).
19. Why were imperative features added to most dialects of LISP?
LISP began as a pure functional language but soon acquired some important imperative features to increased its execution efficiency.
26. What is type inferencing, as used in ML?
Type inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstruction.
29. What is a curried function?
Curried functions a function which a new functions can be constructed from them by partial evaluation.
30. What does partial evaluation mean?
Partial evaluation means that the function is evaluated with actual parameters for one or more of the leftmost formal parameters.
32. What is the use of the evaluation environment table?
A table called the evaluation environment stores the names of all implicitly and explicitly declared identifiers in a program, along with their types. This is like a run-time symbol table.
33. Explain the process of currying.
The process of currying replaces a function with more than one parameter with a function with one parameter that returns a function that takes the other parameters of the initial function.
_______________________________________________________________________________________________________________________________
Problem Set
2 . Give a general form of function declaration in ML.
Function declarations in ML appear in the general form
fun function_name(formal parameters) = expression;
4. Refer to a book on Haskell programming and discuss the features of Haskell.
Haskell features lazy evaluation, pattern matching, list comprehension, type classes, and type polymorphism.
8. How is the functional operator pipeline (|>) used in F#?
The pipeline operator is a binary operator that sends the value of its left operand, which is an expression, to the last parameter of the function call, which is the right operand.
9. What does the following Scheme function do?
(define (y s lis)
(cond
((null? lis) ‘() )
((equal? s (car lis)) lis)
(else (y s (cdr lis)))
))
y returns the given list with leading elements removed up to but not including the first occurrence of the first given parameter.
10. What does the following Scheme function do?
(define (x lis)
(cond
((null? lis) 0)
((not (list? (car lis)))
(cond
((eq? (car lis) #f) (x (cdr lis)))
(else (+ 1 (x (cdr lis))))))
(else (+ (x (car lis)) (x (cdr lis))))
x returns the number of non-NIL atoms in the given list.
2. What does a lambda expression specify?
The predicate function is often given as a lambda expression, which in ML is defined exactly like a function, except with the fn reserved word, instead of fun, and of course the lambda expression is nameless.
5. Explain why QUOTE is needed for a parameter that is a data list.
To avoid evaluating a parameter, it is first given as a parameter to the primitive function QUOTE, which simply returns it without change.
6. What is a simple list?
A list which membership of a given atom in a given list that does not include sublists.
7. What does the abbreviation REPL stand for?
REPL stand for read-evaluate-print loop.
11. What are the two forms of DEFINE?
The simplest form of DEFINE is one used to bind a name to the value of an expression. This form is
(DEFINE symbol expression)
The general form of such a DEFINE is
(DEFINE (function_name parameters)
(expression)
)
13. Why are CAR and CDR so named?
The names of the CAR and CDR functions are peculiar at best. The origin of these names lies in the first implementation of LISP, which was on an IBM 704 computer. The 704’s memory words had two fields, named decrement and address, that were used in various operand addressing strategies. Each of
these fields could store a machine memory address. The 704 also included two machine instructions, also named CAR (contents of the address part of a register) and CDR (contents of the decrement part of a register), that extracted the associated fields. It was natural to use the two fields to store the two pointers
of a list node so that a memory word could neatly store a node. Using these conventions, the CAR and CDR instructions of the 704 provided efficient list selectors. The names carried over into the primitives of all dialects of LISP.
18. What is tail recursion? Why is it important to define functions that use recursion to specify repetition to be tail recursive?
A function is tail recursive if its recursive call is the last operation in the function. This means that the return value of the recursive call is the return value of the nonrecursive call to the function. It is important to specify repetition to be tail recursive because it is more efficient(increase the efficiency).
19. Why were imperative features added to most dialects of LISP?
LISP began as a pure functional language but soon acquired some important imperative features to increased its execution efficiency.
26. What is type inferencing, as used in ML?
Type inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstruction.
29. What is a curried function?
Curried functions a function which a new functions can be constructed from them by partial evaluation.
30. What does partial evaluation mean?
Partial evaluation means that the function is evaluated with actual parameters for one or more of the leftmost formal parameters.
32. What is the use of the evaluation environment table?
A table called the evaluation environment stores the names of all implicitly and explicitly declared identifiers in a program, along with their types. This is like a run-time symbol table.
33. Explain the process of currying.
The process of currying replaces a function with more than one parameter with a function with one parameter that returns a function that takes the other parameters of the initial function.
_______________________________________________________________________________________________________________________________
Problem Set
2 . Give a general form of function declaration in ML.
Function declarations in ML appear in the general form
fun function_name(formal parameters) = expression;
4. Refer to a book on Haskell programming and discuss the features of Haskell.
Haskell features lazy evaluation, pattern matching, list comprehension, type classes, and type polymorphism.
8. How is the functional operator pipeline (|>) used in F#?
The pipeline operator is a binary operator that sends the value of its left operand, which is an expression, to the last parameter of the function call, which is the right operand.
9. What does the following Scheme function do?
(define (y s lis)
(cond
((null? lis) ‘() )
((equal? s (car lis)) lis)
(else (y s (cdr lis)))
))
y returns the given list with leading elements removed up to but not including the first occurrence of the first given parameter.
10. What does the following Scheme function do?
(define (x lis)
(cond
((null? lis) 0)
((not (list? (car lis)))
(cond
((eq? (car lis) #f) (x (cdr lis)))
(else (+ 1 (x (cdr lis))))))
(else (+ (x (car lis)) (x (cdr lis))))
x returns the number of non-NIL atoms in the given list.
Chapter 14 of Concept of Programming Languages
Review Question
6 . What is exception propagation in Ada?
Exception propagation allows an exception raised in one program unit to be handled in some other unit in its dynamic or static ancestry. This allows a single exception handler to be used for any number of different program units. This reuse can result in significant savings in development cost, program size, and program complexity.
9. What is the scope of exception handlers in Ada?
Exception handlers can be included in blocks or in the bodies of subprograms, packages, or tasks.
10. What are the four exceptions defined in the Standard package of Ada?
There are four exceptions that are defined in the default package, Standard:
11. are they any predefined exceptions in Ada?
Yes, they are.
12. What is the use of Suppress pragma in Ada?
The suppress pragma is used to disable certain run-time checks that
are parts of the built-in exceptions in Ada.
14. What is the name of all C++ exception handlers?
Try clause.
15. Which standard libraries define and throw the exception out_of_rangein C++?
Library container classes.
16. Which standard libraries define and throw the exception overflow_errorin C++?
Math library functions.
25. What is the difference between checked and unchecked exceptions in Java?
Exceptions of class Error and RuntimeException and their descendants are called unchecked exceptions. All other exceptions are called checked exceptions. Unchecked exceptions are never a concern of the compiler.
30. In which version were assertions added to Java?
Assertions were added to Java in version 1.4.
31. What is the use of the assert statement?
The assert statement is used for defensive programming. A program may be written with many assert statements, which ensure that the program’s computation is on track to produce correct results.
32. What is event-driven programming?
Event-driven programming is a programming where parts of the program are executed at completely unpredictable times, often triggered by user interactions with the executing program.
33. What is the purpose of a Java JFrame?
The JFrame class defines the data and methods that are needed for frames. So, a class that uses a frame can be a subclass of JFrame. A JFrame has several layers, called panes.
34. What are the different forms of assert statement?
There are two possible forms of the assert statement:
assert condition;
assert condition : expression;
Problem Set
1 . What mechanism did early programming languages provide to detect or attempt to deal with errors?
Early programming languages were designed and implemented in such a way that the user program
could neither detect nor attempt to deal with such errors. In these languages, the occurrence of such an error simply causes the program to be terminated and control to be transferred to the operating system. The typical operating system reaction to a run-time error is to display a diagnostic message, which may be meaningful and therefore useful, or highly cryptic. After displaying the message, the program is terminated.
2. Describe the approach for the detection of subscript range errors used in C and Java.
Java compilers usually generate code to check the correctness of every subscript expression (they do not generate such code when it can be determined at compile time that a subscript expression cannot have an out-of-range value, for example, if the subscript is a literal).
In C, subscript ranges are not checked because the cost of such checking was (and still is) not believed to be worth the benefit of detecting such errors. In some compilers for some languages, subscript range checking can be selected (if not turned on by default) or turned off (if it is on by default) as desired in the program or in the command that executes the compiler.
5. From a textbook on FORTRAN, determine how exception handling is done in FORTRAN programs.
For example, a Fortran “Read” statement can intercept inputerrors and end-of-file conditions, both of which are detected by the input device hardware. In both cases, the Read statement can specify the label of some statement in the user program that deals with the condition. In the case of the end-of-file, it is clear that the condition is not always considered an error. In most cases, it is nothing more than a signal that one kind of processing is completed and another kind must begin. In spite of the obvious difference between end-of-file and events that are always errors, such as a failed input process, Fortran handles both situations with the same mechanism.
6. 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?
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. 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?
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.
6 . What is exception propagation in Ada?
Exception propagation allows an exception raised in one program unit to be handled in some other unit in its dynamic or static ancestry. This allows a single exception handler to be used for any number of different program units. This reuse can result in significant savings in development cost, program size, and program complexity.
9. What is the scope of exception handlers in Ada?
Exception handlers can be included in blocks or in the bodies of subprograms, packages, or tasks.
10. What are the four exceptions defined in the Standard package of Ada?
There are four exceptions that are defined in the default package, Standard:
Constraint_aError
Program_Error
Storage_Error
Tasking_Error
11. are they any predefined exceptions in Ada?
Yes, they are.
12. What is the use of Suppress pragma in Ada?
The suppress pragma is used to disable certain run-time checks that
are parts of the built-in exceptions in Ada.
14. What is the name of all C++ exception handlers?
Try clause.
15. Which standard libraries define and throw the exception out_of_rangein C++?
Library container classes.
16. Which standard libraries define and throw the exception overflow_errorin C++?
Math library functions.
25. What is the difference between checked and unchecked exceptions in Java?
Exceptions of class Error and RuntimeException and their descendants are called unchecked exceptions. All other exceptions are called checked exceptions. Unchecked exceptions are never a concern of the compiler.
30. In which version were assertions added to Java?
Assertions were added to Java in version 1.4.
31. What is the use of the assert statement?
The assert statement is used for defensive programming. A program may be written with many assert statements, which ensure that the program’s computation is on track to produce correct results.
32. What is event-driven programming?
Event-driven programming is a programming where parts of the program are executed at completely unpredictable times, often triggered by user interactions with the executing program.
33. What is the purpose of a Java JFrame?
The JFrame class defines the data and methods that are needed for frames. So, a class that uses a frame can be a subclass of JFrame. A JFrame has several layers, called panes.
34. What are the different forms of assert statement?
There are two possible forms of the assert statement:
assert condition;
assert condition : expression;
Problem Set
1 . What mechanism did early programming languages provide to detect or attempt to deal with errors?
Early programming languages were designed and implemented in such a way that the user program
could neither detect nor attempt to deal with such errors. In these languages, the occurrence of such an error simply causes the program to be terminated and control to be transferred to the operating system. The typical operating system reaction to a run-time error is to display a diagnostic message, which may be meaningful and therefore useful, or highly cryptic. After displaying the message, the program is terminated.
2. Describe the approach for the detection of subscript range errors used in C and Java.
Java compilers usually generate code to check the correctness of every subscript expression (they do not generate such code when it can be determined at compile time that a subscript expression cannot have an out-of-range value, for example, if the subscript is a literal).
In C, subscript ranges are not checked because the cost of such checking was (and still is) not believed to be worth the benefit of detecting such errors. In some compilers for some languages, subscript range checking can be selected (if not turned on by default) or turned off (if it is on by default) as desired in the program or in the command that executes the compiler.
5. From a textbook on FORTRAN, determine how exception handling is done in FORTRAN programs.
For example, a Fortran “Read” statement can intercept inputerrors and end-of-file conditions, both of which are detected by the input device hardware. In both cases, the Read statement can specify the label of some statement in the user program that deals with the condition. In the case of the end-of-file, it is clear that the condition is not always considered an error. In most cases, it is nothing more than a signal that one kind of processing is completed and another kind must begin. In spite of the obvious difference between end-of-file and events that are always errors, such as a failed input process, Fortran handles both situations with the same mechanism.
6. 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?
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. 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?
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.
Chapter 13 of Concept of Programming Languages
Review Questions :
7. What is the difference between physical and logical concurrency?
Several program units from the same program executes simultaneously, this is called physical concurrency, while logical concurrency the actual execution of program is taking place in interlaved fashion on a single processor
8. What is the work of a scheduler?
A scheduler manages the sharing of processors among the tasks.
9. Give some examples of languages which can be used for synchronization
Ada, Java, C#, F#, Python
10. When a task in a blocked state?
A task that is blocked has been running, but that execution was interrupted by one of several different events, the most common of which is an input or output operation.
18. What is the purpose of a task-ready queue?
a ready task is ready to run but is not currently running, either it has not been given processor time by the scheduler, or it had run previously but was blocked
19. What are the two primary design issues for language support for concurrency?
Competition and cooperation synchronization
20. Describe the actions of the wait and release operations for semaphores
The wait semaphore subprogram is used to test the counter of a given semaphore variable. The release semaphore subprogram is used by a task to allow some other task to have one of whatever the counter of the specified semaphore variable counts
34. What does the Java sleep method do?
Sleep method specify the number of milliseconds the thread want to be blocked and block the thread for that amount of milliseconds
35. What does the Java yield method do?
Join method is used to force a method to delay its execution until the run method of another thread has completed its execution
36. What does the Java join method do?
The join method puts the thread that calls it in the blocked state, which can be ended only by the completion of the thread on which join was called.
37. What does the Java interrupt method do?
The interrupt method is one way to communicate to a thread that it should stop
48. What kind of methods can run in a C# threads?
Any C# method can run in its own thread
49. Can C# threads be actor threads, server threads, or either?
C# support both actor and server threads.
55. What is Concurrent ML?
Concurrent ML is an extension to ML that includes a form of threads and a form of synchronous message passing to support concurrency
56. What is the use of spawn primitive of CML?
Creating a thread in CML
____________________________________________________________________________________________________________________________________
Problem Set :
2. What are the different ways to handle deadlock?
Deadlock handling :
3. Busy waiting is a method whereby a task waits for a given event by continuously checking for that
event to occur. What is the main problem with this approach?
The main problem would be the CPU resources that area allocated to the waiting for the task, if it were to be suspended, the CPU can then be used for other purposes
7. What is the difference between physical and logical concurrency?
Several program units from the same program executes simultaneously, this is called physical concurrency, while logical concurrency the actual execution of program is taking place in interlaved fashion on a single processor
8. What is the work of a scheduler?
A scheduler manages the sharing of processors among the tasks.
9. Give some examples of languages which can be used for synchronization
Ada, Java, C#, F#, Python
10. When a task in a blocked state?
A task that is blocked has been running, but that execution was interrupted by one of several different events, the most common of which is an input or output operation.
18. What is the purpose of a task-ready queue?
a ready task is ready to run but is not currently running, either it has not been given processor time by the scheduler, or it had run previously but was blocked
19. What are the two primary design issues for language support for concurrency?
Competition and cooperation synchronization
20. Describe the actions of the wait and release operations for semaphores
The wait semaphore subprogram is used to test the counter of a given semaphore variable. The release semaphore subprogram is used by a task to allow some other task to have one of whatever the counter of the specified semaphore variable counts
34. What does the Java sleep method do?
Sleep method specify the number of milliseconds the thread want to be blocked and block the thread for that amount of milliseconds
35. What does the Java yield method do?
Join method is used to force a method to delay its execution until the run method of another thread has completed its execution
36. What does the Java join method do?
The join method puts the thread that calls it in the blocked state, which can be ended only by the completion of the thread on which join was called.
37. What does the Java interrupt method do?
The interrupt method is one way to communicate to a thread that it should stop
48. What kind of methods can run in a C# threads?
Any C# method can run in its own thread
49. Can C# threads be actor threads, server threads, or either?
C# support both actor and server threads.
55. What is Concurrent ML?
Concurrent ML is an extension to ML that includes a form of threads and a form of synchronous message passing to support concurrency
56. What is the use of spawn primitive of CML?
Creating a thread in CML
____________________________________________________________________________________________________________________________________
Problem Set :
2. What are the different ways to handle deadlock?
Deadlock handling :
- Ignoring deadlock
- Detection : Process Terimnation and Resource preemption
- Prevention : preventing one of the four Coffman conitions from occuring
- Avoidance
3. Busy waiting is a method whereby a task waits for a given event by continuously checking for that
event to occur. What is the main problem with this approach?
The main problem would be the CPU resources that area allocated to the waiting for the task, if it were to be suspended, the CPU can then be used for other purposes
Subscribe to:
Posts (Atom)