Skip to content

CS508 - Modern Programming Languages

20 Topics 138 Posts
  • 0 Votes
    12 Posts
    852 Views
    M
    Smalltalk was the first purest ______ language and pioneered graphical user interface.

    Object Oriented

    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.

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

    A space is used as ______ for concatenation.
    Operator

    Sign is used for ______ in SONOBOL.
    Line Continuation

    Following are some of the reasons for studying concepts related to different
    programming languages EXCEPT
    Increased capability to design communication links

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

    A language evaluation criteria includes following factor EXCEPT
    Modularity

  • 0 Votes
    5 Posts
    1k Views
    cyberianC

    Assignment Cs508 2022 solution

  • 0 Votes
    9 Posts
    365 Views
    Pak LoveP

    @ozair said in CS508 GDB 1 Solution and Discussion:

    Re: CS508 GDB.1 Solution and Discussion

    Total Marks 5
    Starting Date Monday, February 15, 2021
    Closing Date Tuesday, February 16, 2021
    Status Open
    Question Title GDB
    Question Description
    In a programming world, Lambda Expression (i.e. lambda function) is essentially a block of code that can be assigned to a variable, passed as an argument, or returned from a function call. It has been part of several programming languages like Smalltalk, Lisp, Ruby, Scala, Python, Java and C# etc. for quite some time.

    In context of C# programming, a lambda can be used instead of an anonymous method/function where we do not need to provide access modifier, return type and even name of the method. For example, the following anonymous method checks if a student is teenager or not:

    Listing 1: (anonymous method in C# to check if a student is teenager or not)

    delegate(Student std) {

    return std.Age > 12 && std.Age < 20;

    }

    While the same functionality can be achieved by using lambda as;

    Listing 2: (checking if a student is teenager or not using lambda in C#)

    std => std.Age > 12 && std.Age < 20;

    Here, we can see that the code has been shortened (i.e. writability increased). However, it makes the code relatively difficult to understand as “std” in listing 2 is ambiguous (i.e. readability decreased). But what about Reliability?

    Being a programming language expert, you are required to compare both approaches (i.e. code written with/without lambda) and state which one is better in terms of Reliability in C# programming language.

    Anonymous Method Limitations

    It cannot contain jump statement like goto, break or continue.
    It cannot access ref or out parameter of an outer method.
    It cannot have or access unsafe code.
    It cannot be used on the left side of the is operator.

  • 0 Votes
    2 Posts
    119 Views
    Tahir BalochT

    Please share ideas solution

  • 0 Votes
    3 Posts
    159 Views
    zaasmiZ

    main.adb

    with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with per; use per; with Mn; use Mn; procedure main is -- Creating object of type Men men1 : Men; len: Natural; Begin -- Taking input ID Put_Line("Enter ID : "); Get_Line(men1.ID, len); -- Taking input Name Put_Line("Enter Name : "); Get_Line(men1.Name, len); -- Taking input Gender Put_Line("Enter Gender : "); Get_Line(men1.Gender, len); -- Taking input Height Put_Line("Enter Height : "); Get(men1.Height); -- Taking input Age Put_Line("Enter Age : "); Get(men1.Age); new_line(2); -- Print Function calling print(men1); new_line(3); end main;

    per.ads

    package Per is type Person is tagged record Name: String(1..30):= " "; Age: Integer :=0; Gender: String(1..10) := " "; end record; procedure print(Self : in out Person); end Per;

    main.adb

    with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; package body Per is procedure print(Self : in out Person) is begin Put_Line("Name is " & Self.Name); Put_Line("Age is " & Integer'Image (Self.Age)); Put_Line("Gender is " & Self.Gender); end print; end Per;

    mn.ads

    with per; use per; package Mn is type Men is new Person with record Height: Float := 0.0; ID: String(1..15) := " "; end record; overriding procedure print(Self : in out Men); end Mn;

    mn.adb

    with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with per; use per; package body Mn is procedure print(Self : in out Men) is begin Put_Line("ID is " & Self.ID); Put_Line("Name is " & Self.Name); Put_Line("Age is " & Integer'Image (Self.Age)); Put_Line("Gender is " & Self.Gender); Put_Line("Height is " & Float'Image (Self.Height)); end print; end Mn;
  • 0 Votes
    3 Posts
    387 Views
    zaasmiZ

  • 0 Votes
    3 Posts
    2k Views
    zaasmiZ

    Solution 100% outer = 1 OUTLOOP OUTPUT = 'Outer ' outer outer = outer + 1 iner = 1 INLOOP OUTPUT = 'Iner ' iner iner = iner + 1 LE(iner, 22) : S(INLOOP) LE(outer, 11) : S(OUTLOOP) OUTPUT = 'My id is BC120401122' END
  • 0 Votes
    5 Posts
    162 Views
    cyberianC

    Looking at these VMs at the highest-level, the differences between the CLR and JVM seem almost negligible. However, in many (if not most) cases, the differences at the VM-level mirror the key differences between the languages that use them. Because of the way these VMs, and their corresponding languages, were built, each functions slightly differently in order to provide the functional capabilities that their creators wanted to provide.

    What do you think about the differences between the CLR and JVM? Will you choose your next programming language based on which VM it uses? Let us know in the comments below!

  • 0 Votes
    20 Posts
    5k Views
    zareenZ

    _________ operator in Prolog is used for List construction and also for List dismantling. CS508

    !(Sign of exclamation)
    |(Vertical Slash) PG # 90
    :(Colon)
    None of the given

  • 0 Votes
    1 Posts
    189 Views
    No one has replied
  • 0 Votes
    6 Posts
    278 Views
    zareenZ

  • 0 Votes
    12 Posts
    5k Views
    zareenZ

    LISP was basically developed to solve ________ problems.
    Page:75
    LISP was one of the earliest programming language. It was designed at MIT for artificial
    intelligence and it has since been the defacto standard language for the AI community,
    especially in the US.

    072817c9-7138-4d6a-99dc-d020152ea713-image.png

    For immediate value assignment ______ sign is used.
    Page 37
    The $ is used for immediate value assignment even if the entire pattern does not match. It
    is used as follows:

    6fe8d13e-31bd-4bdd-81ea-17b0495a4b8b-image.png

    Following statement returns the union of the two list in LISP.
    Page : 68
    9dbae1e8-aa7c-46bf-87fe-8e6659e07671-image.png

    Block statement in Ada is very similar to a block in _______.
    Page:56
    de1669d5-56d8-4d59-b52a-58677f3d9abc-image.png

    _____________ was considered good for describing algorithms.
    Page:24
    d534ad69-8310-4efa-86a3-0060856e396c-image.png

    The declarative language among the following is CS508 C
    Page:77
    438cf147-2cbe-4d36-b281-228dc08b02c2-image.png

    In Ada programming language Tagged types are used for _____
    Page:59
    16f16de6-d959-4ecd-9661-eb09c9f33208-image.png

    _____ are a type of Aliasing.

    daea66c9-b2c8-41b1-b67a-fb20e558a237-image.png

    How many element(s) are there in LISP list (a (b c))? CS508 1
    Page:63
    76581dee-85fe-42b4-997b-95b324e89c41-image.png

    In __________, Enumeration type can also be used as indexes in arrays.
    Page:51
    731a51f0-ba8f-418d-a763-2c0630b2b6c8-image.png

  • CS508 Quiz 1 Solution and Discussion Fall 2019

    1
    0 Votes
    1 Posts
    99 Views
    No one has replied
  • 0 Votes
    4 Posts
    251 Views
    zareenZ

    Fall 2019_CS508_2_SOL-1.rar

  • 1 Votes
    9 Posts
    380 Views
    zareenZ

    Solution:
    Java:

    public class MyClass { public static void main(String args[]) { System.out.println("My id is BC180401429"); System.out.println("** Language is JAVA **"); for(int i=0;i<=14;i++){ for(int j=0;j<=29;j++){ System.out.print("Outer:"+i+"Inner:"+j); } } } }

    5608a2a6-7df7-4a31-9212-8e1f6b861c3a-image.png

    C#:

    using System; class Program { static void Main() { Console.WriteLine("My id is BC180401429"); Console.WriteLine("** Language is C# **"); for(int i=0;i<=14;i++){ for(int j=0;j<=29;j++){ Console.Write("Outer:"+i+"Inner:"+j); } } } }

    cbc743d8-98fa-445b-9f7e-70c3fee295de-image.png

    C++:

    #include <iostream> using namespace std; int main() { cout<< "My id is BC180401429 \n"; cout<< "** Language is C++ ** \n"; for(int i=0;i<=14;i++){ for(int j=0;j<=29;j++){ cout<< "Outer:"<<i<<"Inner:"<<j; } } }

    d8150fad-1df3-4376-b59b-fcfa4dfb6dba-image.png

  • CS508 GDB.1 Solution and Discussion

    Solved
    11
    0 Votes
    11 Posts
    2k Views
    zaasmiZ

    I think it will be really hard to create one single language all could and importantly would used by all.

    All software today could be written in assembly, but it would mean getting up a website could take 6–12 months and probably cost a few million….

    If we ever had a single language all would use, that language would need to do 5 things really well.

    And while I have seen languages that can do 2–3 out of 5, I have never seen language that can do all 5.

    Have really low system overhead and compile to machine code on any platform.

    Have terse easy to learn syntax.

    Support all the programming paradigms. Procedural, object oriented & functional.

    Have really large ecosystem 3rd party packages and great developer tooling for solving any problem in any industry.

    Have highly performant bridge to call directly(no REST/JSON/SOAP/XML mess…) to any language. Even if we decided today to rewrite all software to this new miracle language it would take 10 years to modernize all the legacy stuff so integration needs to be seamless.