CS508 Midterm Solved Current Subjective Papers Withrefernces
CS508 Midterm Solved Current Subjective Papers Withrefernces
www.saher-it-soutions.com
Midterm Paper Year 2013
Q. Tell the names of operates that are present in Ada but not in C++
Answer: Page no : 47
Remainder Rem
AbsoluteValue Abs
Exponentiation **
Range ..
Membership In
Answer: Page no : 67
First (or car) is a list selector. It takes list as argument and return first element of
list.
Rest(or cdr) is a list selector. It takes list as argument and return whole list after
excluding first element.
set y 2
y-min 20
Answer: Page no : 69
(y-min 20)
(setq y 2 )
20-2= 18
Answer: Page no : 68
Also number, symbolp, null can be used to test whether the operand is a number,
symbol, or a null value.
Q2 Lists are used in lisp write top elements of the list given as (add 3( multp 3
4))
and (job car school) Marks 3
Answer: Page no : 64
3 and (3 4 ) are top element in first list while job , car and school are top
elements in second list.
N=ARRAY(‘2,5’,0)
Q4 We want to write a program in ada and want to take marks as inputs from
user and
subject 1=(100)
subject 2=(200)
subject 3=(400)
Answer:
end Subject;
Answer: Page no : 36
Vertical bar is used to specify pattern alternation as shown in the example below.
Answer: Page no : 48
Ada allows a limited overloading of operators. The exception in Ada is that the
assignment operator (:=) cannot be overridden. It can be overridden in case of
inheritance from a special kind of “abstract class”. When you override the
equality operator ( =) you also implicitly overridethe inequality operator (/=).
Answer: Page no : 45
The need for a single standard language was felt in 1975 and the draft
requirements were given the code name strawman. Strawman was refined to
Woodman and then Tinman in 1976. It was further refined to ironman. At that
time proposals were invited for the design of a new language. Out of the 17
proposals received, four were selected and given the code names of green, red,
blue, and yellow. Initial designs were submitted in 1978 and red and green short
listed on the basis of these designs. Standard requirements were then refined to
steelman. The designs were refined further and finally Green was selected in
1979. DoD announced that the language will be called Ada. The 1995 revision of
Ada (Ada 95) was developed by a small team led by Tucker Taft. In both cases, the
design underwent a public comment period where the designers responded to
public comments.
Answer: Page no : 36
KEYWORD = ‘INT’ | ‘CHAR’ This statement assigns the pattern ‘INT’ | ‘CHAR’ to
the variable KEYWORD.
Answer: Page no : 65
X is unbound because this symbol doesn’t have any value we will have to assign a
value using setq, setf and set.
>(setq x 3) = 3
Answer: Page no : 64
Answer:
Predicate is a special function which return nill if predicate is not true and returns
T otherwise. Comparative operators are used as functions for numerical values
e.g = < > <= >=. Equal or eq are used for comparing non numeric values. Atom ,
Lisp , Symbolp , number , null are other useful predicates used to find out
whether x is a atom , list , symbol number or null.
Answer: Page no : 45
Answer:
There are three example of two dimension array in ada we define it is valid or
not?
Answer:
Answer:
Answer:
Concatenation.
Alternation
Answer:
Lists can be constructed (created and extended) with the help of three basic
functions. These are cons, list and append.
5. Write two symbols in Lisp which is used for true and false
Answer:
There are two special symbols: T and NIL for logical true and false.
6. Declare an array of float type in ADA which is reference d to days and sunday
is the first reference
Answer:
Answer:
A:=8
B:=6
if A>B
then A:=5
else;
A=A-3
end if result? 2 marks
Answer:
Output = 5
Case statement in ada program likhna tha exact to yad ni ( inventry type add 1
in total rebbion if inventry is A or B ) 2 or statements theen is trha ki 3
Answer:
caseTODAY is
WORK;
whenFRI =>
WORK; PARTY;
REST;
Answer:
Encapsulation
The primary structure used for encapsulation in Ada is called a package. Packages
are used to group data and subprograms. Packages can be hierarchical, allowing a
structured and extensible relationship for data and code. All the standard Ada
libraries are defined within packages.
Extensible Types
Tagged Type
A tagged type is like a record which can beused to declare objects. Following is an
Answer:
The unary operator ‘$’ is used for indirect reference. Indirect reference is also an
interesting feature of SNOBOL. It is similar to a pointer in concept
Answer:
encapsulation and Tagged types are usedto define extensible types. Just like
classes in C++, the tagged type can be extended by making a new tagged record
Employee_Id : Positive;
Salary : Float;
end record;
Answer:
Answer:
With Ada.IO_txt
Use Ada.IO_txt
Begin
Procedure name is
Put_line(“Saher”);
End name;
3. How Ada is different from C in terms of symbol literals and from C++
Answer:
Unlike C, the same symbolic literal can be used in two enumeration types. For
example:
Ada allows a limited overloading of operators. The exception in Ada is that the
assignment operator (:=) cannot be overridden. It can be overridden in case of
inheritance from a special kind of “abstract class”. When you override the
equality operator ( =) you also implicitly overridethe inequality operator (/=).
Answer:
Output = 5
Case expression is
Sequence of statements
Sequence of statements
End case;
Case TODAY is
WORK;
WORK; PARTY;
REST;
end case;
Answer:
Tagged Type
A tagged type is like a record which can be used to declare objects. Following is an
Answer:
The unary operator ‘$’ is used for indirect reference. Indirect reference is also an
interesting feature of SNOBOL. It is similar to a pointer in concept
Answer:
Employee_Id : Positive;
Salary : Float;
Answer:
The ‘.’ (dot) operator is used for conditional assignment only when the entire
pattern is matched. The $ is used for immediate value assignment even if the
entire pattern does not match. It is used as follows:
Pattern $ Variable