CS508 Solved Papers of Modern Programming Languages
Final Term fall 2010 (Subjective and Objective Part) Question Papers
For Recursion it is necessary that a language
1)Dynamic
Static
Both dynamic and static
Stack
2)Object in java script can be accessed through ………
Reference pointer method
Non of the above
3) object in java script can be access different techniques
- Java script
- C++
- C#
- Ada
4)A … implicit.. is a default mechanism for specify types of variable?
5)A reserved word is a special word that cannot be used as a user-defined name
6)Variable use in VB without declaring decrease reliability and increase …..
- Readably
- Writeable
- Cost
- compile time
7).Dot operator in a …. SNOBOL?
- Reference pointer
- Unary pointer
- Class pointer
- Binary pointer
8)The GOTO statement in SNOBOL is …..
- Explicit
- Punter method
- Implementation
- An Indirect Reference
9)Adahas … do while loop just like C++
- Also
- No
- Defective
- None of the above
10)We use tagged type inAda…..
11)The last value execution in the …..LISP is the return value
- Autom
- Object
12)Dotimes loop pf LIPS smiler wariking to ada
For
Switch loop
Do while
While
13)Capital letter or underscore in PROLOG
14)Variable in PROLOG …. Are any value is associated that can not be changed.
15)Control staructer is a ……….. statement
16)……… anonymous ……….. is placeholder value that is not required
17)One difference LISP and PROLOG is
- AI
- Puzzle
- Game
18)…PROLOG. Is very effective solving puzzle?
19)…java… is support oop?
20)Variable of ………. Is not an object of java
- Primitive
- Reference
- Integer type
- Both reference and Primitive
21)In ……… handling throw class is overloaded
C++
Java
C#
C# and java
22)C## and C++ have …….. size
Same
Different
Distinct
None of the given
23) In C## struct are used as ………..
24) Javascript …related.. from java languafe
25) In … ….. we have to address the client side compatibility issue. vuzs
26 _______exception inherits from exception class and _________ exception is anywhere in the program.
Select correct option:
Java , C#
C++ , C# c
C# , Java
Java ,C++
Two example of predefined reference type in C#? 2 marks
Reference Types
arrays classes
There are no struct, union, enum, unsigned, typedef, or pointers types in Java
Differnet of C and C++ 2 marks C++ Differs from C in two ways:
1. The control expression can also be Boolean
2. The initial expression can include variable definitions (scope is from the definition to the end of the function in which it is defined).
3. What is DOM?
4. Two example of atoms in PROLOG syntax?
Atoms:
Atoms include numbers, symbols, and strings. It supports both real numbers and integers.
symbols: a symbol in LISP is a consecutive sequence of characters (no space). For example a, x, and price-of-beef are symbols. There are two special symbols: T and NIL for logical true and false.
strings: a string is a sequence of characters bounded by double quotes. For example "this is red" is a string.
Note language genrality? 2marks
What term Class attribute in C#? marks
Difference between proper example Union type and ada discriminated type? 2marks
What is the function of cut(!) predicate in PROLOG? 2 marks
Division by zero is an expression? what type of error is this and either handled by compiler or it through exception? 3marks
How Short circuit evolution is performed inAdaand fortran? 3 marks
Problem with Short Circuiting
(a > b) || (b++ / 3)
Short-circuit evaluation exposes the potential
problem of side effects in expressions
Discuss the issue related with declaring a method/class as final java? 3 marks
Solution:
Final Fields and Methods
Fields and methods can also be declared final. A final method cannot be overridden in a subclass. A final field is like a constant: once it has been given a value, it cannot be assigned to again.
Difference between Actual Parameter and Predicate parameter? 3 marks
With suitable examples the concept of boxing in C#. How C# is different there concept from other languages? 3 marks
Sol:
Boxing
Boxing is converting any value type to corresponding object type and convert the resultant 'boxed' type back again.
int i = 123;
object box = i; // value of i is copied to the object box
object box = i; // value of i is copied to the object box
if (box is int){ // runtime type of box is returned as
// boxed value type
Console.Write("Box contains an int");
// this line is printed
}
Notation of actual /formal Parameters? 3 marks
Solution?
Actual/Formal Parameter Correspondence:
1. Positional
2. Keyword
e.g. SORT(LIST => A, LENGTH => N);
Default Parameter Values
procedure SORT(LIST : LIST_TYPE;
LENGTH : INTEGER := 100);
...
SORT(LIST => A);
Dangling pointer how to state in java? 5marks
Aliasing Problem in java Script? with suitable examples. 5 marks
Solution:
Aliasing Problems in Java
The fact that arrays and classes are really pointers in Java can lead to some problems. Here is a simple assignment that causes aliasing:
int [] A = new int [4];
Int [] B = new int [2];
This is depicted as below:
This obviously creates problems. Therefore, as a programmer you 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.
This is elaborated with the help of the following example:
void f( int [ ] A ) {
A[0] = 10; // change an element of parameter A
A = null; // change A itself
}
void g() {
int [ ] B = new int [3];
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
}
Note that, in C++, similar problems can arise when a class that has pointer data members is passed by value. This problem is addressed by the use of copy constructors, which can be defined to make copies of the values pointed to, rather than just making copies of the pointers. In Java, the solution is to use the arraycopy operation, or to use a class's clone operation. Cloning will be discussed later.