Navigation

    Cyberian
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Pro Blog
    • Users
    • Groups
    • Unsolved
    • Solved
    1. Home
    2. Pak Love
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Groups 0

    Pak Love

    @Pak Love

    0
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Pak Love Unfollow Follow

    Latest posts made by Pak Love

    • RE: CS508 GDB 1 Solution and Discussion

      @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.

      posted in CS508 - Modern Programming Languages
      Pak Love
      Pak Love
    • CS201 Assignment 3 Solution and Discussion

      Assignment No. 3
      Semester: Spring 2020
      CS201 – Introduction to Programming Total Marks: 20

      Due Date: 23/07/2020
      Instructions
      Please read the following instructions carefully before submitting assignment:
      It should be clear that your assignment will not get any credit if:

      o Assignment is submitted after due date.
      o Submitted assignment does not open or file is corrupt.
      o Assignment is copied (From internet/students).

      Software allowed to develop Assignment

      • Dev C++

      Objectives:
      To enable students to understand and practice the concepts of:
      • Classes
      • Objects
      • Loops
      • File handling

      Assignment Submission Instructions
      You have to submit only .cpp file on the assignments interface of CS201 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.
      Please note again, assignment submitted other than .cpp format will get zero marks.

      Assignment

      Assignment Statement:
      Assume you are working as a sports data analyst for a university named “ABC University”. Your job is to collect data of different players and judge their performance. Based on the data collected from players, their performance for a given season will be analyzed and comparison among players of the team will be made for selection. For this purpose, you are required to write a program in C++ that will create a class named “Sports”. The class will create a file named “Sample.txt” in the current directory. You will use file handling mechanism for entering player’s information. Following tasks are required:

      • You are required to create a class named “Sports”.
      • Declare three data members of Sports class named playername, game_name and total_wins with appropriate data types.
      • The class will consist of 6 functions named input_file(), read_file(), notstartingwithA(), lower(), upper() and digit() respectively along with a default constructor. The description of each function is given with the screenshots in the “Sample output”.
      • In the main() function an object of the class “Sports” will be created and it will be used along with switch statement to call the functions mentioned above. i.e. input_file(), read_file(), notstartingwithA(), lower(), upper() and digit().
      • Initially a menu will be displayed consisting of different choices as shown below:

      • User will enter a choice from the choices given in the menu. Output of each selected number is shown in the output samples below for detailed description.

      Sample Output:-
      1.
      • In the first step the following menu will appear at the output screen.
      f8f6029c-864a-435d-acbb-2d6ae4424899-image.png

      • User will first populate file “Sample.txt” before reading the file as given below.
      3dec4cfc-a885-4439-8433-2a1d8e1664ac-image.png

      • The function named input_file() will take input from user and store it in the file named “Sample.txt”. If a user wants to enter second record, the first record in the file will not be deleted; rather new data will be added at the end of the file.
      e01cf71b-04af-4e7a-b9ee-dedb140148c5-image.png

      • The function read_file() will read all data stored in the file “Sample.txt” from start to end.
      7cc2df64-2f12-402b-bd97-2c2956f13ca8-image.png

      • The function notstartingwithA() will check the file and find all lines of the file “Sample.txt” that are not started with character “A” including blank lines. E.g. the above data will consists of 3 lines in the file. notstartingwithA() function will count all those line and display the count on output screen as given below.
      10a7c58f-2791-49e0-96b3-ba8d0484cac8-image.png

      • The function lower() will find all those lines that are started with lower characters in the file “Sample.txt” and display the count on outputs screen as given below.
      82fa1773-b3ed-4cce-9cbf-6bdc67fc9e7f-image.png

      • The function upper() will find all those lines that are started with an upper case character in the file “Sample.txt” and display the count on outputs screen as given below.
      683bd7c4-a1ba-4494-816d-91b5532421ee-image.png

      • The function digit() will find all those lines that are started with a digits in the file “Sample.txt” and display the count on output screen.
      056377ce-9061-4b72-8eff-b8eb07b75653-image.png

      • Program will also check for invalid choices as given below.
      e1bfd9c6-5642-47b1-9068-7e157b981678-image.png

      Best of luck

      Lectures Covered: (Lecture # 17- 27) and Solution Deadline: (23/07/2020).

      posted in CS201 - Introduction to Programming
      Pak Love
      Pak Love
    • RE: CS101 Topic-002. Breadth first learning Discussion

      how A=67 B=66 a=97 and space =32.i didn`t get the concept behind this slide. please elaborate.

      posted in CS101- Introduction to Computer
      Pak Love
      Pak Love