• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

DisplayMonk

Solution to your problem

  • Home
    • Privacy Policy
  • About Us
  • Repair Tips
  • Schematics Bios
  • Course
  • Online Jobs
  • Tools
  • Enquiry / Contact
Home » university students updated material

university students updated material

TYIT Practical Softwares and notes on demand Mumbai university

April 15, 2023 by displaymonk

university students softwares all download

Below are the software for TYIT Students of Mumbai University. The download link is given below:

Software Names for TYIT Practicals

  • Visual Studio Community
  • swipl windows 64 version 742
  • sql server 2017 SSEI
  • netbeans 8.1 windows
  • netbeans 7.4 windows
  • mysql installer 8.0.21.0
  • mongodb windows 32 64 version 4.2.8

https://drive.google.com/drive/folders/10-CqHfjIiIni-tDqN7sUv-08RZdq9qiF

Filed Under: university students updated material Tagged With: TYIT Practical Mumbai university, university students softwares

SYCS Mumbai University Theory Of Computation practicals solutions and notes on demand updated

April 15, 2023 by displaymonk

SYCS Theory Of Computation Practicals Mumbai University

below are practicals and their solutions of Theory of Computation for Mumbai University SYBsc Computer Science updated complete list.

Aim : Write a program for tokenization of given input

Code:

my_text = “”” India is a land of various cultures and heritage. It is the seventh-largest country by area and the second-most populous country globally. The peacock is India’s national bird, and the Bengal tiger is the country’s national animal. The national song is named Vande Matram and is written by Bankimchandra Chatterji. “””

print(my_text.split(‘. ‘))

Output :

Aim : Write a program for generating regular expressions for regular grammer.

Code :

import re

s = ‘A computer science book for students’

match = re.search(r’students’, s)

print(‘Start Index:’, match.start())

print(‘End Index:’, match.end())

Output :

Aim : Write a program for generating derivation sequence / language for the given sequence of productions.

Aim : Design a Program for creating machine that accepts the string always ending with 101.

Code :

arr = [1, 1, 1, 4, 1, 1, 1, 5, 5, 5, 3, 8 ,2 ,3 ,4]

size = len(arr)

temp = 0

print(“The concecutive ones are: \n”);

for i in range(size – 2):

    if arr[i] == 1 and arr[i] == arr[i + 1] and arr[i + 1] == arr[i + 2]:

          temp = temp +arr[i]

print(“Number of 1’s are”,temp);

Output :

Aim : Design a program for accepting decimal number divisible by 2.

Code :

def stateq0(n):

                if (len(n)==0):

                                print(“Divisible by 2”)

                else:

                                if(n[0]==’0′):

                                                stateq0(n[1:])

                                elif (n[0]==’1′):

                                                stateq1(n[1:])

def stateq1(n):

                if (len(n)==0):

                                print(“Not divisible by 2”)

                else:

                                if(n[0]==’0′):

                                                stateq0(n[1:])

                                elif (n[0]==’1′):

                                                stateq1(n[1:])                   

n=int(input())

n = bin(n).replace(“0b”, “”)

stateq0(n)

Output :

Aim : Design a program for creating a machine which accepts string having equal no. of 1’s and 0’s.

Code  :

Output :

Filed Under: university students updated material Tagged With: SYCS Mumbai University theory of computation practicals solutions updated

FYIT Mumbai University practicals solutions and notes on demand all updated 2023

April 15, 2023 by displaymonk

below are practicals and their solutions for Mumbai university FYBsc computer science 2023 updated complete list.

below are practicals and their solutions for Mumbai University FYBsc information technology 2023 updated complete list.

Aim : Write a C++ program to create a simple calculator.

Code:

# include <iostream>

using namespace std;

int main() {

  char op;

  float num1, num2;

  cout << “Enter operator: +, -, *, /: “;

  cin >> op;

  cout << “Enter two operands: “;

  cin >> num1 >> num2;

  switch(op) {

    case ‘+’:

      cout << num1 << ” + ” << num2 << ” = ” << num1 + num2;

      break;

    case ‘-‘:

      cout << num1 << ” – ” << num2 << ” = ” << num1 – num2;

      break;

    case ‘*’:

      cout << num1 << ” * ” << num2 << ” = ” << num1 * num2;

      break;

    case ‘/’:

      cout << num1 << ” / ” << num2 << ” = ” << num1 / num2;

      break;

    default:

      cout << “Error! operator is not correct”;

      break;

  }

  return 0;

}

Output :

Aim : Write a C++ program to convert seconds into hours, minutes and seconds.

Code :

#include<iostream>

using namespace std;

int main(){

  cout << “Enter total seconds”;

  int totalSeconds;

  cin >> totalSeconds;

  int hours = totalSeconds / 3600;

  int minutes = (totalSeconds % 3600) / 60;

  int seconds = totalSeconds % 60;  

  cout << “\n Hours : ” <<hours<<” | Minutes : “<<minutes<<” | Seconds : ” << seconds << endl;  

}

Output :

Aim : Write a C++ program to find the volume of a square, cone, and rectangle.

Code :

#include <iostream>

#include <string.h>

using namespace std;

int main ()

   {

      const float pi = 3.14159;

      float R, H, V;

      cout << “Input Cone’s radius: “;

      cin >> R;

      cout << “Input Cone’s height: “;

      cin >> H;

    // Cone’s volume.

    V = (1.0/3.0)*pi*(R*R)*H;

    cout << “The volume of the cone is: ” << V ;

    return 0;

}

Output :

Code :

#include <iostream>

#include <string>

using namespace std;

int main ()

{

  float S, V;

  cout << “Input Square’s side: “;

  cin >> S;

  // Square’s volume.

  V = S*S*S;

  cout << “The volume of the square is: ” << V ;

  return 0;

}

Output :

Code :

#include <iostream>

#include <string>

using namespace std;

int main ()

