cs508 Finalterm Solved Mcqs PDF
cs508 Finalterm Solved Mcqs PDF
1. AI
2. Puzzle
3. Game
4. All f the given
1. Primitive
2. Reference
3. Integer type
4. Both reference and Primitive
1. C++..?
2. Java
3. C#
4. C# and java
1. Same
2. Different
3. Distinct
4. None of the given
____ compile into machine independent language, independent code which run in a
managed execution environment.
1. C#
2. Java
3. C++
4. Ada
1|P ag e
______compile initially to an intermediate. Which can be run by interpretation or just in
time compilation or an appropriate virtual machine?
1. C++ and C#
2. C# and Java
3. Java and C++
4. Ada , C++
In ______ the relationship between a get and set method is inherited, while in
___________ it has to be maintained.
1. Java , C++
2. C++ , C#
3. Ada , Java
4. C# , Java or C++
1. Java , C#
2. C++ , C# c
3. C# , Java
4. Java ,C++ ..?
2|P ag e
In C# Managed code is executed under the control of
1. CLR
2. CRL
3|P ag e
How many string operators are in PHP?
1. 2
2. 3
3. 4
4. 10
C# code when compiled is converted into ________ code.
1. MSIL
2. MISL
In C# _____can be inherited from other class but no inheritance from it. On the other
hand _________ cannot be inherited not inheritance is possible from it is possible.
1. Private class , public class
2. Sealed class ,struct in C#
3. struct in C# , Sealed class
4. public class , inherited class
Enumeration type in C# may take any type of _______ in contrast to C++ where it take
only _________
a. Numeric value, integer value
b. Value type value, numeric value
c. Primitive type value, reference type value
d. Value type value, reference type value
1. C++, C#
2. C#, C++
3. C++, Java
4. None of the given
1. Prolog,
2. Lisp,
3. Cobol
1. Arithmetic expression
2. Boolean expression
3. Numeric expression
4. Both Numeric expression and Boolean expression
In C# the value type and reference type variable are interconvert able through ________
concept.
1. Tagged type
2. Boxing
3. Interfaces
4. None of the given
Managed or safe code in_______ is executed under the control of common language
runtime (CLR) with automatic garbage collection, no explicit memory allocation and de
allocation and no explicit destructor.
1. C++
2. Java
5|P ag e
3. Ada and C++
4. C#
1. ODBC
2. Oracle
3. SQL Server
4. None Of given…?
1. Dynamic
2. Static
3. Both dynamic and static
4. Stack
6|P ag e
First language that provided the concept of Pointer data type was _______.
1. COBOL
2. LISP
3. PL/1
4. JAVA
1. Readably
2. Writeable
3. Cost
4. compile time
1. Reference pointer
2. Unary pointer
3. Class pointer
4. Binary pointer
1. Explicit
2. Punter method
3. Implementation
4. An Indirect Reference
1. Also
2. No
3. Defective
4. None of the above
1. For
2. Switch loop
3. Do while
4. While
Tasks in ____are processes and cannot share data but thread in _______ do it.
1. C# , C++
2. C++ , Ada
3. Java , C#
4. Ada , Java..?
If you want an argument to a function to always be passed by reference, you can prepend
8|P ag e
1. Percentage sign (%) to the argument name in the function definition
2. Dollar sign ($)to the argument name in the function definition
3. An ampersand (&) to the argument name in the function definition
4. Tilled sign (~)to the argument name in the function definition
9|P ag e
handlers
end;
2. declare -- declare section optional
declarations
begin
statements
1. Recursion
2. For Loop
3. While Loop
4. Do-While Loop
10 | P a g e
___________ represents the class of languages from functional paradigm.
1. LISP
2. PROLOG
3. Ada
4. C++
1. (Difference L1 L2)
2. (set-difference L1 L2)
3. (L1 Difference L2)
4. (L1 difference L2)
Lists can be constructed with the help of three basic functions which
are ___________.
1. True
2. False
11 | P a g e
Following is the correct syntax of 'for' statement in Ada.
1. Ada
2. C
3. C++
4. LISP
1. String manipulation
2. AI
3. Business
4. Scientific
1. True
12 | P a g e
2. False
1. True
2. False
1. Scientific experiments
2. Business application
3. AI applications
4. Publishing and writing algorithm
1
2
3
4
13 | P a g e
It is always better to find out the mistakes in the code at ________.
1. Runtime
2. Compile time
3. Link time
4. None of given option
COBOL was the first language that brings the concept of __________.
1. Records
2. Structure
3. Object
4. Variable
Learning the implementation details of a language helps in the efficient use of that
language.
1. True
2. False
1. C++
2. Ada
3. C
4. PROLOG
14 | P a g e
The main design goals of Ada were EXCEPT
1. Program reliability and maintenance
4. Design language for DoD
5. Programming is a human activity therefore avoid unintentional mistakes
6. Designing a portable language
1. Readability
2. Writabilty
3. Portability
4. Modularity
1. String
2. Operator
3. Variable
15 | P a g e
4. Keyword
1. Computer architecture
2. Readability
3. Programmer’s time
4. Windows XP
The more is the Simplicity of a language, the more it will always be readable.
1. True
2. False
1. Line Continuation
2. Line Break
1. COBOL
2. LISP
3. JAVA
16 | P a g e
4. SIMULA
In SONOBOL 2 spaces can be used, the purpose of 1st space is for _____
and 2nd for
We use ____ indirect referencing operator in SNOBOL (Binary “.”, Binary $, Unary “.”, Unary
$)
Elementary types are also called __________ in ADA (Static, user defines, builtin)
___ has a powerful set of operators but poor type checking (C, C++, ADA, LISP)
There are no struct, union, enum, unsigned, typedef, or pointers types in Java
====================
17 | P a g e
• Conditionals: such as if-then-else construct.
• Function types: where functions are just like integers and strings
• Recursion: first language to support it.
• Dynamic typing: all variable are pointers.
• Garbage-Collection.
• Programs composed of expressions.
• A symbol type.
• The whole program is a mathematical function
ADA is strongly typed. A programming language is strongly typed if type errors are
always detected and in ADA Errors can be signaled as exceptions and handled
explicitly. Many serious errors such as computational overflow and invalid array
indexes are automatically caught and handled through this exception mechanism,
improving program reliability....?
Write a function in LISP to concatenate two lists List a=(3 4 5) List b=(c d 6)
(3 4 5 c d 6)..concatenated List.
In C++ ^ and ~ are used for bitwise exclusive OR and bitwise NOT write there equivalent
in ada
Ans:
~ = Not in ADA
(defun power (x y)
Example;
>(power 3 4)
18 | P a g e
81
A code was given about ADA case concept. Please refer topic "Case statement”
case expression is
sequence-of-statements
sequence-of-statements
sequence-of-statements
end case;
In SNOBOL, The size of the array can be determined at run time by using input from the
system of using a variable.
Example:
A = ARRAY(INPUT)
Lists can be created and extended with the help of three basic functions.
1. cons,
2. list
3. append.
What are operators for Logical AND && and Logical OR || used in ADA.
19 | P a g e
Logical AND &&= And in ADA
Logical OR || = Or in ADA
COBOL has introduced hierarchical data structures (records) and nested selection
statements.
The COBOL language supported long variable names (up to 30 characters) with
hyphens, data division, and fixed-point arithmetic.
These all feature in COBOL language are those which were added or enhanced and
were not included in SNOBOL..
KEYWORD INT|CAHR
This statement assigns the pattern ‘INT’ | ‘CHAR’ to the variable KEYWORD.
KEYWORD will now get a new value which is ‘INT’ | ‘CHAR’ So we can create new
pattern by using the assignment statement.
Ans:
This code generates an error as the symbol x is not associated with any value and
thus cannot be evaluated.it will give error like this.
Atom = a
List = (d e)
20 | P a g e
What is predicate in lisp language conform ?...3
Comparative operators in LISP used as functions for numerical values and return a T
or NIL. =, >, <, >=, <=;
For example 1:
(= (+ 2 4) (* 2 3))
example 2:
(> (- 5 2) (+ 3 1))
NIL
write two comparative operator used as function for numerical values in lisp
programming language ? 2 marks
Comparative operators which are used as functions for numerical values are
A table data structure maps pairs of associated data objects. Tables have varying lengths
T = TABLE(N)……..if want to creates a table that initially has room for N elements
Once created, table can be used in a manner similar to arrays. The only difference is that
they are indexed by the key value and not the index number. For example:
T<‘A’> = 1
21 | P a g e
which language first provided exception handling among c++ , ada? .... 3 marks
Ans;
Although PL/1 has introduce the concept of exception handling. But ADA has elaborated
this concept.
Ada was the first language to provide a structured exception handling mechanism.
Ada includes an exception handling mechanism so that these problems can be dealt
with at run-time.
Errors can be signaled as exceptions and handled explicitly.
Many serious errors such as computational overflow and invalid array indexes are
automatically caught and handled through this exception mechanism, improving
program reliability.
write a complete program in ada to print this out put by only using put_line command.
use the loop isn't allowed.
***
*****
*******
Ans.
procedure Starprint is
begin
Put ("*");
New_Line ;
Put ("***");
New_Line ;
Put ("*****");
New_Line ;
22 | P a g e
Put ("******");
New_Line ;
end Starprint;
code :
**
***
****
Ans:
procedure Loopprint is
Number_Of_Time: Integer:=5;
begin
end loop;
New_Line;
End loop;
end Nested_Loops;
end Loopprint;
1. procedures and
2. Functions.
In order to select elements from a list, selectors functions are used. There are two basic
1. First (or car) takes a list as an argument and returns the first element of that list.
example:
2. rest (or cdr) takes a list as its argument and returns a new list after removing the first
examples:
(s d f).
Generality
Generality is also an important factor and deals with the applicability of the language to a
24 | P a g e
range of different domains. For example, C is more general purpose than LISP or
FORTRAN and hence can be used in more domains than these two languages.
Compare ADA dotimes loop with dolist and dotime in LISP (5)
Apart from recursion, in LISP we can write code involving loops using iterative non recursive
mechanism. There are two basic statements for that purpose: dotimes and dolist.
DOTIMES
It executes the body of the loop n times where count starts with 0, ends with n-1.
The result is optional and is to be used to hold the computing result. If result is given, the
function will return the value of result. Otherwise it returns NIL. The value of the count can
be used in the loop body.
DOLIST
The second looping structure is dolist. It is used to iterate over the list elements, one at a
time. Its syntax is given below:
It executes the body for each top level element x in L. x is not equal to an element of L in
each iteration, but rather x takes an element of L as its value. The value of x can be used in
the loop body. As we have seen in the case of dotimes, the result is optional and is to be
used to hold the computing result. If result is given, the function will return the value of
result. Otherwise it returns NIL.
Differentiate between ADA access types and C/C++ pointer type (5)
25 | P a g e
A_Ref.Postal_Code := "94960-1234";
Unlike C, there is no notational difference for accessing a record field directly or through an
access value.
To refer to the entire record accessed by an access value use the following notation:
Print(A_Ref.all);
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.
The following comparative operators are used as functions for numerical values and return
a T or NIL. =, >, <, >=, <=;
COBOL uses level numbers to show nested records; others use recursive definitions
Business applications
It was designed to look like simple English to broaden the base of computer users.
Generics are like templates in C++ and allow parameterization of subprograms and
packages with parameters which can be types and subprograms as well as values and
objects.
2. The initial expression can include variable definitions (scope is from the definition to the
end of the function in which it is defined).
26 | P a g e
There are three types of loops in ADA.
1. For loop
2. While loop
3. Simple ..unconditional infinite loop
components that can be combined in a relatively small number of ways to get the desired
results. It is closely associated with simplicity: the more orthogonal the designs the fewer
exceptions and it make it easier to learn, read, and write programs in a programming
language. The meaning of an orthogonal feature is independent of the context. The key
parameters are symmetry and consistency. For example pointers are an orthogonal
concept.
1)S=0
S=o
-- N=LT(N,13)N+1:F(DONE)
SUM=SUM+_N:(ADD)
DONE OUTPUT=SUM
27 | P a g e
6)is polymorphism allowed in ada????
There are two means of using polymorphism in Ada. Static polymorphism is provided
through the generic parameter mechanism whereby a generic unit may at compile time be
instantiated with any type from a class of types. Dynamic polymorphism is provided
through the use of so-called class-wide types and the distinction is then made at runtime on
the basis of the value of a tag.
Charles Babbage is considered to be the inventor of the first computer. This machine,
known as the Analytical Engine or Difference Engine, was invented in 1820’s. In the
beginning, it could only be made to execute tasks by changing the gears which
executed the calculations. Thus, the earliest form of a computer language was
physical motion.
It was motivated by the success of power looms. It had limited capability and
because of the technological limitations this design could not be fully implemented.
28 | P a g e
December 1, 2010 at 8:23pm
What is the difference between >(intersection L1,L2) and (set-difference L1,L2) Lisp
functions. 5
These are set operations in LISP.
>(union L1 L2) ; returns the union of the two lists
>(intersection L1 L2) ; returns the intersection of the two lists
>(set-difference L1 L2) ; returns the difference of the two lists
Creating list functions in Lisp may be written as (append ‘(ab)’(cd)) so why we use
the single quote (‘) in front of atom or list. 3
it a shorthand notation for the function, quote. Quote is a function that takes in its
argument and sends back as its answer, the same value that went into it.
29 | P a g e
In SNOBOL Space is used as the pattern matching operator and the statement has
the following form:
subject pattern
There is no assignment operator in this case. Both the subject and the pattern are
strings and this statement tries to match the pattern in the subject. It will be
successful if the match is found and will result in failure otherwise.
Example:
TRADE = ‘PROGRAMMER’
PART = ‘GRAM’
TRADE PART
30 | P a g e
end case;
There should be proper assignment operator (:=) . In these colon before equal is
missing ...
condition
a=b
a=c
b=a
Procedure Color is
begin BasicColor
Color:=BasicColor'PRED(RED)
end color
Asn:
RED.
31 | P a g e
How to compare and examine language?
1. Readability
2. Writ ability
3. Reliability
Sentence='this is ur pen'
Sentence ’my’=
Z= ’10’
Prolog is a declarative programming language where we only specify what we need rather
than how to do it. It has a simple concise syntax with built-in tree formation and
backtracking which generates readable code which is easy to maintain. It is relatively case
and type insensitive and is suitable for problem solving / searching, expert systems /
knowledge representation, language processing / parsing and NLP, and game playing.
Discuss the issue related with declaring a method/class as final java? 3 marks
A final field is like a constant: once it has been given a value, it cannot be assigned to again.
Fields and methods can also be declared final. A final method cannot be overridden in a
subclass.
With suitable examples the concept of boxing in C#. How C# is different there concept
from other languages? 3 marks
Boxing
Boxing is converting any value type to corresponding object type and convert the resultant
'boxed' type back again.
int i = 123;
32 | P a g e
object box = i; // value of i is copied to the object box
1. Positional
2. Keyword
...
Dangling pointers are those pointers that points to a heap-dynamic variable that has been
Deallocated. Automatic garbage collection prevents memory leaks and dangling pointers.
Example missing…
The fact that arrays and classes are really pointers in Java can lead to some problems. Here
is a simple assignment that causes aliasing:
This obviously creates problems. programmers have to be very careful when writing
programs in Java.
In Java, all parameters are passed by value, but for arrays and classes the actual parameter
is really a pointer, so changing an array element, or a class field inside the function does
change the actual parameter's element or field.
Example:
void f( int [ ] A ) {
void g() {
B[0] = 5;
f(B);
B is not null here, because B itself was passed by value however, B[0] is now 10, because
function f changed the first element of the array.
Queries are used to retrieve information from the database. A query is a pattern that
PROLOG is asked to match against the database and has the syntax of a compound query. It
34 | P a g e
may contain variables. A query will cause PROLOG to look at the database, try to find a
match for the query pattern, execute the body of the matching head, and return an answer.
Managed code
Managed code is executed under the control of Common Language Runtime (CRL).
It has automatic garbage collection. That is, the dynamically allocated memory area which
is no longer is in use is not destroyed by the programmer explicitly. It is rather automatically
returned back to heap by the built-in garbage collector. There is no explicit memory’s
allocation and deallocation and there is no explicit call to the garbage collector.
Unmanaged code
The unmanaged code provides access to memory through pointers just like C++. It is useful
in many scenarios. For example:
An explicit declaration is a program statement used for declaring the types of variables .
An implicit declaration is a default mechanism for specifying types of variables i.e the first
appearance of the variable in the program.
35 | P a g e
Write three different methods how to write strings in PHP? 3
Strings
PHP strings are created using single quote or double quote.
They can also be created by <<< which is called heredoc. One should provide an identifier
after <<<, then the string, and then the same identifier to close the quotation. The closing
identifier must begin in the first column of the line.
When a string is evaluated as a numeric value, the resulting value and type are determined
as follows.
The string will evaluate as a float if it contains any of the characters '.', 'e', or 'E'.
Otherwise, it will evaluate as an integer.
The value is given by the initial portion of the string. If the string starts with valid
numeric data, this will be the value used. Otherwise, the value will be 0 (zero).
Example:
<?php
?>
Using strings in numeric expressions provides flexibility but it should be obvious that it also
is a source to numerous programming errors and mistakes. This kind of error is also very
hard to debug and detect.
36 | P a g e
1. We are all aware of the hazards of goto statement. If a language relies on goto
statements for control flow, the logic becomes difficult to follows and hence
understands and maintain.
2. Restricted use of goto in extreme was needed and useful as well but with the
emergence of new language constructs to handle those situations, it probably not an
issue any more.
What are the enumeration and subrange types? Differentiate these two in points.
- A and B
- A or B
- Example
index := 1;
index := index + 1
C, C++, and Java: use short-circuit evaluation for the usual Boolean operators (&& and ||),
but also provide bitwise Boolean operators that are not short circuit (& and |) Structs c++
and c# structs are public by default. Structs are basically "objects" that contain variables
inside of them.The struct type: In C#, a struct is a value type.
37 | P a g e
what seal struct and abstract means in C# ?
An abstract class is any class that includes an abstract method. It is similar to Pure virtual in
C++.If a class includes an abstract method, the class must be declared abstract, too.
Difference between proper example Union type in c/c++ and ada discriminated type?
2marks
Discriminated records are like union types in C. There are however major differences
between C union types and Ada discriminated records. The union type in C is fundamentally
unsafe, and therefore unacceptable.
Division by zero is an expression? what type of error is this and either handled by
compiler or it through exception? 3marks
38 | P a g e
1. ‘and then’
2. ‘or else’
While in FORTRAN 77, short circuiting is there, but any side affected place must be set to
undefined. The Problem with Short Circuiting is
(a > b) || (b++ / 3)
Example:
it is possible to tell the compiler that a class is compliant with .Net Common Language
Specification.
[CLSCompliant (true)]
publc class MyClass
{
//class code
}
Define and explain “throws Clause” and the “finally Clause” with respect to exception
handling in Java. (5)
Throws Clause
Throws clause is overloaded in C++ and conveys two different meanings: one as
specification and the other as command. Java is similar in syntax but different in semantics.
The appearance of an exception class name in the throws clause of Java method specifies
that the exception class or any of its descendents can be thrown by the method.
A C++ program unit that does not include a throw clause can throw any exceptions. A Java
method that does not include a throws cannot throw any checked exception it does not
handle. A method cannot declare more exceptions in its throws clause than the methods it
overrides, though it may declare fewer. A method that does not throw a particular
exception, but calls another method that could throw the exception, must list the exception
in its throws clause.
39 | P a g e
The finally clause
A Java exception handler may have a finally clause. A finally clause always executes when
its try block executes (whether or not there is an exception). The finally clause is written as
shown below:
try {
catch (…) {
finally {
A finally clause is usually included to make sure that some clean-up (e.g., closing opened
files) is done. If the finally clause includes a transfer of control statement (return, break,
continue, throw) then that statement overrides any transfer of control initiated in the try or
in a catch clause.
Explain the Prolog features regarding its applications in real world. (5)
40 | P a g e
Prolog is a declarative programming language where we only specify what we need rather
than how to do it. It has a simple concise syntax with built-in tree formation and
backtracking which generates readable code which is easy to maintain.
Classes and objects in PHP are similar to Java. A variable of the desired type is created with
the new operator. It supports Single inheritance only and uses the keyword extends to
inherit from a super class. The inherited methods and members can be overridden, unless
the parent class has defined a method as final.
41 | P a g e
Threads are based upon the concept of a Monitor. The wait and notify methods are used
just like wait and signal in a Monitor. They allow two threads to cooperate and based on a
single shared lock object.
Fixed stack dynamic - range of subscripts is statically bound, but storage is bound at
elaboration time e.g. C local arrays are not static
Advantage: space efficiency
Stack-dynamic - range and storage are dynamic, but fixed from then on for the variable’s
lifetime e.g. Ada declare blocks declare
begin
...
end;
Advantage: flexibility - size need not be known until the array is about to be used
Differentiate between the implicit and explicit type conversion with respect to Java. (5)
Java is much stronger than C++ in the type conversions that are allowed.
Booleans cannot be converted to other types. For the other primitive types (char, byte,
short, int, long, float, and double).
Implicit conversions:
An implicit conversion means that a value of one type is changed to a value of another type
without any special directive from the programmer. A char can be implicitly converted to an
int, a long, a float, or a double.
42 | P a g e
For example:
char c = 'a';
int k = c;
long x = c;
float y = c;
double d = c;
Explicit conversions:
Explicit conversions are done via casting: the name of the type to which you want a value
converted is given, in parentheses, in front of the value.
For example,
The following code uses casts to convert a value of type double to a value of type int, and to
convert a value of type double to a value of type short:
double d = 5.6;
int k = (int)d;
Casting can be used to convert among any of the primitive types except boolean.
Atoms:
43 | P a g e
1. object
2. string
Differentiate between client side scripting and server side scripting languages? (5)
Primary objective of JavaScript is to create dynamic HTML documents and check validity of
input forms. It is usually embedded in an HTML document. It is not really related to Java
It is interpreted on the Web Server when the HTML document in which embedded is
requested by the browser. It often produces HTML code as an output and is very similar to
JavaScript. It allows simple access to HTML form data and makes form processing easy. It
also provides support for many different database management systems and hence
provides Web access to databases.
Differentiate between the Dynamic Type binding and Static type binding?
Static and Dynamic Binding
A binding is static if it occurs before run time and remains unchanged throughout
program execution.
A binding is dynamic if it occurs during execution or can change during execution
of the program.
What is the run time environment in case of C# similar to JVM in case of Java
programming language?
44 | P a g e
It is Similar to Java and C++ in many respects. The .NET platform is centered on a Common
Language Runtime (CLR - which is similar to a JVM) and a set of libraries which can be
exploited by a wide variety of languages which are able to work together by all compiling to
an intermediate language (IL).
Explain the Concept of Explicit and Implicit heap, dynamic variables and stack dynamic
storage binding? Clarify the concept with suitable examples
Examples: Dynamic objects in C++ (via new and delete) All objects in Java
Advantage:Flexibility
withAda.Text_Io;
useAda.Text_Io;
procedureHello is
begin
Put_Line("Shazia Bano!");
45 | P a g e
endHello;
There is no explicit memory’s allocation and deallocation and there is no explicit calls to
the garbage collector i.e. call to destructor.
No! in c#, Pointer can be declared to hold the memory addresses of value types. That is, we
cannot have pointers for reference type.
These are good enough for most purposes, but you can define your own types just like the
integer types:
Structs: Structs in C# are designed to encapsulate lightweight objects. They are value types
(not reference types), so they're passed by value. They are sealed, which means they
cannot be derived from or have any base class other than System.ValueType, which is
derived from Object. Structs cannot declare a default (parameterless) constructor. Structs
are more efficient than classes, that’s’ why they are perfect for the creation of lightweight
objects.
Write a program in Ada that prints the text Area of your course for example “BS-
Computer Sciences.”
withAda.Text_Io;
useAda.Text_Io;
procedureBSCS is
begin
Put_Line("BS-Computer Sciences!");
End BSCS;
Implementation models?
Implementation Models:
cut <or> ! is a special predicate. And it is used in the body of a given clause so as to avoid
using clauses appearing after the given clause in the program.it is like a goal which is always
succeeded but never backtracked past.
For example, to prevent extra solutions being found by Prolog and avoid additional
computations that are not desired or required in a program.
How do Ada and COBOL differ by syntax and semantics in referencing a record element?
Give examples of each (5)
47 | P a g e
In ADA, Record types are like structures in C.
type Address is record
Street : Unbounded_String;
City : Unbounded_String;
Postal_Code : String(1..10);
end record;
- COBOL uses level numbers to show nested records; others use recursive
definitions
- Examples:
COBOL
field_name OF record_name_1 OF ... OF
record_name_name
According to readability point of view COBOL record definition syntax is easier to read and
understand but according to writability point of view other languages record definition
syntax is easier to write and less time consuming.
Example:
The Ada compiler will use the type of the variable in question and there will be no
ambiguity.Enumeration types are used as attributes or properties of different objects.
48 | P a g e
Why it is necessary to use (:) in control flow statement?
PHP offers an alternative syntax for some of its control structures; namely, if, while, for,
foreach, and switch. In each case, the basic form of the alternate syntax is to change the
opening brace to a colon (:) and the closing brace to endif;, endwhile;, endfor;,
A parameter association defines the association between an actual parameter and a formal
parameter.
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.
Can we define members and length function of our own in LISP?if yes then explain your
answer with suit able example.
yes we can, The LISP built-in function list-length counts the number of elements in a list. For
example,
49 | P a g e
Case 1: L is nil.
The length of an empty list is zero.
Case 2: L is constructed by cons.
Then L is composed of two parts, namely, (first L) and (rest L). In such case, the length
of L can be obtained inductively by adding 1 to the length of (rest L).
????
Write a code in SNOBOL by using indirect referencing which decreases the value by 1.
As Use of an operator for more than one purpose is known as operator overloading. Ada
allows a limited overloading of operators. C++ and Ada allow user-defined overloaded
operators…???
What will happen if user does not provide the string array as the argument to the method
in Java,will there be any kind of error or not ?
2. case A is
when 1 =>fly;
end case;
And ek qs tha keeping in mind that expressions in LISP are in the List show the top variables of the
following list.
50 | P a g e
Ese kr k lists thin…
(add 4, mult 3)
51 | P a g e