Recent Topics


Please share mid term past papers


  • Cyberian's



    1. Smalltalk was the first purest ______ language and pioneered graphical user interface.

    Object Oriented

    1. Which of the following is the incorrect option form the following statements regarding ‘objectives of learning new languages’ ?
      Help in understanding the language privacy policy.

    2. Binary operator in SNOBOL must has at least _____ spaces on both sides.
      1

    3. A space is used as ______ for concatenation.
      Operator

      • Sign is used for ______ in SONOBOL.
        Line Continuation
    4. Following are some of the reasons for studying concepts related to different
      programming languages EXCEPT
      Increased capability to design communication links

    5. COBOL was the first language that brings the concept of _________ .
      Structure

    6. A language evaluation criteria includes following factor EXCEPT
      Modularity


  • Cyberian's


  • Cyberian's

    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.
    Early Multiple Selectors

    1. FORTRAN arithmetic IF (a three-way selector)

      • IF (arithmetic expression) N1, N2, N3
        Bad aspects:
      • Not encapsulated
        (Selectable segments could be anywhere)
      • Segments require GOTO’s
    2. Write three different methods how to write strings in PHP? 3
      Answer:
      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.

    3. How to convert PHP string in numeric value? 2
      Answer:
      String conversion to numbers
      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).
      Here is an example:
      <?php
      $foo = 2 + “10.5”; // $foo is float (12.5)
      $foo = 1 + “-1.1e3”; // $foo is float (-1099)
      $foo = 1 + “Ali-1.3e3"; // $foo is integer (1)
      $foo = 1 + “10 Small Cats”; // $foo is integer (11)
      $foo = "10.0 cats " + 1; // $foo is float (11)
      ?>
      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.

    4. Discuss readability problem using control statements? 2
      Answer:
      Readability
      Readability is directly related to the cost of maintenance. The different factors that impact readability are:
      Control Statements
      Control statements also play an important role in readability. 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. 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.

    5. What are the enumeration and subrange types? Differentiate these two in points.
      Answer:
      An enumeration type is one in which all of the possible values, which are named constants, are provided in the definition. Enumeration types provide a way of defining and grouping collections of name constants, which are called enumeration constants. An example in C#:
      enum days {Mon, Tue, Wed, Thu, Fri, Sat, Sun};
      A subrange type is a contiguous subsequence of an ordinal type. For example, p. 264
      12 … 14 is a subrange of integer type.

    6. Differentiate between the implicit and explicit type conversion with respect to Java. (5)
      Answer:
      Type Conversion
      Java is much stronger than C++ in the type conversions that are allowed.
      Here we discuss conversions among primitive types. Conversions among class objects will be discussed later.
      Booleans cannot be converted to other types. For the other primitive types (char, byte, short, int, long, float, and double), there are two kinds of conversion: implicit and explicit.
      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. For example, the following will compile without error:

       	char c = 'a'; 
      int k = c; 	
      long x = c; 	
      float y = c; 	
      double d = c; 
      

    For the other (numeric) primitive types, the basic rule is that implicit conversions can be done from one type to another if the range of values of the first type is a subset of the range of values of the second type. For example, a byte can be converted to a short, int, long or float; a short can be converted to an int, long, float, or double, etc.

    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; short s = (short)(d * 2.0);
    Casting can be used to convert among any of the primitive types except boolean. Note, however, that casting can lose information; for example, floating-point values are truncated when they are cast to integers (e.g., the value of k in the code fragment given above is 5), and casting among integer types can produce wildly different values (because upper bits, possibly including the sign bit, are lost).

    1. What are interpreted and compiled languages? Give examples (5)
      Answer:
      In an interpreted environment, the instructions are executed immediately after parsing. Both tasks are performed by the interpreter. Interpreted languages include the MS-Dos Batch language (the OS itself is the interpreter), shell scripts in Unix/Linux systems, Java, Perl and BASICA (a very old BASIC language). Advantages of interpreted languages include relative ease of programming (since once you type your instructions into a text file, the interpreter can run it) and no linker is required. Disadvantages include poor speed performance and that you do not generate an executable (and therefore distributable) program. The interpreter must be present on a system to run the program.
      Modern programming contexts like ‘virtual machines’ managed frameworks are essentially interpreters. These are designed so that any architecture specific information is handled by the virtual machine, allowing the same source code to run on any type of platform.
      Compilers parse the instructions into machine code and store them in a separate file for later execution. Many modern compilers can compile (parse) and execute in memory, giving the ‘appearance’ of an interpreted language. However, the key difference is that parsing and execution occurs in two distinct steps. Examples include newer forms of BASIC (such as Visual Basic), C/C++, Delphi and many others. In a compiled environment, you may speak of several separate files: source code (the text instructions you actually enter), object code (the parsed source code) and the executable (the linked object code). There is definitely an increase in complexity in using compilers, but the key advantages are speed performance and that you can distribute stand-alone executables.
      Whether using a compiled or interpreted language, you will likely need a text editor in which to enter your instructions. Many compilers come complete with integrated editors optimized for working with the specific language. Using these editors is really not much different from using general text editing tools and word processors, though they may look quite different. One key point here is that so long as you follow the proper format requirements for a given interpreter or compiler, you can use any text editor you chose to construct and edit your source code.

    2. Differentiate between client side scripting and server side scripting languages? (5)
      Answer:
      JavaScript – client side scripting
      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
      PHP (Personal Home Page) – server-side scripting
      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.

    3. Describe the programming steps in Prolog? (5)
      Answer:
      PROLOG programming follows the following steps:
      ¬ Declaring some facts about objects and their relationships
      ¬ Defining some rules about objects and their relationships
      ¬ Asking questions about objects and their relationships

    4. Explain the Prolog features regarding its applications in real world. (5)
      Answer:
      You can find PROLOG in areas like expert systems or theorem provers construction. The variant of PROLOG called DATALOG is used in database management.
      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.
      Efficiency is definitely is negative point. While writing programs one has to be aware of the left recursion, failing to do that may result in infinite loops. It has a steep learning curve and suffers from lack of standardization

    5. Define and explain “throws Clause” and the “finally Clause” with respect to exception handling in Java. (5)
      Answer:

    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.
    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.
    46. How do Ada and COBOL differ by syntax and semantics in referencing a record element? Give examples of each (5)
    Answer:

    Q.1: Discuss the significance of readability as the language evaluation criterion. Readability:
    Q.2: Convert the following code in C in to equivalent LISP code using the most appropriate constructs:
    Q.3: Identify the mistake(s) in the following Ada code segment. After correcting it, convert it into equivalent C and LISP code:
    Q.4: We studied several reasons to study programming languages. With that context in mind discuss:
    (a) Increased capacity to express programming concepts
    (b) Improved background for choosing appropriate languages and show the output.
    Q.5: For the following SNOBOL program, explain the meaning of each line
    Q.6: Discuss the difference between enumeration types of C and Ada. Which is better and why?

    Q.1.  what is quoted atom in prolog ?
    Quoted atoms - sequence of characters surrounded by single quotes. Examples: ‘Apple’ ‘hello world’

    Q. 2. what is subprogram issues in different languages ?
    Q. 3. what seal struct and abstract means in C# ?
    An abstract class is any class thatincludes 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.

    Q. 4. How to differentiate between c and c++  ?
    Q. 5. what is notify and wait in java?
    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.
    Q.6.  what query in prolog?
    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 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
    Q.7.  How to differentiate between c++ and java?
    Q.8.  what is monitor in java thread?
    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.
    Q.9.  what is 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.
    Q.10. how many ways the static binding can be define?
    A binding is static if it occurs before run time and remains unchanged throughout program execution
    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
    None 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 ……

    1. Readably
    2. Writeable
    3. Cost
    4. compile time
      7).Dot operator in a …. SNOBOL?
    5. Reference  pointer
    6. Unary pointer
    7. Class pointer
    8. Binary pointer
      8)The GOTO statement in SNOBOL is ……
    9. Explicit
    10. Punter method
    11. Implementation
    12. An Indirect Reference
    1. Ada has … do while loop just like C++
    1. Also
    2. No
    3. Defective
    4. None of the above
    1. We use tagged type inAda……
    2. The last value execution in the ……LISP is the return value
    1. Autom
    2. Object
       
      12)Dotimes loop of LISP similar working 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 structure is a ……if…… statement
      16)……… anonymous ………… is placeholder value that is not required
      Prolog variable are actually constant placeholders and NOT really variables.
      17)One difference LISP and PROLOG is
    3. AI
    4. Puzzle
    5. Game
      18)…PROLOG. Is very effective solving puzzle?
      19)…java… is support oop?
      20)Variable of ………. Is not an object of java
    6. Primitive
    7. Reference
    8. Integer type
    9. 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
    1. In C## struct are used as …………
    2. Javascript …related… from java languafe
    3. In … …… we have to address the client side compatibility issue.
       
      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?
      Document Object Model
    4. Two examples 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
          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:
     


                            A[0] = 10;       // change an element of parameter A
                            A = null;         // change A itself
                }
     
                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
                }
    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


  • Cyberian's

    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.
    Early Multiple Selectors

    1. FORTRAN arithmetic IF (a three-way selector)

      • IF (arithmetic expression) N1, N2, N3
        Bad aspects:
      • Not encapsulated
        (Selectable segments could be anywhere)
      • Segments require GOTO’s
    2. Write three different methods how to write strings in PHP? 3
      Answer:
      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.

    3. How to convert PHP string in numeric value? 2
      Answer:
      String conversion to numbers
      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).
      Here is an example:
      <?php
      $foo = 2 + “10.5”; // $foo is float (12.5)
      $foo = 1 + “-1.1e3”; // $foo is float (-1099)
      $foo = 1 + “Ali-1.3e3"; // $foo is integer (1)
      $foo = 1 + “10 Small Cats”; // $foo is integer (11)
      $foo = "10.0 cats " + 1; // $foo is float (11)
      ?>
      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.

    4. Discuss readability problem using control statements? 2
      Answer:
      Readability
      Readability is directly related to the cost of maintenance. The different factors that impact readability are:
      Control Statements
      Control statements also play an important role in readability. 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. 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.

    5. What are the enumeration and subrange types? Differentiate these two in points.
      Answer:
      An enumeration type is one in which all of the possible values, which are named constants, are provided in the definition. Enumeration types provide a way of defining and grouping collections of name constants, which are called enumeration constants. An example in C#:
      enum days {Mon, Tue, Wed, Thu, Fri, Sat, Sun};
      A subrange type is a contiguous subsequence of an ordinal type. For example, p. 264
      12 … 14 is a subrange of integer type.

    6. Differentiate between the implicit and explicit type conversion with respect to Java. (5)
      Answer:
      Type Conversion
      Java is much stronger than C++ in the type conversions that are allowed.
      Here we discuss conversions among primitive types. Conversions among class objects will be discussed later.
      Booleans cannot be converted to other types. For the other primitive types (char, byte, short, int, long, float, and double), there are two kinds of conversion: implicit and explicit.
      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. For example, the following will compile without error:

       	char c = 'a'; 
      int k = c; 	
      long x = c; 	
      float y = c; 	
      double d = c; 
      

    For the other (numeric) primitive types, the basic rule is that implicit conversions can be done from one type to another if the range of values of the first type is a subset of the range of values of the second type. For example, a byte can be converted to a short, int, long or float; a short can be converted to an int, long, float, or double, etc.

    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; short s = (short)(d * 2.0);
    Casting can be used to convert among any of the primitive types except boolean. Note, however, that casting can lose information; for example, floating-point values are truncated when they are cast to integers (e.g., the value of k in the code fragment given above is 5), and casting among integer types can produce wildly different values (because upper bits, possibly including the sign bit, are lost).

    1. What are interpreted and compiled languages? Give examples (5)
      Answer:
      n an interpreted environment, the instructions are executed immediately after parsing. Both tasks are performed by the interpreter. Interpreted languages include the MS-Dos Batch language (the OS itself is the interpreter), shell scripts in Unix/Linux systems, Java, Perl and BASICA (a very old BASIC language). Advantages of interpreted languages include relative ease of programming (since once you type your instructions into a text file, the interpreter can run it) and no linker is required. Disadvantages include poor speed performance and that you do not generate an executable (and therefore distributable) program. The interpreter must be present on a system to run the program.
      Modern programming contexts like ‘virtual machines’ managed frameworks are essentially interpreters. These are designed so that any architecture specific information is handled by the virtual machine, allowing the same source code to run on any type of platform.
      Compilers parse the instructions into machine code and store them in a separate file for later execution. Many modern compilers can compile (parse) and execute in memory, giving the ‘appearance’ of an interpreted language. However, the key difference is that parsing and execution occurs in two distinct steps. Examples include newer forms of BASIC (such as Visual Basic), C/C++, Delphi and many others. In a compiled environment, you may speak of several separate files: source code (the text instructions you actually enter), object code (the parsed source code) and the executable (the linked object code). There is definitely an increase in complexity in using compilers, but the key advantages are speed performance and that you can distribute stand-alone executables.
      Whether using a compiled or interpreted language, you will likely need a text editor in which to enter your instructions. Many compilers come complete with integrated editors optimized for working with the specific language. Using these editors is really not much different from using general text editing tools and word processors, though they may look quite different. One key point here is that so long as you follow the proper format requirements for a given interpreter or compiler, you can use any text editor you chose to construct and edit your source code.

    2. Differentiate between client side scripting and server side scripting languages? (5)
      Answer:
      JavaScript – client side scripting
      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
      PHP (Personal Home Page) – server-side scripting
      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.

    3. Describe the programming steps in Prolog? (5)
      Answer:
      PROLOG programming follows the following steps:
      ¬ Declaring some facts about objects and their relationships
      ¬ Defining some rules about objects and their relationships
      ¬ Asking questions about objects and their relationships

    4. Explain the Prolog features regarding its applications in real world. (5)
      Answer:
      You can find PROLOG in areas like expert systems or theorem provers construction. The variant of PROLOG called DATALOG is used in database management.
      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.
      Efficiency is definitely is negative point. While writing programs one has to be aware of the left recursion, failing to do that may result in infinite loops. It has a steep learning curve and suffers from lack of standardization

    5. Define and explain “throws Clause” and the “finally Clause” with respect to exception handling in Java. (5)
      Answer:

    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.
    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.
    23. How do Ada and COBOL differ by syntax and semantics in referencing a record element? Give examples of each (5)
    Answer:

    Prolog learning curve is very high meanings of this statement 3marks
    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.
    Efficiency is definitely is negative point. While writing programs one has to be aware of the left recursion, failing to do that may result in infinite loops. It has a steep learning curve and suffers from lack of standardization
    Short circuiting in java and c and c++ 3marks
    Short Circuit Evaluation

    • A and B
    • A or B
    • Example
      index := 1;
      while (index <= length) and
      (LIST[index] <> value) do
      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 |)

    How to define PHP classes
    Classes and objects 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.

    Union in c++ and java difference
    C and C++ have free unions (no tags)
    - Not part of their records
    - No type checking of references
    Java has neither records nor unions

    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.

    1. What are subprogram issues in different languages?
      Answer:
      • What parameter passing methods are provided?
      • Are parameter types checked?
      • Are local variables static or dynamic?
      • Can subprograms be overloaded?
      • Can subprogram be generic?

    2. What is seal struct and abstract in C#
      Answer:
      ¥ Abstract: A class declared as ‘abstract’ cannot itself be instanced - it is designed only to be a base class for inheritance.
      ¥ Sealed: A class declared as ‘sealed’ cannot be inherited from. It may be noted that structs can also not be inherited from.

    3. Two difference b/w c and c++
      Answer:
      • In c declaring the global variable several times is allowed but this is not allowed in c++.
      • In c a character constant is automatically elevated to an integer whereas in c++ this is not the case.
      • C structures have a different behavior compared to c++ structures. Structures in c do not accept functions as their parts.

    4. Two difference b/w c++ and java
      Answer:

    5. C++ is a very capable and popular programming language while Java is a more recent programming language that maximizes the code’s portability.

    6. Programs written in C++ are much faster compared to those written in Java.

    7. C++ is commonly used for traditional computer programs while Java is primarily used for making online and mobile phone applications

    8. What is monitor in java thread
      Answer:
      To prevent problems that could occur by having two methods modifying the same object, Java uses monitors and the synchronized keyword to control access to an object by a thread. Any object that implements the “synchronized” keyword is considered to be a monitor. A monitor is an object that can move a thread process between a blocked and running state. Monitors are required when a process needs to wait for an external event to occur before thread processing can continue. A typical example is when a thread can’t continue until an object reaches a certain state.

    9. What is notify and wait in java
      Answer:
      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.
      There is a slight difference between notify and notifyAll. As the name suggest, notify() wakes up a single thread which is waiting on the object’s lock. If there is more than one thread waiting, the choice is arbitrary i.e. there is no way to specify which waiting thread should be re-awakened. On the other hand, notifyAll() wakes up ALL waiting threads; the scheduler decides which one will run.

    10. What queried in prolog
      Answer:
      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 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.

    11. What is quoted atom in prolog?
      Answer:
      • Alphanumeric atoms - alphabetic character sequence starting with a lower case letter. Examples: apple a1 apple_cart
      • Quoted atoms - sequence of characters surrounded by single quotes. Examples: ‘Apple’ ‘hello world’
      • Symbolic atoms - sequence of symbolic characters. Examples: & < > * - + >>

    12. What is managed code?
      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:
      ¥ Pointers may be used to enhance performance in real time applications.
      ¥ In non-.net DLLs some external functions requires a pointer as a parameter, such as Windows APIs that were written in C.
      ¥ Sometimes we need to inspect the memory contents for debugging purposes, or you might need to write an application that analyzes another application process and memory.

    13. How many ways the static binding can be define
      Answer:
      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
    If static, type may be specified by either an explicit or an implicit declaration
    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 (the first appearance of the variable in the program)

    1. Explain Stack Dynamic variable with example? 5
      Answer:
      • 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

    STUFF : array (1…N) of FLOAT;
    begin

    end;
    Advantage: flexibility - size need not be known until the array is about to be used

    1. Discuss the problem of Aliasing in JavaScript with a proper example? 5 + bad aspects of past multiple selectors? 3
      Answer:

    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:

    Now, when we say:
    A[0] = 5;
    We get the following:

    Now when we say:
    B = A;
    B points to the same array as A and creates an alias. This is shown below:

    Now if we make a simple assignment in B, we will also change A as shown below:
    B[0] = 10;

    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:


    A[0] = 10; // change an element of parameter A
    A = null; // change A itself
    }
    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
    }


  • Cyberian's

    3ce7030b-5854-4c06-82e6-5beab77db8fb-image.png
    Java has a String class which is not exactly an array of

    ►Char
    ►Elements
    ►Indices
    ►Long

    How many string operators are in PHP?
    ►2
    ►3
    ►4
    ►10

    If you want an argument to a function to always be passed by reference, you can prepend
    ►Percentage sign (%) to the argument name in the function definition
    ►Dollar sign ($)to the argument name in the function definition
    ►An ampersand (&) to the argument name in the function definition
    ►Tilled sign (~)to the argument name in the function definition

    How many modes for the source code are in C#?
    ►One
    ►Two
    ►Three
    ►Four

    Which chaining type is used by Prolog?
    ►Backward
    ►Forward
    ►Up
    ►Horizontal

    What are the enumeration and subrange types? Differentiate these two in points.

    An enumeration is a special kind of value type limited to a restricted and unchangeable set of numerical values. By default, these numerical values are integers, but they can also be longs, bytes, etc. (any numerical value except char)

    a) What is the purpose of type conversion? (5)

    Converting one type of data to another is both useful and a source of numerous errors in JavaScript.

    b) Differentiate between the implicit and explicit type conversion with respect to Java. (5)
    Question No: 9 ( Marks: 10 )

    a) What are interpreted and compiled languages? Give examples (5)

    Prolog It is an interactive (hybrid compiled/interpreted) language.
    PHP is interpreted
    FORTAN is compiled
    SNOBAL is compiled

    b) Differentiate between client side scripting and server side scripting languages? (5)

    JavaScript – client side scripting
    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
    PHP (Personal Home Page) – server-side scripting
    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.

    Question No: 10 ( Marks: 10 )
    a) Describe the programming steps in Prolog? (5)

    PROLOG programming follows the following steps:
    • Declaring some facts about objects and their relationships
    • Defining some rules about objects and their relationships
    • Asking questions about objects and their relationships

    b) Explain the Prolog features regarding its applications in real world. (5)

    One of the main features of this language is its ability to handle and process symbols.
    Hence it is used heavily in AI related applications. It is an interactive (hybrid
    compiled/interpreted) language and its applications include expert systems, artificial intelligence, natural language understanding, logical puzzles and games.

    Ada pointers are called Access types.
    TRUE
    FALSE

    a) Comparison between functional and imperative languages?
    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

    Dynamic binding occurs at:
    Compile Time
    Design Time
    Link Time
    Run Time

    Convert the following Ada code into equivalent C code.
    case ch is
    when ‘A’ | ‘E’ | ‘I’ | ‘O’ | ‘U’ =>
    putline(“this is an uppercase vowel”);
    when ‘J’ … ‘N’ =>
    putline(“between uppercase J and N”);
    when others =>
    putline(“something else”);
    end case;

    The dangling pointer problem is partially alleviated by Ada design.
    TRUE
    FALSE

    Which statement is wrong about Static variables?
    They are bound to memory cells before the execution of program
    They use to direct access the memory.
    There is run time overhead of allocation and de-allocation of memory.
    Storage can’t be shared among variables

    Prolog language falls under the domain of:
    Scientific Applications
    Business Applications
    Special Purpose Languages
    None of these

    Following statement returns the union of the two list in LISP.
    Select correct option:

    >(L1 UNION L2)

    >(union L1 L2) (answer)
     >Union L1

    >(L1 union L2)

    Question # 2 of 10 ( Start time: 01:23:17 PM )  Total Marks: 1
    Following is the correct structure of a “block” in Ada.
    Select correct option:

    declare             – declare section optional
      statements
    begin
      declarations

    exception            – exception section optional
      handlers
    end;

    declare             – declare section optional
      declarations
    begin
      statements   (answer)

    exception            – exception section optional
      handlers
    end;

    declare             – declare section optional
      statements
    begin
      declarations
      handlers
    exception            – exception section optional
    end;

    declare             – declare section optional
      statements
      declarations
    begin
      statements
    exception            – exception section optional
      handlers
    end;

    Question # 3 of 10 ( Start time: 01:24:33 PM )  Total Marks: 1
    In LISP, ___________ is the main tool used for iteration.
    Select correct option:

    Recursion (answer)

    For Loop

    While Loop

    Do-While Loop

    Question # 4 of 10 ( Start time: 01:25:35 PM )  Total Marks: 1
    ___________ represents the class of languages from functional paradigm.
    Select correct option:

    LISP (answer)

    PROLOG

    Ada

    C++

    )

    Question # 5 of 10 ( Start time: 01:27:00 PM )  Total Marks: 1
    In LISP, following statement returns the difference of the two lists.
    Select correct option:

    (Difference L1 L2)

    (set-difference L1 L2) (answer)
     (L1 Difference L2)
     (L1 difference L2)

    Question # 6 of 10 ( Start time: 01:27:52 PM )  Total Marks: 1
    Lists can be constructed with the help of three basic functions which
    are ___________.
    Select correct option:

    scheme, common lisp and cons

    cons, append and scheme

    cons, list and append (answer)

    list, atoms and append

    Question # 7 of 10 ( Start time: 01:29:07 PM )  Total Marks: 1
    Block statement in Ada is very different to a block in C.
    Select correct option:

    True
     False (answer)

    Question # 8 of 10 ( Start time: 01:29:42 PM )  Total Marks: 1
    Two important versions of LISP are _________________.
    Select correct option:

    Scheme and Atoms

    Scheme and Common Lisp (answer)

    Common Lisp and defacto

    List and Common Lisp

    Question # 9 of 10 ( Start time: 01:30:47 PM )  Total Marks: 1
    Following is the correct syntax of ‘for’ statement in Ada.
    Select correct option:

    for variable in low_value … high_value loop
           – Loop body goes here
    end loop; (answer)

    for variable in low_value … high_value loop
           – Loop body goes here
    end;

    begin;
    for variable in low_value … high_value loop
           – Loop body goes here
    end loop;

    begin loop;
    for variable in low_value … high_value loop
           – Loop body goes here
    end loop;

    Question # 10 of 10 ( Start time: 01:31:56 PM )  Total Marks: 1
    In __________, Enumeration type can also be used as indexes in arrays.
    Select correct option:

    Ada

    C

    C++

    LISP (answer not confirmed)

    Question # 1 of 15 ( Start time: 08:30:41 AM ) Total Marks: 1
    SNOBOL was designed for ___________ purpose.
    Select correct option:

    ****String manipulation
    AI
    Business
    Scientific

    Question # 2 of 15 ( Start time: 08:31:21 AM ) Total Marks: 1
    Pattern . Variable Upon successful completion of pattern matching, the
    substring matched by the pattern is assigned to the variable as


    Select correct option:

    Value
    ****String
    Integer
    Real numbers

    Question # 3 of 15 ( Start time: 08:32:10 AM ) Total Marks: 1
    Computer architecture has a major influence on the design of
    programming language.
    Select correct option:

    *** True
    False

    Question # 4 of 15 ( Start time: 08:33:23 AM ) Total Marks: 1
    Too much simplicity in language design can also cause problems.
    Select correct option:

    True
    ***False

    Question # 5 of 15 ( Start time: 08:33:58 AM ) Total Marks: 1
    A language evaluation criteria includes following factors EXCEPT
    Select correct option:

    Readability
    Writabilty
    Portability
    ****Modularity

    Question # 6 of 15 ( Start time: 08:35:16 AM ) Total Marks: 1
    COBOL is mainly designed for _______.
    Select correct option:

    Scientific experiments
    ****Business application
    AI applications
    Publishing and writing algorithm

    Question # 7 of 15 ( Start time: 08:36:25 AM ) Total Marks: 1
    The variable name have profound effect on _______________.
    Select correct option:

    Readability
    Writability
    **** Orthogonality
    Portability

    Question # 8 of 15 ( Start time: 08:37:48 AM ) Total Marks: 1
    SIZE function in SONOBOL language is used to return the size of _________
    Select correct option:

    ***String
    Operator
    Variable
    Keyword

    Question # 9 of 15 ( Start time: 08:38:52 AM ) Total Marks: 1
    Indirect referencing in f is same as of _____in C.
    Select correct option:

    Arrays
    ***Pointers
    Aliasing
    Stack

    Question # 10 of 15 ( Start time: 08:40:12 AM ) Total Marks: 1
    Following factors influences a portable language design EXCEPT
    Select correct option:

    Computer architecture
    Readability
    ***Programmer’s time
    Windows XP

    Question # 11 of 15 ( Start time: 08:41:32 AM ) Total Marks: 1
    The more is the Simplicity of a language, the more it will always be readable.
    Select correct option:

    ***True
    False
    Question # 12 of 15 ( Start time: 08:41:48 AM ) Total Marks: 1

    • Sign is used for _______ in SONOBOL.
      Select correct option:

    ****Line Continuation
    Line Breakage

    Question # 13 of 15 ( Start time: 08:42:56 AM ) Total Marks: 1
    Which of the following is an incorrect option from the following
    statements regarding ‘objectives of learning new languages ’?
    Select correct option:

    Help to compare different languages.
    Help in transition from one language to other language.
    ****Help in understanding the language piracy policy.
    Help to choose a language for development of a certain application.

    Question # 14 of 15 (Start time: 08:43:31 AM ) Total Marks: 1
    _______ was the first object oriented language.
    Select correct option:

    COBOL
    LISP
    JAVA
    ****SIMULA

    Question # 15 of 15 ( Start time: 08:44:22 AM ) Total Marks: 1
    In SONOBOL 2 spaces can be used, the purpose of 1st space is for _____
    and 2nd for
    Select correct option:
    *** Pattern matching, String Concatenation
    String concatenation, Pattern matching
    Quiz Start Time: 06:16 PM
    Time Left  88
    sec(s)
    Question # 1 of 15 ( Start time: 06:16:16 PM )  Total Marks: 1
    In C# Managed code is executed under the control of
    Select correct option:
     CLR
     CRL

    Quiz Start Time: 06:16 PM
    Time Left  89
    sec(s)
    Question # 2 of 15 ( Start time: 06:16:34 PM )  Total Marks: 1
    _____is more strongly typed language then _________
    Select correct option:
     C++, C#
     C#, C++
     C++, Java
     None of then given

    Quiz Start Time: 06:16 PM
    Time Left  61
    sec(s)
    Question # 3 of 15 ( Start time: 06:17:30 PM )  Total Marks: 1
    The IS operator in C# is used for_________
    Select correct option:
     Run time type conversion
     Run time type checking not confirmed
     Run time type casting
     None of the given

    Quiz Start Time: 06:16 PM
    Time Left  81
    sec(s)
    Question # 5 of 15 ( Start time: 06:18:35 PM )  Total Marks: 1
    ____ compile into machine independent language, independent code which run in a managed execution environment.
    Select correct option:
     C#
     Java
     C++
     Ada

    Quiz Start Time: 06:16 PM
    Time Left  82
    sec(s)
    Question # 6 of 15 ( Start time: 06:19:44 PM )  Total Marks: 1
    PHP supported all major Databases including______.
    Select correct option:
     ODBC
     Oracle
     SQL Server
     None Of given

    Quiz Start Time: 06:16 PM
    Time Left  81
    sec(s)
    Question # 7 of 15 ( Start time: 06:20:42 PM )  Total Marks: 1
    ______compile initially to an intermediate. Which can be run by interpretation or just in time compilation or an appropriate virtual machine?
    Select correct option:
     C++ and C#
     C# and Java
     Java and C++
     Ada , C++

    Quiz Start Time: 06:16 PM
    Time Left  89
    sec(s)
    Question # 8 of 15 ( Start time: 06:21:16 PM )  Total Marks: 1
    The keyword unsafe is used while dealing with_____
    Select correct option:
     Loop
     Arrays
     Pointers
     Classes

    Quiz Start Time: 06:16 PM
    Time Left  89
    sec(s)
    Question # 9 of 15 ( Start time: 06:21:26 PM )  Total Marks: 1
    Enumeration type in C# may take any type of _______ in contrast to C++ where it take only _________
    Select correct option:
     Numeric value, integer value
     Value type value, numeric value
     Primitive type value, reference type value
     Value type value, reference type value

    Quiz Start Time: 06:16 PM
    Time Left  89
    sec(s)
    Question # 13 of 15 ( Start time: 06:23:46 PM )  Total Marks: 1
    The concept of sealed class in C# is similar to ________
    Select correct option:
     Struct in C#,
     Struct in C++
     Abstract class in C#
     None of the given

    s
    Question # 14 of 15 ( Start time: 06:24:03 PM )  Total Marks: 1
    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.
    Select correct option:
     C++
     Java
     Ada and C++
     C#

    Question # 15 of 15 ( Start time: 06:24:19 PM )  Total Marks: 1
    In C# the if statement condition is an/a ________
    Select correct option:
     Arithmetic expression
     Boolean expression
     Numeric expression
     Both Numeric expression and Boolean expression

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 1 of 15 ( Start time: 06:27:47 PM )  Total Marks: 1
    Java code when compiled is converted into ________ code.
    Select correct option:
     Bit code
     Byte code
     Kbytes code
     Giga byte Code

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 2 of 15 ( Start time: 06:27:59 PM )  Total Marks: 1
    PHP is a __________typed language.
    Select correct option:
     Strongly
     Dynamic
     Static
     None of Given

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 3 of 15 ( Start time: 06:28:10 PM )  Total Marks: 1
    In ______ the relationship between a get and set method is inherited, while in ___________ it has to be maintained.
    Select correct option:
     Java , C++
     C++ , C#
     Ada , Java
     C# , Java or C++

    Quiz Start Time: 06:27 PM
    Time Left  86
    sec(s)
    Question # 4 of 15 ( Start time: 06:31:18 PM )  Total Marks: 1
    C# code when compiled is converted into ________ code.
    Select correct option:
     MSIL
     MISL

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 5 of 15 ( Start time: 06:31:28 PM )  Total Marks: 1
    In______ Boolean expression is convertible into integer type.
    Select correct option:
     C#
     C++
     JAVA
     Ada

    Question # 6 of 15 ( Start time: 06:32:04 PM )  Total Marks: 1
    PHP syntax looks like ____________
    Select correct option:
     ASP syntax
     C/C++ syntax

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 7 of 15 ( Start time: 06:32:12 PM )  Total Marks: 1
    For narrowing conversion which type conversion is appropriate?
    Select correct option:
     Implicit Conversion
     Explicit Conversion

    Question # 8 of 15 ( Start time: 06:32:19 PM )  Total Marks: 1
    In Java we can make pointer of_________.
    Select correct option:
     Any type
     Reference type only

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 9 of 15 ( Start time: 06:32:31 PM )  Total Marks: 1
    In C# the value type and reference type variable are interconvert able through ________ concept.
    Select correct option:
     Tagged type
     Boxing
     Interfaces
     None of the given

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 10 of 15 ( Start time: 06:32:43 PM )  Total Marks: 1
    C# support only_________ inheritance and it achieve_________ inheritance through the concept of interfaces.
    Select correct option:
     Multiple, multiple
     Single, multiple

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 11 of 15 ( Start time: 06:32:54 PM )  Total Marks: 1
    Tasks in ____are processes and cannot share data but thread in _______ do it.
    Select correct option:
     C# , C++
     C++ , Ada
     Java , C#
     Ada , Java

    Question # 12 of 15 ( Start time: 06:33:03 PM )  Total Marks: 1
    The concept of package in Java is similar to _________
    Select correct option:
     Assembly in C#
     Global class in C#

    Question # 13 of 15 ( Start time: 06:33:36 PM )  Total Marks: 1
    The concept of C# jagged array is similar in function to _________
    Select correct option:
     C++ rectangular Array
     Java Array of Array
     Java pointer Array
     C# Array

    Question # 14 of 15 ( Start time: 06:34:17 PM )  Total Marks: 1
    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.
    Select correct option:
     Private class , public class
     Sealed class ,struct in C#
     struct in C# , Sealed class
     public class , inherited class

    Quiz Start Time: 06:27 PM
    Time Left  89
    sec(s)
    Question # 15 of 15 ( Start time: 06:34:49 PM )  Total Marks: 1
    The concept of sealed class in C# is similar to ________
    Select correct option:
     Struct in C#,
     Struct in C++
     Abstract class in C#
     None of the given

    CS 508 mid term spring 2010 paper
    Compare ADA dor 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
    dotimes is like a counter-control for loop. Its syntax is given as below:
    (dotimes (count n result) body)
    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:
    (dolist (x L result) body)
    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)

    An access type roughly corresponds to a C++ pointer.
    type Address_Ref is access Address;
    A_Ref := new Address;
    A_Ref.Postal_Code := “94960-1234”;
    Note that, 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);
    Why predicate is 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.
    The following comparative operators are used as functions for numerical values and return a T or NIL. =, >, <, >=, <=;
    Differentiate between C/C++ unions and ADA discriminated type (3)
    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.
    What additional features are added in COBOL (2)
    COBOL uses level numbers to show nested records; others use recursive definitions Business applications
    reports, decimal arithmetic, character operations - COBOL
    It was designed to look like simple English to broaden the base of computer users.

    Is there anything like templates as in C++ (2)
    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.
    Anything starting with Capital or underscore is a variable in ____________(Prolog, Lisp, Cobol)
    In Prolog we specify ______ and not ______ (solution, problem)
    LISP is used in _______ and _______(functional paradigm, AI)
    First arguments in LISP is __________ (Atom, argument, integer, LIST)
    ADA has ____ do while loop as C/C++ (NO, effective, similar)
    Maps in SNOBOL are also available in ____(C, C++, MATLAB, Prolog)
    We use ____ indirect referencing operator in SNOBOL (Binary “.”, Binary $, Unary “.”, Unary $)
    Elementary types are also called __________ in ADA (Static, user defines, builtin)
    ADA is a _____typed language (strongly)

    In Snobol 2 spaces  are used for , 1st for ______, 2nd for _________
    ______ has elaborated exception handling (ADA, C++, JAVA, COBOL)
    ___ has a powerful set of operators but poor type checking (C, C++, ADA, LISP)
    ______and _______ have declaration paradigm (Prolog, SQL)
    1st machine independent language is _______ sonobol
    To make necessary arguments at run time error is called __(exception handling)
    Language with wide domain of application has higher
    (generality)
    _____ has distributed computing architecture (COBRA)
    Readability has no influence on the cost of _________(deployment)
    The depth at which we can think is influenced by _________(implementation details)

    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    45
    sec(s)

    Question # 2 of 10 ( Start time: 10:25:12 PM )

    Total Marks: 1

    In SONOBOL 2 spaces can be used, the purpose of 1st space is for _____ and 2nd for

    Select correct option:

    Correct

    Bottom of Form
    In SONOBAL binary operators have atleast____ spaces
    1
    2
    3
    4
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    5
    sec(s)

    Question # 3 of 10 ( Start time: 10:26:31 PM )

    Total Marks: 1

    • Sign is used for _______ in SONOBOL.

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    27
    sec(s)

    Question # 4 of 10 ( Start time: 10:28:01 PM )

    Total Marks: 1

    In SONOBOL can the size of the array be determined at run time.

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    23
    sec(s)

    Question # 5 of 10 ( Start time: 10:29:17 PM )

    Total Marks: 1

    ___________ is an important feature of Ada language used in embedded systems and operating systems. It is used in managing parallel threads of controls.

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    8
    sec(s)

    Question # 6 of 10 ( Start time: 10:30:34 PM )

    Total Marks: 1

    One of the major design goals of Ada was

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    29
    sec(s)

    Question # 7 of 10 ( Start time: 10:32:03 PM )

    Total Marks: 1

    SONOBOL is case _______

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    36
    sec(s)

    Question # 8 of 10 ( Start time: 10:33:29 PM )

    Total Marks: 1

    The main design goals of Ada were EXCEPT

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    63
    sec(s)

    Question # 9 of 10 ( Start time: 10:34:48 PM )

    Total Marks: 1

    The space operator has _____ precedence than arithmetic operators.

    Select correct option:

    Correct

    Bottom of Form
    Top of Form

    Quiz Start Time: 10:23 PM

    Time Left

    58
    sec(s)

    Question # 10 of 10 ( Start time: 10:35:28 PM )

    Total Marks: 1

    Pattern . Variable Upon successful completion of pattern matching, the substring matched by the pattern is assigned to the variable as ________

    Select correct option:

    Correct

    1. What are subprogram issues in different languages?
      Answer:
      • What parameter passing methods are provided?
      • Are parameter types checked?
      • Are local variables static or dynamic?
      • Can subprograms be overloaded?
      • Can subprogram be generic?

    2. What is seal struct and abstract in C#
      Answer:
      ¥ Abstract: A class declared as ‘abstract’ cannot itself be instanced - it is designed only to be a base class for inheritance.
      ¥ Sealed: A class declared as ‘sealed’ cannot be inherited from. It may be noted that structs can also not be inherited from.

    3. Two difference b/w c and c++
      Answer:
      • In c declaring the global variable several times is allowed but this is not allowed in c++.
      • In c a character constant is automatically elevated to an integer whereas in c++ this is not the case.
      • C structures have a different behavior compared to c++ structures. Structures in c do not accept functions as their parts.

    4. Two difference b/w c++ and java
      Answer:

    5. C++ is a very capable and popular programming language while Java is a more recent programming language that maximizes the code’s portability.

    6. Programs written in C++ are much faster compared to those written in Java.

    7. C++ is commonly used for traditional computer programs while Java is primarily used for making online and mobile phone applications

    8. What is monitor in java thread
      Answer:
      To prevent problems that could occur by having two methods modifying the same object, Java uses monitors and the synchronized keyword to control access to an object by a thread. Any object that implements the “synchronized” keyword is considered to be a monitor. A monitor is an object that can move a thread process between a blocked and running state. Monitors are required when a process needs to wait for an external event to occur before thread processing can continue. A typical example is when a thread can’t continue until an object reaches a certain state.

    9. What is notify and wait in java
      Answer:
      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.
      There is a slight difference between notify and notifyAll. As the name suggest, notify() wakes up a single thread which is waiting on the object’s lock. If there is more than one thread waiting, the choice is arbitrary i.e. there is no way to specify which waiting thread should be re-awakened. On the other hand, notifyAll() wakes up ALL waiting threads; the scheduler decides which one will run.

    10. What queried in prolog
      Answer:
      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 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.

    11. What is quoted atom in prolog?
      Answer:
      • Alphanumeric atoms - alphabetic character sequence starting with a lower case letter. Examples: apple a1 apple_cart
      • Quoted atoms - sequence of characters surrounded by single quotes. Examples: ‘Apple’ ‘hello world’
      • Symbolic atoms - sequence of symbolic characters. Examples: & < > * - + >>

    12. What is managed code?
      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:
      ¥ Pointers may be used to enhance performance in real time applications.
      ¥ In non-.net DLLs some external functions requires a pointer as a parameter, such as Windows APIs that were written in C.
      ¥ Sometimes we need to inspect the memory contents for debugging purposes, or you might need to write an application that analyzes another application process and memory.

    13. How many ways the static binding can be define
      Answer:
      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
    If static, type may be specified by either an explicit or an implicit declaration
    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 (the first appearance of the variable in the program)

    1. Explain Stack Dynamic variable with example? 5
      Answer:
      • 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

    STUFF : array (1…N) of FLOAT;
    begin

    end;
    Advantage: flexibility - size need not be known until the array is about to be used

    1. Discuss the problem of Aliasing in JavaScript with a proper example? 5 + bad aspects of past multiple selectors? 3
      Answer:

    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:

    Now, when we say:
    A[0] = 5;
    We get the following:

    Now when we say:
    B = A;
    B points to the same array as A and creates an alias. This is shown below:

    Now if we make a simple assignment in B, we will also change A as shown below:
    B[0] = 10;

    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:


    A[0] = 10; // change an element of parameter A
    A = null; // change A itself
    }
    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
    }



  • my today paper 12:30 pm

    mcq were new from handouts 2 3 from past , 3 subjective Q were from past papers.
    Q no 1 write the simple Ada program whether a number is event or not?
    Q no 2 which data structre is more widely use in LISP pogramming.?
    Qno 3 write the ada program of given arguments Use for loop and use Put() method execpt PUt_Line() and write NEW_Line for new line the arguments are given below
    *
    **




    Q no 4 Set the value of variable a HEIGHT =12 and Weight=5.
    Q no 5 dotime dolist men sy function tha koi ,
    Q no 6 when Put_Line method is called in Ada does need to calL New_Line method or not?

    FORTRAN men sy mcq thy , Lisp men sy thy , ada men sy thy sonobol men sy thy , First program jis ny error door kiye kon sa tha ,readabilty men sy thy , lisp k function kon kon sy hn , etc

    best of luck


  • Cyberian's

    Today paper

    MCQS mostly are new one

    write two point that differentiate the LISP language from other language. 2

    Why we need single language Ada. 2

    Set the value of variable a HEIGHT =12 and Weight=5. 3

    What is difference b/w these two statements >(set-intersection L1 L2) and >(set-difference L1 L2) 5

    aik question ADA main sy that bhol gya hon



  • 2 questions of 5 marks
    1.write code in LISP to compute power of x to y page 76
    2. Write maps data types in SNOBOL.
    3 marks questions
    write IO header file for Ada…
    name functions that are used in List construction
    2 marks questions
    What are operators for Logical AND && and Logical OR || used in ADA.
    features added in COBOL not included in SNOWBOL.
    for MCQs you need to read the book some are from old papers too but for good marks reading is
    must.
    Remember me in your Prayers


  • Cyberian's

    @moaaz Thanks for sahiring @moaaz






Log in to reply
 

Hello Cyberians, We are hiring Global Moderator. Cheers!
Contact Us!
How to allow Copy Quiz VU! Download Chrome Extension!

Online Users

  • 4
  • 11
  • 1
  • 11
  • 5
  • 15

0
Online

64
Users

420
Topics

1.2k
Posts

About Us!

Cyberian offers practice exercises, Learning videos, and a Virtual learning dashboard that empower learners to study at their home pace in and outside of the classroom. We tackle math, science, computer programming, Bio, management sciences, history, art history, economics, and more. Our math missions guide learners from kindergarten to calculus using state-of-the-art, adaptive technology that identifies strengths and learning gaps. We've also partnered with institutions like VU, AIOU, Academy of Sciences, and MIT to offer specialised content.
Cyberian Mobile App

Suggested Topics

  • 11
  • 11
  • 5
  • 1
  • 4
  • 15
| |