{

  const float pi = 3.14159;

  float L, W, H, V;

  cout << “Input Rectangle’s length: “;

  cin >> L;

  cout << “Input Reactangle’s height: “;

  cin >> H;

  cout << “Input Reactangle’s width: “;

  cin >> W;

  // Rectangle’s volume.

  V = L*W*H;

  cout << “The volume of the cone is: ” << V ;

  return 0;

}

Output :

Aim : Write a C++ program to find the greatest of three numbers.

Code :

#include <iostream>

using namespace std;

int main() {

    double n1, n2, n3;

    cout << “Enter three numbers: “;

    cin >> n1 >> n2 >> n3;

    if(n1 >= n2 && n1 >= n3)

        cout << “Largest number: ” << n1;

    else if(n2 >= n1 && n2 >= n3)

        cout << “Largest number: ” << n2;

    else

        cout << “Largest number: ” << n3;

    return 0;

}

Output :

Aim : Write a C++ program to find the sum of even and odd n natural numbers

Code :

#include<iostream>

using namespace std;

int main()

{

                int number, maximum, evenSum = 0, oddSum = 0;

                cout << “\nPlease Enter the Maximum Limit for Even & Odd Numbers  =  “;

                cin >> maximum;            

                for(number = 1; number <= maximum; number++)

                {

                                if ( number % 2 == 0 )

                                {

                                                evenSum = evenSum + number;

                                }

                                else

                                {

                                                oddSum = oddSum + number;

                                }

                }

                cout << “\nThe Sum of All Even Numbers upto ” << maximum << ” = ” << evenSum;

                cout << “\nThe Sum of All Odd Numbers upto ” << maximum << ”  = ” << oddSum;

                return 0;

}

Output :

Aim : Write a C++ program to find the sum of even and odd n natural numbers.

Code :

#include<iostream>

using namespace std;

int main()

{

                int number, maximum, evenSum = 0, oddSum = 0;

                cout << “\nPlease Enter the Maximum Limit for Even & Odd Numbers  =  “;

                cin >> maximum;            

                for(number = 1; number <= maximum; number++)

                {

                                if ( number % 2 == 0 )

                                {

                                                evenSum = evenSum + number;

                                }

                                else

                                {

                                                oddSum = oddSum + number;

                                }

                }

                cout << “\nThe Sum of All Even Numbers upto ” << maximum << ” = ” << evenSum;

                cout << “\nThe Sum of All Odd Numbers upto ” << maximum << ”  = ” << oddSum;

                return 0;

}

Output :

Aim : Write a C++ program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.

Code :

#include <iostream>

using namespace std;

int main() {

    int num, i, upto;

    cout << “Find prime numbers upto : “;

    cin >> upto;

    cout << endl << “All prime numbers upto ” << upto << ” are : ” << endl;

    for(num = 2; num <= upto; num++) {

        for(i = 2; i <= (num / 2); i++) {

            if(num % i == 0) {

                i = num;

                break;

            }

        }

        if(i != num) {

            cout << num << ” “;

        }

    }

    return 0;

}

Output :

Aim : Write a C++ program using classes and object Student to print name of the student, roll_no. Display the same.

Code :

#include <iostream> 

using namespace std; 

class Student { 

   public: 

       int id;

       string name;

       int roll_no; 

       void insert(int i, string n, int rn)   

        {   

            id = i;   

            name = n;   

            roll_no = rn; 

        }   

       void display()   

        {   

            cout<<” ID is: “<<id<<”  Name is: “<<name<<” Roll number is: “<<roll_no<<endl;   

        }   

}; 

int main(void) { 

    Student s1;   

    Student s2;

                s1.insert(201, “Sonali”, 11);   

    s2.insert(202, “Arnav”, 12);   

    s1.display();   

    s2.display();   

    return 0; 

} 

Output :

Aim : Write a C++ program for Structure bank employee to print name of the employee, account_no. and balance. Display the same also display the balance after withdraw and deposite.

Code :

#include<iostream>

#include<stdio.h>

#include<string.h>

using namespace std;

class bank

{

        int acno;

        char nm[100], acctype[100];

        float bal; 

   public:

        bank(int acc_no, char *name, char *acc_type, float balance)

        {

                acno=acc_no;

                strcpy(nm, name);

                strcpy(acctype, acc_type);

                bal=balance;

        }

        void deposit();

        void withdraw();

        void display();

};

void bank::deposit()

{

        int damt1;

        cout<<“\n Enter Deposit Amount = “;

        cin>>damt1;

        bal+=damt1;

}

void bank::withdraw()

{

        int wamt1;

        cout<<“\n Enter Withdraw Amount = “;

        cin>>wamt1;

        if(wamt1>bal)

                cout<<“\n Cannot Withdraw Amount”;

        bal-=wamt1;

}

void bank::display()

{

        cout<<“\n ———————-“;

        cout<<“\n Accout No. : “<<acno;

        cout<<“\n Name : “<<nm;

        cout<<“\n Account Type : “<<acctype;

        cout<<“\n Balance : “<<bal; 

}

int main()

{

        int acc_no;

        char name[100], acc_type[100];

        float balance;

        cout<<“\n Enter Details: \n”;

        cout<<“———————–“;

        cout<<“\n Accout No. “;

        cin>>acc_no;

        cout<<“\n Name : “;

        cin>>name;

        cout<<“\n Account Type : “;

        cin>>acc_type;

        cout<<“\n Balance : “;

        cin>>balance;

        bank b1(acc_no, name, acc_type, balance);

        b1.deposit();

        b1.withdraw();

        b1.display();

        return 0;

}

Output :

Aim : Write a C++ Program to design a class having static member function named showcount() which has the property of displaying the number of objects created of the class.

Code :

#include <iostream>

using namespace std;

class My_Class{

   private:

      static int count;

   public:

      My_Class() { //in constructor increase the count value

         cout << “Calling Constructor” << endl;

         count++;

      } static int objCount() {

         return count;

      }

   };

