PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Implement static/runtime polymorphism in C#. using System; namespace ATC { public class ATC { void Show(int a) { Console.WriteLine(“int a = {0}”,a); } void […]
Category: PPL Practicals
Dynamic runtime polymorphism in C#
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Implement dynamic/runtime polymorphism in C#. using System; namespace ATC { public class Parent { public virtual int Show() { return 1; } } public […]
Implement Encapsulation in C#
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Implement Encapsulation in C#. using System; namespace ATC { class AreaDimension { public double length; private double width; public double GetWidth() { Console.WriteLine(“Enter Width here becuase its private: “); […]
Implement Inheritance in C#
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Implement inheritance in C#. using System; namespace ATC { class CSE { public int age = 22; } class Child : CSE { static void Main(string[] args) { […]
program in Java to implement concurrent execution of a job using threads.
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Write a program in Java to implement concurrent execution of a job using threads. class Multithreading extends Thread { public void run() { try { System.out.println (“Thread ” + Thread.currentThread().getId() + ” is running”); } catch (Exception e) { System.out.println (“Exception is caught”); } } } public class Multithread { […]
program in Java to implement exception handling
PRINCIPLES OF PROGRAMING LANGUAGES PRACT. Write a program in Java to implement exception handling. public class JavaExceptionExample{ public static void main(String args[]) { int a = 10; try { int z= a/0; } catch(ArithmeticException e) { System.out.println(e);} } }
Call by reference in C++
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Write a program in C++ to implement call by reference parameter passing Method. #include <iostream> using namespace std; void show(int *x) { cout<<*x<<endl; } int main() { int age = 20; show(&age); return 0; }
Call by value in C++
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Write a program in C++ to implement call by value parameter passing Methods. #include <iostream> using namespace std; void show(int x) { cout<<x<<endl; } int main() { int age = 20; show(age); show(10); return 0; }
Implementation of pointers in C++
PRINIPLES OF PROGRAMMING LANGUAGES PRACT. Implementation of pointers in C++. #include <iostream> using namespace std; int main () { int age = 20; int *a; a = &age; cout << “Address of Age variable “; cout << a << endl; cout << “Age = “; […]
Memory Implementation of 3D Array.
#include <iostream> using namespace std; int main() { int arr[2][3][2]; cout << “Enter 12 values: n”; for(int i = 0; i < 2; ++i) { for (int j = 0; j < 3; ++j) { […]
Memory Implementation of 2D Array.
PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Memory Implementation of 2D Array. #include <iostream> using namespace std; int main() { int arr[3][2]; cout << “Enter 06 values: n”; for (int j = 0; j < 3; ++j) { for(int k = 0; k < […]