CS508 Mid Term Current Paper (Dec 2010)
Monday, December 06, 2010 Posted In .Midterm Dec 2010 Edit Thislonng questions
ADA programming language draw backs.
Loop Functions from the LISP Language.
Which is the largest language in which most of the programming done today?
Explain any unique thing related withlisp conditional control statements. 5
Compare and differentiate with proper examples between Ada Access types and C/C++ pointer type.
5
C++
C++ is a derivative of C which fully supports C pointers and C typecasting. It also supports a new ***** of typecasting operators to help catch some unintended dangerous casts at compile-time. The C++ standard library also provides autoptr, a sort of smart pointer which can be used in some situations as a safe alternative to primitive C pointers.
Ada
Ada is a strongly typed language where all pointers are typed and only safe type conversions are permitted. All pointers are by default initialized to null, and any attempt to access data through a null pointer causes an exception to be raised. Pointers in Ada are called access types. Ada-83 did not permit arithmetic on access types (although many compiler vendors provided for it as a non-standard feature), but Ada-95 supports "safe" arithmetic on access types via the package System.Storage_Elements.
Why predicate is called a special function in LISP? 3
A predicate is a special function which returns NIL if the predicate is false, T or anything other than NIL, otherwise. Predicates are used to build Boolean expressions in the logical statements.
What do you know about the increment/ decrement or predecessors and successor in enum types in Ada explain with suitable example. 3
Give at least two examples of math functions in LISP. 2
There are many built-in function is LISP. This includes math functions as well as functions for manipulating lists. The math functions include:
+, -, *, /, exp, expt, log, sqrt, sin, cos, tan, max, min
How many types of statements are used for pattern building in SNOBOL. 2
There are two types of statements for pattern building. These are Alternation and Concatenation.
Alternation:
Vertical bar is used to specify pattern alternation as shown in the example below.
P1 | P2
This is example of a pattern that will match either P1 or P2.
Concatenation
Two or more patterns can be concatenated to create new patterns.