int My_Class::count;

main() {

   My_Class my_obj1, my_obj2, my_obj3;

   int cnt;

   cnt = My_Class::objCount();

   cout << “Number of objects:” << cnt;

}

Output :

Aim : Write a Program to find Maximum out of Two Numbers using friend function.

Code :

#include<iostream>

using namespace std;

class Test {

private:

   int x, y;

public:

   void input() {

       cout << “Enter two numbers:”;

       cin >> x>>y;

   }

   friend void find(Test t);

};

void find(Test t) {

   if (t.x > t.y) {

       cout << “Largest is:” << t.x;

   } else {

       cout << “Largest is:” << t.y;

   }

}

int main() {

   Test t;

   t.input();

   find(t);

   return 0;

}

Output :

Aim : Write a C++ Program using copy constructor to copy data of an object to another object.

Code :

#include <iostream>

using namespace std;

class Point {

private:

    int x, y;

public:

    Point(int x1, int y1)

    {

        x = x1;

        y = y1;

    }

    Point(const Point& p1)

    {

        x = p1.x;

        y = p1.y;

    }

    int getX() { return x; }

    int getY() { return y; }

};

int main()

{

    Point p1(10, 15);

    Point p2 = p1;

    cout << “p1.x = ” << p1.getX() << “, p1.y = ” << p1.getY();

    cout << “\np2.x = ” << p2.getX() << “, p2.y = ” << p2.getY();

    return 0;

}

Output :

Aim : Write a C++ Program to allocate memory dynamically for an object of a given class using class’s construction.

Code :

#include <iostream>

using namespace std;

class geeks {

    const char* p;

public:

    geeks()

    {

        p = new char[6];

        p = “geeks”;

    }

    void display()

    {

        cout << p << endl;

    }

};

int main()

{

    geeks obj;

    obj.display();

}

Output :

Aim : Write a C++ program to design a class representing complex numbers and having the functionality of performing addition and multiplication of two complex numbers using operator overloading.

Code :

#include<iostream>

using namespace std;

class Complex

{

public:

int real,img;

void add(Complex c1,Complex c2)

{

int x,y;

x=c1.real+c2.real;

y=c1.img+c2.img;

cout<<“\n(“<<c1.real<<“+”<<c1.img<<“i)+(“<<c2.real<<“+”<<c2.img<<“i)=(“<<x<<“+”<<y<<“i)”;

}

void multiply(Complex c1,Complex c2)

{

int x,y;

x=c1.real*c2.real-c1.img*c2.img;

y=c1.real*c2.img+c1.img*c2.real;

cout<<“\n(“<<c1.real<<“+”<<c1.img<<“i)*(“<<c2.real<<“+”<<c2.img<<“i)=(“<<x<<“+”<<y<<“i)”;

}

Complex operator ++()

{

Complex x;

x.real=++real;

x.img=++img;

return x;

}

};

int main ()

{

Complex a,b,c,d,e;

cout<<“\nEnter real and imaginary part of first complex number:”;

cin>>a.real>>a.img;

cout<<“\nEnter real and imaginary part of second complex number:”;

cin>>b.real>>b.img;

c.add(a,b);

d.multiply(a,b);

cout<<“\n++(“<<a.real<<“+”<<a.img<<“i)=(“;

++a;

cout<<a.real<<“+”<<a.img<<“i)”;

return 0;

}

Output :

Aim : Write a C++ program to overload new/delete operate in a class.

Code :

#include<iostream>

#include<stdlib.h>

using namespace std;

class student

{

    string name;

    int age;

public:

    student()

    {

        cout<< “Constructor is called\n” ;

    }

    student(string name, int age)

    {

        this->name = name;

        this->age = age;

    }

    void display()

    {

        cout<< “Name:” << name << endl;

        cout<< “Age:” << age << endl;

    }

    void * operator new(size_t size)

    {

        cout<< “Overloading new operator with size: ” << size << endl;

        void * p = ::operator new(size);       

       return p;

    }

    void operator delete(void * p)

    {

        cout<< “Overloading delete operator ” << endl;

        free(p);

    }

};

int main()

{

    student * p = new student(“Yash”, 24);

    p->display();

    delete p;

}

Output :

Aim : Write a C++ program to accesss members of a STUDENT class using pointer to object members.

Code :

#include <iostream>

using namespace std;

class Box {

   public:

      // Constructor definition

      Box(double l = 2.0, double b = 2.0, double h = 2.0) {

         cout <<“Constructor called.” << endl;

         length = l;

         breadth = b;

         height = h;

      }

      double Volume() {

             return length * breadth * height;

      }

   private:

      double length;     // Length of a box

      double breadth;    // Breadth of a box

      double height;     // Height of a box

};

int main(void) {

   Box Box1(3.3, 1.2, 1.5);   

   Box Box2(8.5, 6.0, 2.0);   

   Box *ptrBox;  

   ptrBox = &Box1;  

   cout << “Volume of Box1: ” << ptrBox->Volume() << endl;

   ptrBox = &Box2;

   cout << “Volume of Box2: ” << ptrBox->Volume() << endl;

   return 0;

}

Output :

Aim : Write a C++ Program to generate Fibonacci Series by using Constructor to initialize the Data Members.

Code :

#include<iostream>

using namespace std;

class fibonacci

{

    long int a,b;

    public:

    fibonacci()

    {

        a=-1;

        b=1;

    }

    void fibseries(int n)

    {

        int i,next;

        cout<<“\n Resultant fibonacci series”;

        cout<<“\n—————————–\n”;

        for(i=0;i<n;i++)

        {

            next=a+b;

            cout<<next<<endl;

            a=b;

            b=next;

        }

    }

};

int main()

{

    fibonacci f;

    int n;

    cout<<“\n Fibonacci series \n”;

    cout<<“\n Enter the range = \n”;

    cin>>n;

    f.fibseries(n);

    return 0;

}

Output :

