CS508 Assignment No. 01
 Solution and Discussion


  • Cyberian's Gold

    Assignment No. 01 Semester Fall 2019
    CS508- Modern Programming Languages Total Marks: 20

    Due Date: Tuesday, 12 November 2019.

    Instructions
    Please read the following instructions carefully before solving & submitting assignment:
    It should be clear that your assignment will not get any credit if:
    • The assignment is submitted after due date.
    • The submitted assignment does not open or file is corrupt.
    • The assignment is completely or partially copied from (other student or ditto copied from handouts or internet).
    • Student ID is not mentioned in the assignment File or name of file is other than student ID.
    • The assignment is not submitted in .doc or .docx format.
    Uploading instructions
    Your submission must include:
    • Assignment should be in .doc or .docx format.
    • Save your assignment with your ID (e.g. bx180200786.doc).
    Assignment submission through email is NOT acceptable
    Objective
    The objective of this assignment is to learn how we can evaluate different programming languages based on syntax.
    Note:
    Your answer must follow the below given specifications.
    • Font style: “Times New Roman”
    • Font color: “Black”
    • Font size: “12”
    • Bold for heading only.
    • Font in Italic is not allowed at all.
    • Your answer should be precise and to the point, avoid irrelevant detail.

    Lectures Covered: This assignment covers Lecture # 01 – 07
    Deadline
    Your assignment must be uploaded/submitted at or before Tuesday, 12 November 2019.

    In this assignment we will evaluate 3 different languages on the basis of CPU time and Memory used for compilation.
    3 languages we will be using are:
    • Java
    • C#
    • C++
    We will use nested loop which will execute finite number of times. For the sake of consistency, we will be using an online compiler of each language from the same website.
    First you need to calculate the number of time both loops will run, for that we will use student id.
    From the last 4 numbers of student id, first two characters will be number of times the outer loop will execute and last two characters will be number of times the inner loop will execute.
    So, for example if student id is BC180201429 then b3700d9e-9af3-42a2-a3a5-0e283bb1c2c0-image.png

    The outer loop will execute 14 times and inner loop will execute 29 times.
    Use the following compiler https://www.jdoodle.com/.

    1. Note down the CPU Time and memory Used for all the languages and fill the following table with CPU time memory and write the code for all 3 languages also take screen shots for each language and paste it in your solution file.
      Language Code CPU Time Memory Used
      736d9677-6cb8-4ece-b665-09b46c738031-image.png

    2. You must write your student ID and language name in the code so it can be shown in the screen shot as attached below:

    3. You are required to attach screen shots for all 3 languages showing output and resources used.

    6c0ca58e-6108-4e8e-8b9d-34dbf3fb989e-image.png


  • Cyberian's Gold

    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


  • Cyberian's Gold

    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


  • Cyberian's

    using System;
    
    class Program
    {
    static void Main() {
    
    Console.Write("My Student is is BC160401656 \n");
    Console.Write("My Language is C#");
    
        int outerloop=1;
        int innerloop=1;
        for (int i=1;i<=29;i++){
            Console.Write("outerloop:" + outerloop++);
            if (outerloop == 30){
                Console.Write("\n----------\n");
                for (int j=1;j<=79;j++){
                    Console.Write("ïnnerloop:" + innerloop++);
                }
            }
        }
        
    }
    }
    

  • Cyberian's

    public class MyClass {
        public static void main(String args[]){
            System.out.println("My id is BS12345678");
            System.out.println("My language is Java");
            int outerloop=1;
            int innerloop=1;
            for(int i=1;i<=29;i++){
                System.out.print("outerloop:" + outerloop++);
                
                if (outerloop == 30){
                    System.out.println("\n----------\n");
                    for(int j=1;j<=79;j++){
                        System.out.print("innerloop:" + innerloop++);
                    }
                }
                
            }
        }
    }
    

  • Cyberian's Gold

    Correct Solution of C++

    #include <iostream>
    using namespace std;
    int main() {
    int outerloop=1;
    int innerloop=1;
        cout<<"My Student ID is BS12345678\n";
        cout<<"My coding Language is C++\n\n";
    for(int i=1;i<=29;i++){
        cout<<"outerloop:"<<outerloop++;
    
        if (outerloop == 30){
            cout<<"\n.......\n";
            for(int j=1;j<=79;j++){
            cout<<"innerloop:"<<innerloop++;
    
            }
        }
    }
    }
    

  • Cyberian's Gold

    Idea Solution


  • Cyberian's Gold


  • Cyberian's Gold

    @cyberian
    Please and check and any suggestion?


  • Cyberian's

    Java:

    public class MyClass {
    public static void main(String args[]) {
    
    System.out.println("My Student ID is BC160401656");
    System.out.println("My Language is JAVA");
    }
    }
    

    C#:

    using System;
    
    class Program
    {
    static void Main() {
    
    Console.Write("My Student is is BC160401656 \n");
    Console.Write("My Language is C#");
    }
    }
    

    C++:

    #include <iostream>
    
    using namespace std;
    
       int main() {
    
        cout"MY Student ID is BC160401656 \n " ;
    
        cout"Language is C++" ;
    
    }
    


Jan
27
(2 Views / 0 Upvotes)
0 Replies

10. COGNITIVE | CLOUD COMPUTING
709a4b58-3423-4963-9e29-bd995cadb5fc-image.png
Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. The term is generally used to describe data centers available to many users over the Internet.

