Diploma Computer/IT

Object Oriented Programming Practical 4

Object Oriented Programming Practical 4 Question 1 Write a program to define a class student having data members name and roll no. Accept and display data for one object. Define the member function inside the class. student.cpp C #include <iostream.h> #include <conio.h> class Student { private: char name[30]; int rollNo; public: void acceptData() { cout […]

Object Oriented Programming Practical 4 Read More »

Object Oriented Programming Practical 3

Object Oriented Programming Practical 3 Question 1 Find the area of the rectangle by casting double data into float and int type. area.cpp C #include<iostream.h> #include<conio.h> void main() { double l,w; float area_float; int area_int; cout << "Enter the length of rectangle: "; cin >> l; cout << "Enter the width of rectangle: "; cin

Object Oriented Programming Practical 3 Read More »

Object Oriented Programming Practical 2

Object Oriented Programming Practical 2 Question 1 Write a C++ Program which show the use of function outside the class using scope resolution operator function.cpp C #include<iostream.h> #include<conio.h> class MyClass { public: void display(); }; void MyClass::display() { cout << "This function is outside class"<<endl; } void main() { clrscr(); MyClass obj; obj.display(); getch(); }

Object Oriented Programming Practical 2 Read More »

Object Oriented Programming Practical 1

Object Oriented Programming Practical 1 Question 1 Write a C++ program to evaluate the following expressions: X=(-b-(b2-4ac))/2a expression.cpp C #include<iostream.h> #include<conio.h> #include<math.h> void main() { clrscr(); int a,b,c,d; cout<<"Enter value of a,b and c"<<endl; cin>>a>>b>>c; d=(-b-(b*b-4*a*c))/(2*a); cout<<"Value= "<<d<<endl; getch(); } #include<iostream.h> #include<conio.h> #include<math.h> void main() { clrscr(); int a,b,c,d; cout<<"Enter value of a,b and c"<<endl;

Object Oriented Programming Practical 1 Read More »

Mobile Application Development Practical 33

Mobile Application Development Practical 32 Question 1 Write a program to locate user’s current location. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.Practical31" tools:targetApi="31"> <meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyAAl7T5IB74VSYRkOVs1F25Vv_EtKJKddA" /> <activity android:name=".MapsActivity" android:exported="true" android:label="@string/title_activity_maps"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />

Mobile Application Development Practical 33 Read More »

Programming With Python Practical 16

Programming With Python Practical 16 Question 1 Write a Python program to Check for ZeroDivisionError Exception. division.py num1=int(input("Enter a numerator: ")) num2=int(input("Enter a denominator: ")) try: result=num1/num2 print("Division is: ",result) except ZeroDivisionError: print("Denominator can not be zero") Output Question 2 Write a Python program to create user defined exception that will check whether the password

Programming With Python Practical 16 Read More »

Programming With Python Practical 15

Programming With Python Practical 15 Question 1 Create a class Employee with data members: name, department and salary. Create suitable methods for reading and printing employee information emp.py class Person: name="" def getData(self,n): self.name=n def putData(self): print("Name is: ",self.name) class Employee(Person): department="" salary=None def get(self,dep,sal): self.department=dep self.salary=sal def put(self): print("Department is: ",self.department) print("Salary is: ",

Programming With Python Practical 15 Read More »

Programming With Python Practical 13

Programming With Python Practical 13 Question 1 Write a Python program to create two matrices and perform addition, subtraction, multiplication and division operation on matrix. matrix.py import numpy as np a=np.array([]) b=np.array([]) print("Enter elements of first matrix: ") for i in range(0,4): num=int(input("Element:")) a=np.append(a,num) a.shape=(2,2) print("Enter elements of second matrix: ") for i in range(0,4):

Programming With Python Practical 13 Read More »

Programming With Python Practical 12

Programming With Python Practical 12 Question 1 Write a Python program to create a user defined module that will ask your college name and will display the name of the college. college.py def getcollege(): cname=input("Enter your college name: ") print("Your college name is: ",cname) collegemain.py import college college.getcollege() Output Question 2 Write a Python program

Programming With Python Practical 12 Read More »