Aim : Write a C++ Program that illustrate single inheritance.

Code :

#include <iostream>

using namespace std;

class base  

{

   public:

     int x;

   void getdata()

   {

     cout << “Enter the value of x = “;

                 cin >> x;

   }

 };

class derive : public base  

{

   private:

    int y;

   public:

   void readdata()

   {

     cout << “Enter the value of y = “; cin >> y;

   }

   void product()

   {

     cout << “Product = ” << x * y;

   }

 };

 int main()

 {

    derive a;

    a.getdata();

    a.readdata();

    a.product();

    return 0;

 }     

Output :

Aim : Write a C++ Program that illustrate multiple inheritance.

Code :

#include<iostream>

using namespace std;

class A

{

public:

  A()  { cout << “A’s constructor called” << endl; }

};

class B

{

public:

  B()  { cout << “B’s constructor called” << endl; }

};

class C: public B, public A  // Note the order

{

public:

  C()  { cout << “C’s constructor called” << endl; }

};

int main()

{

    C c;

    return 0;

}

Output :

Aim :  Write a C++ Program that illustrate multi level inheritance.

Code :

#include <iostream>

using namespace std;

class Vehicle{

   public:

      void vehicle(){

         cout<<“I am a vehicle\n”;

      }

};

class FourWheeler : public Vehicle{

   public:

      void fourWheeler(){

         cout<<“I have four wheels\n”;

      }

};

class Car : public FourWheeler{

   public:

      void car(){

         cout<<“I am a car\n”;

      }

};

int main(){

   Car obj;

   obj.car();

   obj.fourWheeler();

   obj.vehicle();

   return 0;

}

Output :

Aim : Write a C++ Program that illustrate Hierarchical inhertitance.

Code :

#include <iostream>

using namespace std;

class A

{

    public:

                int x, y;

                void getdata()

                {

                    cout << “\nEnter value of x and y:\n”; cin >> x >> y;

                }

};

class B : public A

{

    public:

                void product()

                {

                    cout << “\nProduct= ” << x * y;

                }

};

class C : public A

{

    public:

                void sum()

                {

        cout << “\nSum= ” << x + y;

                }

};

int main()

{

    B obj1;        

    C obj2;        

    obj1.getdata();

    obj1.product();

    obj2.getdata();

    obj2.sum();

    return 0;

} 

Output :

Aim : Write a C++ Program illustrating how the constructors are implemented the order in which they are called when the classes are inherited. Use three classes named alpha, beta, gamma such that alpha, beta are base class and gamma is derived class inheriting alpha and beta.

Code :

#include <iostream>

using namespace std;

class Alpha

{

        int x;

        public:

                // constructors

                Alpha(int i)

                {

                        x = i;

                        cout << “\n Alpha constructed”;

                }

               void show_alpha()

               {

                      cout << ” X = ” << x << “\n”;

               }

};

class Beta : public Alpha

{

       float p, q;

       public:

                  // Constructor

                Beta(int i, float a, float b):Alpha(i), p(a), q(b+p)

                {

                       cout << “\n Beta Constructed”;

                }

                void show_beta()

                {

                       cout << ” P = ” << p << “\n”;

                       cout << ” Q = ” << q << “\n”;

                }

};

class delta

{

       int d;

       public:

                 delta(int a) { d = a; cout << “\n Delta Constructed”;}

                 void show_delta()

                 {

                         cout << ” d = ” << d << “\n”;

                 }

};

class Gamma : public Beta, public delta

{

        int u, v;

        public:

                  // Constructor

                  Gamma(int a, int b, float c): Beta(a,c,c), delta(a), u(a)

                   {

                            v = b;

                           cout << “\n Gamma constructed”;

                   }

                  void show_gamma()

                  {

                           cout << ” U = ” << u << “\n”;

                           cout << ” V = ” << v << “\n”;

                  }

};

int main()

{

        Gamma g(2, 4, 2.5);

        cout << “\n\n Display member values ” << “\n\n”;

        g.show_alpha();

        g.show_beta();

        g.show_delta();

        g.show_gamma();

   return 0;

}

Output :

Aim : Write a C++ Program to design a student class represing student roll no. and a test class (derived class of student) representing the scores of the student in various subjects and sports class representing the score in sports. The sports and test class should be inherited by a result class having the functionality to add the scores and display the final result for a student.

Code :

#include<iostream>

using namespace std;

class student

{

 protected:

 int roll_number;

 public:

 void get_number(int a)

 {

  roll_number = a;

 }

 void put_number(void)

 {

  cout<<“Roll No:”<<roll_number<<“\n”;

 }

};

class test : public student

{

 protected:

 float part1, part2;

 public:

 void get_marks(float x, float y)

 {

  part1 = x;

  part2 = y;

 }

 void put_marks(void)

 {

  cout<<“Marks obtained”<<“\n”<<“part1 =”<<part1<<“\n”<<“part2 =”<<part2<<“\n”;

 }

};

class sports

{

 protected:

 float score;

 public:

 void get_score(float s)

 {

  score = s;

 }

 void put_score(void)

 {

 cout<<“Sports wt:”<<score<<“\n\n”;

 }

};

class result : public test, public sports

{

 float total;

 public:

 void display(void);

};

void result ::display(void)

{

 total = part1 + part2 + score;

 put_number();

 put_marks();

 put_score();

 cout<<“Total Score:”<<total<<“\n”;

}

int main()

{

 result student_1;

 student_1.get_number (1234);

 student_1.get_marks (27.5, 33.0);

 student_1.get_score (6.0);

 student_1.display ();

 return 0;

}

Output :

Aim : Write a C++ program to maintain the records of person with details (Name and Age) and find the eldest among them. The program must use the pointer to return the result.

Code :

#include<iostream>

using namespace std;

class Records

{

    int age;

    string name;

    public:

        Records() {};

        Records(string n,int a): name(n),age(a) {}

        void show()

        {

            cout<<name<<” : “<<age<<endl;

        }