Aug
19
(33 Views / 0 Upvotes)
2 Replies

Dear Students if you have any query regarding Final Term Exam
Please Feel Free to Ask Cyberian’s

Sep
18
(29 Views / 0 Upvotes)
0 Replies

یہ ۵ جی کیا ہے؟
دوسرے سیلولر نیٹ ورکوں کی طرح ، 5 جی نیٹ ورک سیلولرکلز کرنے کے انتظامات کو استعمال کرتے ہیں جو اپنے ڈومین کو علاقوں میں الگ کرتے ہیں اور ریڈیو لہروں کے ذریعہ انکوڈڈ معلومات بھیجتے ہیں۔ ہر سیل سائٹ کو سسٹم کی ریڑھ کی ہڈی سے وابستہ ہوتا ہے، اس سے قطع نظر کہ وائرڈ یا ریموٹ بیک ہاؤل ایسوسی ایشن کے ذریعے۔ 5 جی نیٹ ورک ایک قسم کی انکوڈنگ کا استعمال کریں گے جسے آف ڈی ایم کہتے ہیں ، جو انکوڈنگ کی طرح ہے جس میں 4 جی ایل ٹی ای کام کرتا ہے۔ تاہم ، ہوائی انٹرفیس کا مقصد...

Dec
17
(15 Views / 0 Upvotes)
21 Replies

Live Updates:
Pakistan’s former dictator Pervez Musharraf was on Tuesday sentenced to loss of life in the excessive treason case by way of a special court docket here, turning into the first navy ruler to get hold of the capital punishment in the country’s history.
567e9088-009d-47b4-a689-988ca233129e-image.png
A three-member bench of the special courtroom, hea...

Sep
6
(44 Views / 0 Upvotes)
0 Replies

فیس بک ڈیٹنگ اپنی پسند کی چیزوں کے ذریعہ پیار تلاش کرنا آسان بناتا ہے - اپنی مشترکہ چیزوں ، جیسے مفادات ، واقعات اور گروہوں کے ذریعہ معنی خیز تعلقات شروع کرنے میں مدد کرتا ہے۔ یہ ڈیٹنگ پروفائل بنانے میں کام کرتا ہے اور آپ کو زیادہ مستند نظر دیتا ہے کہ کوئی کون ہے۔
a5068e0f-944c-4e27-b28d-bec69b167543-image.png
آج ، ہم امریکہ میں فیس بک ڈیٹنگ کا آغاز کر رہے ہیں۔ ہم لوگوں کو انسٹاگرام ...

Aug
22
(101 Views / 1 Upvotes)
1 Replies

I’d say as a blogger and a IT student that it’s a great achievement for a local operator. As we know, communication is expanding globally and we do need faster networks to communicate.
IMG_20190822_194412.jpg

I’d say as a blogger and a IT student that it’s a great achievement for a local operator. As we know, communication is expanding globally and we do need faster netwo...

Sep
6
(15 Views / 0 Upvotes)
0 Replies

b244dd88-39a0-47bb-95f5-5af7cf1991c7-image.png

Image: justin sullivan / Getty Images

کمپنی نے منگل کو اعلان کیا کہ فیس بک اپنی چہرے کی شناخت کی خصوصیات کو بند کرنے میں آسان تر بنا رہا ہے اور اب وہ خود بخود نئے صارفین کو فیس ٹیگنگ کا انتخاب نہیں کرے گا۔

فیس بک اپنے صارفین کے اپ لوڈ کردہ فوٹو میں چہروں کی شناخت کے لئے چہرے کی پہچان کا استعمال...

Aug
6
(22 Views / 0 Upvotes)
0 Replies

Join the celebration at the all-new Apple Aventura.
Our new location opens Saturday, August 10 at 10:00 a.m.
Join us for the grand opening of our new store - located in a bigger space right across from the Aventura Slide Tower. Come celebrate your creativity during opening weekend with free Today at Apple sessions in music, photography, art, and more. And enjoy our vibrant Latin Music Fridays happening throughout the month of August.

Sep
6
(21 Views / 0 Upvotes)
0 Replies

آئی فونز اور ہیکرز پر حالیہ ہیک حملے کی وجہ سے جس کو دنیا میں سب سے زیادہ محفوظ فون سمجھا جاتا تھا اس کی سیکیورٹی کو نظرانداز کیا جارہا ہے۔ کیا آپ کو ایسی کوششوں سے بچایا گیا ہے؟ آپ خود کو ڈیجیٹل طور پر کیسے محفوظ کرسکتے ہیں؟

آئی فون ہیکنگ آپریشنوں کی ایک حالیہ لہر جنہوں نے جنوری تک “ایک ہفتے میں ہزاروں صارفین” کو متاثر کیا ، گوگل کے پروجیکٹ زیرو سیکیورٹی ٹیم کے محققین نے انکشاف کیا ہے۔ ایپل کے آئی فونز کو بڑے پیمانے پر وہاں کے سب سے محفوظ آلات سمجھا جاتا ہے۔ واقع...

Jul
31
(143 Views / 0 Upvotes)
1 Replies

To register your device, go to this link and create your account as an individual user. Select your user type International traveler
On submission of Signup form, a confirmation link will be received in your provided email address. Cl...

    Recent Topics


| DMCA.com Protection Status