        Records eldest(Records o)

        {

            return (o.age>age)? o: *this;

        }

};

int main()

{

    Records ob[3] = { Records(“Ani”,21), Records(“Arka”,50), Records(“Ram”,30) };

    Records res = ob[0];

    for(int i = 0 ; i<2; i++){

                res = res.eldest(ob[i+1]);

                }

    res.show();

    return 0;

}

Output :

Aim : Write a C++ program illustrating the use of virtual function in class.

Code :

#include <iostream>

using namespace std;

class Base{

public:

virtual void Output(){

cout << “Output Base class” << endl;

}

void Display(){

cout << “Display Base class” << endl;

}

};

class Derived : public Base{

public:

void Output(){

cout << “Output Derived class” << endl;

}

void Display()

{

cout << “Display Derived class” << endl;

}

};

int main(){

Base* bpointr;

Derived dpointr;

bpointr = &dpointr;

// binding virtually

bpointr->Output();

// binding non-virtually

bpointr->Display();

}

Output :

 Aim : Write a C++ program to design a class representing the information regarding digital library (books, tape: book & tape should be seperate classes having the base class as a media). The class should have the functionality for adding new item, issuing, deposite, etc. the program should use the runtime polymorphism.

Code :

#include<iostream>

#include<string>

#include <cstring>

using namespace std;

class media

{

 protected:

 char title[50];

 float price;

 public:

 media(char *s, float a)

 {

  strcpy(title, s);

  price = a;

 }

 virtual void display(){}

};

class book : public media

{

 int pages;

 public:

 book(char *s, float a, int p) : media(s,a)

 {

  pages = p;

 }

 void display();

};

class tape : public media

{

 float time;

 public:

 tape(char * s, float a, float t):media(s,a)

 {

  time =t;

 }

 void display();

};

void book ::display()

{

 cout<<“\n Title:”<<title;

 cout<<“\n Pages:”<<pages;

 cout<<“\n Price:”<<price;

}

void tape ::display ()

{

 cout<<“\n Play Time:”<<time<<“mins”;

 cout<<“\n Price:”<<price;

}

int main()

{

 char * title = new char[30];

 char * title1 = new char[30];

 float price, time;

 int pages;

 cout<<“\n Enter Book Details \n”;

 cout<<“\n Title:”;

 gets(title);

 cout<<“\n Price:”;

 cin>>price;

 cout<<“\n Pages:”;

 cin>>pages;

 book book1(title, price, pages);

 cout<<“\n Enter Tape Details”;

 cout<<“\n Price:”;

 cin>>price;

 cout<<“\n Play Times(mins):”;

 cin>>time;

 tape tape1(title1, price, time);

 media* list[2];

 list[0] = &book1;

 list[1] = &tape1;

 cout<<“\n Media Details”;

 cout<<“\n…………..Book…..”;

 list[0]->display();

 cout<<“\n…………..Tape…..”;

 list[1]->display();

 return 0;

}

Output:

Aim: Write a C++ program to show conversion from string to int and vice-versa.

a) String to Number conversion :-

Code :

#include<iostream>

#include<cstdlib>

using namespace std;

main() {

   int n;

   char num_string[20] = “1234”;

   n = atoi(num_string);

   cout << n;

}

Output :

b) Number to string conversion

Code :

#include<stdio.h>

main() {

   char str[20];

   float number;

   printf(“Enter a number: “);

   scanf(“%f”, &number);

   sprintf(str, “%f”, number);//number into string using sprintf

   printf(“You have entered: %s”, str);

}

Aim : Write a C++ program to implement basic operation of class ios i.e. elf, unself, precision, etc.

Code :

#include <iostream>

#include <fstream>

using namespace std;

int main()

{

    cout << “Example for formatted IO” << endl;

    cout << “Default: ” << endl;

    cout << 123 << endl;

    cout << “width(5): ” << endl;

    cout.width(5);

    cout << 123 << endl;

    cout << “width(5) and fill(‘*’): ” << endl;

    cout.width(5);

    cout.fill(‘*’);

    cout << 123 << endl;

    cout.precision(5);

    cout << “precision(5) —> ” << 123.4567890 << endl;

    cout << “precision(5) —> ” << 9.876543210 << endl;

    cout << “setf(showpos): ” << endl;

    cout.setf(ios::showpos);

    cout << 123 << endl;

    cout << “unsetf(showpos): ” << endl;

    cout.unsetf(ios::showpos);

    cout << 123 << endl;

    return 0;

}

Output : 

Aim : Write a C++ program to implement I/O operations includes inputting a string, Calculating length of the string, Storing the String in a file, fetching the stored characters from it, etc.

Code :

 #include<iostream>

#include<fstream>

#include<string>

using namespace std;

struct customer

{

   char name[20];

   float balance;

};

int main()

{

   customer savac;

   cout<<“Enter your name: “;

   cin.get(savac.name, 20);

   cout<<“Enter balance: “;

   cin>>savac.balance;

   ofstream fout;

   fout.open(“Saving”, ios::out | ios::binary);    // open file

   if(!fout)

   {

      cout<<“File can\’t be opened..!!\n”;

      cout<<“Press any key to exit…\n”;

      exit(1);

   }

   fout.write((char *) & savac, sizeof(customer));    // write

   fout.close();     // connection

   // read

   ifstream fin;

   fin.open(“Saving”, ios::in | ios::binary);    // open

   fin.read((char *) & savac, sizeof(customer));     // read

   cout<<savac.name;            // display structure

   cout<<” has the balance amount of Rs. “<<savac.balance<<“\n”;

   fin.close();

   cout<<“\nPress a key to exit…\n”;

}

Output :

Aim : Write a Program to copy the contents of one file to another.

Code :

#include <bits/stdc++.h>

using namespace std;

int main()

{

    fstream f1;

    fstream f2;

    string ch;

    f1.open(“file1.txt”, ios::in);

    // opening second

    f2.open(“file2.txt”, ios::out);

    while (!f1.eof()) {

        // extracting line by line

        getline(f1, ch);

        // writing line by line

        f2 << ch << endl;

    }

    // closing

    f1.close();

    f2.close();

    // opening and read

    f2.open(“file2.txt”, ios::in);

    while (!f2.eof()) {

        getline(f2, ch);

        cout << ch << endl;

    }

    f2.close();

    return 0;

}

Output :

Aim : Write a C++ program to perform read/write binary I/O operation on a file. (i.e. write the object of a structure/class to file).

Code :

#include <iostream>

#include <fstream>

#define FILE_NAME “emp.dat”

using namespace std;

//class employee declaration

class Employee {

private :

                int           empID;

                char       empName[100] ;

                char       designation[100];

                int           ddj,mmj,yyj;

                int           ddb,mmb,yyb;

public  :

                //function to read employee details

                void readEmployee(){

                                cout<<“EMPLOYEE DETAILS”<<endl;

                                cout<<“ENTER EMPLOYEE ID : ” ;

                                cin>>empID;

                                cin.ignore(1);

                                cout<<“ENTER  NAME OF THE EMPLOYEE : “;

                                cin.getline(empName,100);

                                cout<<“ENTER DESIGNATION : “;

                                cin.getline(designation,100);

                                cout<<“ENTER DATE OF JOIN:”<<endl;

                                cout<<“DATE : “; cin>>ddj;

                                cout<<“MONTH: “; cin>>mmj;

                                cout<<“YEAR : “; cin>>yyj;

                                cout<<“ENTER DATE OF BIRTH:”<<endl;

                                cout<<“DATE : “; cin>>ddb;

                                cout<<“MONTH: “; cin>>mmb;

                                cout<<“YEAR : “; cin>>yyb;

                }

                //function to write employee details

                void displayEmployee(){

                                cout<<“EMPLOYEE ID: “<<empID<<endl

                                 <<“EMPLOYEE NAME: “<<empName<<endl

                                 <<“DESIGNATION: “<<designation<<endl

                                 <<“DATE OF JOIN: “<<ddj<<“/”<<mmj<<“/”<<yyj<<endl

                                 <<“DATE OF BIRTH: “<<ddb<<“/”<<mmb<<“/”<<yyb<<endl;

                }

};

int main(){

                //object of Employee class

                Employee emp;

                //read employee details

                emp.readEmployee();

                //write object into the file

                fstream file;

                file.open(FILE_NAME,ios::out|ios::binary);

                if(!file){

                                cout<<“Error in creating file…\n”;

                                return -1;

                }

                file.write((char*)&emp,sizeof(emp));

                file.close();

                cout<<“Date saved into file the file.\n”;

                //open file again

                file.open(FILE_NAME,ios::in|ios::binary);

                if(!file){

                                cout<<“Error in opening file…\n”;

                                return -1;

                }

                if(file.read((char*)&emp,sizeof(emp))){

                                                cout<<endl<<endl;

                                                cout<<“Data extracted from file..\n”;

                                                //print the object

                                                emp.displayEmployee();

                }

                else{

                                cout<<“Error in reading data from file…\n”;

                                return -1;

                }

                file.close();        

                return 0;

}

Output :

Filed Under: university students updated material Tagged With: FYIT Mumbai University practicals solutions all updated 2023

FYCS Mumbai University practicals solutions and notes on demand all updated 2023

April 15, 2023 by displaymonk

below are practicals and their solutions for Mumbai university FYBsc computer science 2023 updated complete list.

below are practicals and their solutions for Mumbai University FYBsc computer science 2023 updated complete list.

Aim : Write a program to demonstrate the use of data members and member functions.

Code:

#include<iostream>

using namespace std;

class person {

  public:

                     string name;

                     int number;

                     void read() {

                               cout << “Enter the name:”;

                               getline(cin,name);

                               cout << “Enter the number:”;

                               cin >> number;

                                 }

                                 void print() {

                                                cout << “name:” << name << ” number:” << number;

                                 } 

};

int main() {

                person obj;

                cout << “Simple class and object example” << endl;

                obj.read();

                obj.print();

                return 0;

}

Output :

AIM : Write a Program based on branching and looping statements using classes

Code:

#include<iostream>

using namespace std;

int main() {

                int i, ch;

                char b[100];

                for(i=0; i<5; i++) {

                                cout << “Enter the choice: 1 – computer  2 – keyboard \n”;

                                cin >> ch;

                    switch(ch) {

                                case 1: {

                                                cout << “You have choosen computer\n”;

                                                                break;

                                                }

                                                case 2: {

                                                                cout << “You have choosen keyboard\n”;

                                                                break;

                                                }

                                }

                }

}

Output :

Aim : Write a Program to demonstrate one and two dimensional array using classes :-

a) One Dimension Array :

Code :

#include<iostream>

using namespace std;

int main()

{

 int abc[5], i;

 for (i=0; i<=4; i++)

 {

   cout << “Enter value in element” << i << endl;

   cin >> abc[i];

 }

   cout << “output in reverse order” << endl;

 for (i=4; i>=0; i–)

 {

   cout << “value in a[“<<i<<“] “<<abc[i]<<endl;

 } 

}

Output : 

b) Multi Dimension Array :

Code :

#include<iostream>

using namespace std;

int main()

{

  int mat[3][3]={2,1,4,3,2,7,5,6,8};

  int r,c,sum=0;

  for(r=0; r<3; r++)

  {

    for(c=0; c<3; c++){

      cout<<mat[r][c]<<“\t”;

      cout<<endl;

    }

  }

  for(r=0; r<3; r++){

                for(c=0; c<3; c++){

                                      sum += mat[r][c];

          cout<<sum<<”  “;

                  }

                  cout << endl;

  }

  return 0;

}

Output :

Aim : Write a Program to use scope resolution operator. Display the various values of the same variables declared at different scope levels.

Code :

#include <iostream>

using namespace std;

int my_variable = 10;

int main()

{

  int my_variable = 100;

  cout << “Value of global my_variable is ” << ::my_variable << endl;

  cout << “Value of local my_variable is ” << my_variable << endl;

  return 0;

}

Output :

Aim : Write a Program to demonstrate various types of constructor and destructors.

Default constructor :

Code :

#include<iostream>

using namespace std;

class A

{

    // constructor default

    A()

    {

        cout << “Constructor called”;

    }

    // destructor default

    ~A()

    {

        cout << “Destructor called”;

    }

};

int main()

{

    A obj1;   // Constructor

    int x = 1;

    if(x)

    {

        A obj2;  // Constructor

    }   // Destructor obj2

} //  Destructor obj1

Output :

Parameterized constructor :

Code :

#include<iostream>

using namespace std;

class Wall {

                private:

                                     double length;

                                     double height;

                public:

                                     Wall(double len, double hgt) {

                                               length = len;

                                               height = hgt;

                                                 }

                                                 ~Wall(){

                                                                cout << “Destructor called.” << endl;

                                                 }

                                                 double calculateArea() {

                                                                return length * height;

                                                 }

};

int main() {

                Wall wall1(9.5, 11.5);

                cout << “Area of first wall is: ” << wall1.calculateArea() << endl;

    return 0;

}

Output :

Aim : Write a Program to demonstrate use of public, protected and private scope specifier:

a) Protected Scope Specifier:

Code :

#include <iostream>

using namespace std;

class Parent {

    protected:

    int id_protected;

};

class Child : public Parent {

                public:

                                void setId(int id){

                                                id_protected = id;

                                }

                                void displayId(){

                                                cout << “id_protected is: ” << id_protected << endl;

                                }

};

int main(){

                Child obj1;

                obj1.setId(81);  obj1.displayId();

                return 0;

}

Output :

b) Private Scope Specifier:

Code :

#include<iostream>

using namespace std;

class Circle {

    private:

    double r;

    public:

    void calculate_area(double radius){

       r = radius;

                   double area = 3.14 * r * r;

                   cout << “Area is ” << area;

                }

};

int main() {

                Circle c1;

                c1.calculate_area(15);

}

Output :

c) Public Scope Specifier:

Code :

#include <iostream>

using namespace std;

class Circle {

                public:

                double radius;

                double calculate_area(){

                                return 3.14 * radius * radius;

                }

};

int main(){

                Circle c1;

                c1.radius = 14.5;

                cout << “Radius is: ” << c1.radius << endl;

                cout << “Area is: ” << c1.calculate_area();

                return 0;

}

Output :

Aim : Program to demonstrate single and multilevel inheritance

a) Single inheritance:

#include<iostream>

using namespace std;

class Vehicle {

                public:

                Vehicle(){

                                cout << “This is Vehical \n”;

                }

};

class Car : public Vehicle {

};

int main() {

                Car obj;

                return 0;

}

Output :

b)  Multilevel inheritance :

Code :

#include<iostream>

using namespace std;

class Vehicle {

                public:

                                Vehicle() {

                                                cout << “This is a Vehicle \n”;

                                }

};

class fourWheeler : public Vehicle {

                public:

                                fourWheeler(){

                                                cout << “Objects with 4 wheels are vehicles\n”;

                                }

};

class Car : public fourWheeler {

                public:

                                Car(){

                                                cout << “Car has 4 Wheels \n”;

                                }

};

int main() {

                Car obj;

                return 0;

}

Output :

Aim : Write a Program to demonstrate multiple inheritance and hierarchical inheritance

a) Multiple inheritance:

Code :

#include <iostream>

using namespace std;

class A

{

                public:

                int x;

                void getx()

    {

                    cout << “enter value of x: “; cin >> x;

    }

};

class B

{

                public:

                int y;

                void gety()

                {

                    cout << “enter value of y: “; cin >> y;

                }

};

class C : public A, public B   //C is derived

{

                public:

                void sum()

                {

                    cout << “Sum = ” << x + y;

                }

};

int main()

{

                 C obj1;

                 obj1.getx();

                 obj1.gety();

                 obj1.sum();

                 return 0;

}  

Output :

b) Hierarchical inheritance:

Code :

#include <iostream>

using namespace std;

class university

{

private:

    string university_name;

public:

    string getUniversityName()

    {

        university_name = “mumbai university”;

        return university_name;

    }

};

class student: public university

{

public:

    void display_student()

    {

        cout << “I am a student of the ” << getUniversityName() << “.\n\n”;

    }

};

class faculty: public university

{

public:

    void display_faculty()

    {

        cout << “I am a professor in the ” << getUniversityName() << “.\n\n”;

    }

};

int main()

{

    student obj1;

    obj1.display_student();

    faculty obj2;

    obj2.display_faculty();

    return 0;

}

Output :

Aim : Write a Program to demonstrate inheritance and derived class constructors.

Code :

#include<iostream>

using namespace std;

class baseClass

{

public:

  baseClass()

  {

    cout << “I am baseClass constructor” << endl;

  }

  ~baseClass()

  {

    cout << “I am baseClass destructor” << endl;

  }

};

class derivedClass: public baseClass

{

public:

  derivedClass()

  {

    cout << “I am derivedClass constructor” << endl;

  }

  ~derivedClass()

  {

    cout <<” I am derivedClass destructor” << endl;

  }

};

int main()

{

  derivedClass D;

  return 0;

}

Output :

Aim : Write a Program to demonstrate friend function, inline function and this pointer.

a) friend function:

Code :

#include <iostream>

using namespace std;

class Distance {

    private:

        int meter;

        friend int addFive(Distance);

    public:

        Distance() : meter(0) {}

};

int addFive(Distance d) {

    d.meter += 5;

    return d.meter;

}

int main() {

    Distance D;

    cout << “Distance: ” << addFive(D);

    return 0;

}

Output :

b) Inline function :

Code :

#include<iostream>

using namespace std;

inline int maxNumber(int x, int y) {

                return ( x > y) ? x : y;

}

int main() {

                cout << “Max of 0 and 20 is ” << maxNumber(0, 20) << endl;

                cout << “Max number of 7 and 200 is ” << maxNumber(7, 200) << endl;

                cout << “Max number of 222 and 444 is ” << maxNumber(222,444);

}

Output :

c) this pointer :

Code :

#include<iostream>

using namespace std;

class Employee {

                public:

                int id;

                string name;

                float salary;

                Employee(int id, string name, float salary) {

                this -> id = id;

                this -> name = name;

                this -> salary = salary;    

                }

                void display() {

                                cout<< “The ID is ” << id << endl;

                                cout << “The Name is ” << name << endl;

                                cout << “The Salary is ” << salary << “\n”;

                }

};

int main(void) {

                Employee e1 = Employee(01, “ravish”, 20000);

                Employee e2 = Employee(02, “kiran”, 15000);

                e1.display();

                e2.display();

                return 0;

}

Output :

Aim : Write a Program to function overloading and overriding.

a) Function overloading :

Code :

#include<iostream>

using namespace std;

//functions

void test(int);

void test(float);

void test(int, float);

int main() {

                int a = 5;

                float b = 5.6;

                test(a);

                test(b);

                test(a,b);

}

void test(int a) {

                cout << “Integer a is ” << a << endl;

}

void test(float b) {

                cout << “Float b is ” << b << endl;

}

void test(int a, float b) {

                cout << “Integer a and Float b is ” << a << b;

}

Output :

b) Function overriding :

Code :

#include <iostream>

using namespace std;

class Base {

   public:

    void print() {

        cout << “Base Function” << endl;

    }

};

class Derived : public Base {

   public:

    void print() {

        cout << “Derived Function” << endl;

    }

};

int main() {

    Derived derived1, derived2;

    derived1.print();

    // base class

    derived2.Base::print();

    return 0;

}

Output :

Aim : Write a Program to demonstrate pointers.

Code :

#include <iostream> 

using namespace std; 

int main() 

{ 

int number=30;   

int *p;     

p = &number;//address of number  

cout << “Address of number variable is:” << &number << endl;   

cout << “Address of p variable is:” << p << endl;   

cout << “Value of p variable is:”<< *p << endl;   

return 0; 

} 

Output :

Aim : Write a Programs to demonstrate text and binary file handling.

a) Text file :

Code :

#include <iostream>

#include <fstream>

using namespace std;

int main()

{

                fstream fio;

                string line;

                // file.txt

                fio.open(“file.txt”, ios::trunc | ios::out | ios::in);

                while (fio) {

                                getline(cin, line);

                                if (line == “-1”)

                                                break;

                                fio << line << endl;

                }

                fio.seekg(0, ios::beg);

                while (fio) {

                                getline(fio, line);

                                cout << line << endl;

                }

                fio.close();

                return 0;

}

Output :

file.txt

b) Binary file :

Code :

#include<iostream>

#include<fstream>

using namespace std;

struct Student {

   int roll_no;

   string name;

};

int main() {

   ofstream wf(“student.dat”, ios::out | ios::binary);

   if(!wf) {

      cout << “Cannot open file!” << endl;

      return 1;

   }

   Student wstu[3];

   wstu[0].roll_no = 1;

   wstu[0].name = “Ram”;

   wstu[1].roll_no = 2;

   wstu[1].name = “Shyam”;

   wstu[2].roll_no = 3;

   wstu[2].name = “Madhu”;

   for(int i = 0; i < 3; i++)

      wf.write((char *) &wstu[i], sizeof(Student));

   wf.close();

   if(!wf.good()) {

      cout << “Error occurred at writing time!” << endl;

      return 1;

   }

   ifstream rf(“student.dat”, ios::out | ios::binary);

   if(!rf) {

      cout << “Cannot open file!” << endl;

      return 1;

   }

   Student rstu[3];

   for(int i = 0; i < 3; i++)

      rf.read((char *) &rstu[i], sizeof(Student));

   rf.close();

   if(!rf.good()) {

      cout << “Error occurred at reading time!” << endl;

      return 1;

   }

   cout<<“Student’s Details:”<<endl;

   for(int i=0; i < 3; i++) {

      cout << “Roll No: ” << wstu[i].roll_no << endl;

      cout << “Name: ” << wstu[i].name << endl;

      cout << endl;

   }

   return 0;

}

Output :

Filed Under: university students updated material Tagged With: FYCS Mumbai University practicals solutions all updated 2023

Primary Sidebar

Search On Website

Laptop Desktop Chip Level Help Guide

  • Windows 10 Restarts After Shutdown

    Windows 10 Restarts After Shutdown

    March 24, 2025

  • T.VST59.031 Firmware Software

    T.VST59.031 Firmware Software Download Latest

    March 18, 2025

  • Mobile and Tablet Repairing Institute Class in Ratnagiri, Maharastra

    Mobile and Tablet Repairing Institute Class in Ratnagiri, Maharastra

    December 14, 2024

  • Laptop and Computer Repairing Institute in Ratnagiri, Maharastra

    Laptop and Computer Repairing Institute Class in Ratnagiri, Maharastra

    December 14, 2024

  • pm-modi-lic-sakhi-yojana

    LIC’s Bima Sakhi Yojana 2025: How To Apply?

    December 12, 2024

Footer

Mobile Repair

We do mobile repairing.

Learn more about mobile repairing service.

Laptop Repair

We laptop repairing.

Learn more about laptop repairing service.

TV Repair

We do TV repairing.

Learn more about tv repairing service.

Copyright © 2025 · DisplayMonk

  • Home
  • About Us
  • Repair Tips
  • Schematics Bios
  • Course
  • Online Jobs
  • Tools
  • Enquiry / Contact